Uses JWT, fixes some endpoints, adds base services
This commit is contained in:
6
pom.xml
6
pom.xml
@@ -15,6 +15,7 @@
|
||||
<quarkus.platform.group-id>io.quarkus.platform</quarkus.platform.group-id>
|
||||
<quarkus.platform.version>3.21.2</quarkus.platform.version>
|
||||
<skipITs>true</skipITs>
|
||||
<jwt.version>4.5.0</jwt.version>
|
||||
<steamworks.version>1.9.0</steamworks.version>
|
||||
<surefire-plugin.version>3.5.2</surefire-plugin.version>
|
||||
</properties>
|
||||
@@ -42,6 +43,11 @@
|
||||
<artifactId>steamworks4j-server</artifactId>
|
||||
<version>${steamworks.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.auth0</groupId>
|
||||
<artifactId>java-jwt</artifactId>
|
||||
<version>${jwt.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.quarkus</groupId>
|
||||
<artifactId>quarkus-rest</artifactId>
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package ch.gtache.elderscrollslegends.service;
|
||||
|
||||
import ch.gtache.elderscrollslegends.service.account.AccountService;
|
||||
import jakarta.ws.rs.NotAuthorizedException;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class BaseEndpoints {
|
||||
|
||||
private final AccountService accountService;
|
||||
|
||||
protected BaseEndpoints(final AccountService accountService) {
|
||||
this.accountService = Objects.requireNonNull(accountService);
|
||||
}
|
||||
|
||||
protected AccountService accountService() {
|
||||
return accountService;
|
||||
}
|
||||
|
||||
protected String authenticateOrThrow(final String bearerToken) {
|
||||
if (bearerToken == null || !bearerToken.startsWith("Bearer ")) {
|
||||
throw new NotAuthorizedException("Invalid token", "Bearer");
|
||||
}
|
||||
final var token = bearerToken.replace("Bearer ", "");
|
||||
final var steamID = accountService.getSteamIDFromToken(token);
|
||||
if (steamID == null) {
|
||||
throw new NotAuthorizedException("Invalid token", "Bearer");
|
||||
}
|
||||
return steamID;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package ch.gtache.elderscrollslegends.service;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.util.Objects;
|
||||
|
||||
public class BaseService {
|
||||
|
||||
private final DataSource dataSource;
|
||||
|
||||
protected BaseService(final DataSource dataSource) {
|
||||
this.dataSource = Objects.requireNonNull(dataSource);
|
||||
}
|
||||
|
||||
protected DataSource dataSource() {
|
||||
return dataSource;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package ch.gtache.elderscrollslegends.service;
|
||||
|
||||
public record Card(int hash) {
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package ch.gtache.elderscrollslegends.service;
|
||||
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import jakarta.inject.Inject;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
@ApplicationScoped
|
||||
public class CardService extends BaseService {
|
||||
|
||||
@Inject
|
||||
CardService(final DataSource dataSource) {
|
||||
super(dataSource);
|
||||
}
|
||||
|
||||
public Card getCard(final int hash) {
|
||||
// TODO
|
||||
return new Card(hash);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package ch.gtache.elderscrollslegends.service;
|
||||
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import jakarta.inject.Inject;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
@ApplicationScoped
|
||||
public class ClassService extends BaseService {
|
||||
|
||||
@Inject
|
||||
ClassService(final DataSource dataSource) {
|
||||
super(dataSource);
|
||||
}
|
||||
|
||||
public Clazz getClass(final int hash) {
|
||||
// TODO
|
||||
return new Clazz(hash);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package ch.gtache.elderscrollslegends.service;
|
||||
|
||||
public record Clazz(int hash) {
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package ch.gtache.elderscrollslegends.service;
|
||||
|
||||
import ch.gtache.elderscrollslegends.service.inventory.Deck;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import jakarta.inject.Inject;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
@ApplicationScoped
|
||||
public class DeckService extends BaseService {
|
||||
|
||||
@Inject
|
||||
DeckService(final DataSource dataSource) {
|
||||
super(dataSource);
|
||||
}
|
||||
|
||||
public Deck getDeck(final String steamID, final long deckID) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,25 @@
|
||||
package ch.gtache.elderscrollslegends.service;
|
||||
|
||||
import com.codedisaster.steamworks.*;
|
||||
import com.codedisaster.steamworks.SteamAPI;
|
||||
import com.codedisaster.steamworks.SteamAuth;
|
||||
import com.codedisaster.steamworks.SteamAuthTicket;
|
||||
import com.codedisaster.steamworks.SteamException;
|
||||
import com.codedisaster.steamworks.SteamGameServer;
|
||||
import com.codedisaster.steamworks.SteamGameServerAPI;
|
||||
import com.codedisaster.steamworks.SteamGameServerCallback;
|
||||
import com.codedisaster.steamworks.SteamID;
|
||||
import com.codedisaster.steamworks.SteamResult;
|
||||
import com.codedisaster.steamworks.SteamUser;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Arrays;
|
||||
import java.util.HexFormat;
|
||||
|
||||
public class Main {
|
||||
public final class Main {
|
||||
|
||||
private Main() {
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws SteamException, InterruptedException {
|
||||
SteamGameServerAPI.loadLibraries();
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package ch.gtache.elderscrollslegends.service;
|
||||
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import jakarta.ws.rs.Produces;
|
||||
import org.eclipse.microprofile.config.inject.ConfigProperty;
|
||||
|
||||
import java.time.Duration;
|
||||
|
||||
@ApplicationScoped
|
||||
class Providers {
|
||||
|
||||
Providers() {
|
||||
|
||||
}
|
||||
|
||||
@Produces
|
||||
@ApplicationScoped
|
||||
static Duration providesTimeToLive(@ConfigProperty(name = "jwt.token.ttl.seconds") final int ttl) {
|
||||
return Duration.ofSeconds(ttl);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
package ch.gtache.elderscrollslegends.service.account;
|
||||
|
||||
public record ABTestingSet(String setKey, String groupKey) {
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
package ch.gtache.elderscrollslegends.service.account;
|
||||
|
||||
import ch.gtache.elderscrollslegends.service.BaseEndpoints;
|
||||
import ch.gtache.elderscrollslegends.service.SteamService;
|
||||
import ch.gtache.elderscrollslegends.service.account.auth.AuthBNETGamecodeRequest;
|
||||
import ch.gtache.elderscrollslegends.service.account.auth.AuthBNETSteamRequest;
|
||||
import ch.gtache.elderscrollslegends.service.account.auth.AuthResult;
|
||||
import ch.gtache.elderscrollslegends.service.account.auth.LogoutSteamRequest;
|
||||
import ch.gtache.elderscrollslegends.service.account.check.CheckEmailRequest;
|
||||
import ch.gtache.elderscrollslegends.service.account.check.CheckEmailResponse;
|
||||
import ch.gtache.elderscrollslegends.service.account.check.CheckEmailResponseBody;
|
||||
@@ -27,17 +27,16 @@ import java.util.List;
|
||||
import static java.util.Objects.requireNonNull;
|
||||
|
||||
@Path("/account")
|
||||
public class AccountEndpoints {
|
||||
public class AccountEndpoints extends BaseEndpoints {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(AccountEndpoints.class);
|
||||
|
||||
private final SteamService steamService;
|
||||
private final AccountService accountService;
|
||||
|
||||
@Inject
|
||||
AccountEndpoints(final SteamService steamService, final AccountService accountService) {
|
||||
AccountEndpoints(final AccountService accountService, final SteamService steamService) {
|
||||
super(accountService);
|
||||
this.steamService = requireNonNull(steamService);
|
||||
this.accountService = requireNonNull(accountService);
|
||||
}
|
||||
|
||||
@POST
|
||||
@@ -49,7 +48,7 @@ public class AccountEndpoints {
|
||||
try {
|
||||
if (steamService.authenticate(request.sessionTicket(), request.steamId())) {
|
||||
logger.info("SteamLogin succeeded for " + request);
|
||||
final var data = accountService.authenticate(request.steamId());
|
||||
final var data = accountService().authenticate(request.steamId());
|
||||
return new AuthResult(data, 0, null, List.of());
|
||||
} else {
|
||||
return new AuthResult(null, 2, "SteamLogin failed", List.of());
|
||||
@@ -63,9 +62,11 @@ public class AccountEndpoints {
|
||||
@POST
|
||||
@Path("bnetSteamLogout")
|
||||
@Consumes("application/json")
|
||||
public void steamLogout(final LogoutSteamRequest request) {
|
||||
logger.info("SteamLogout called : " + request);
|
||||
steamService.endAuthSession(request.steamId());
|
||||
public void steamLogout(@HeaderParam("Authorization") final String authentication) {
|
||||
logger.info("SteamLogout called");
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("SteamLogout called by " + steamID);
|
||||
steamService.endAuthSession(steamID);
|
||||
}
|
||||
|
||||
@POST
|
||||
@@ -74,7 +75,7 @@ public class AccountEndpoints {
|
||||
@Produces("application/json")
|
||||
public AuthResult gamecodeLogin(final AuthBNETGamecodeRequest request) {
|
||||
logger.info("GamecodeLogin called : " + request);
|
||||
return null;
|
||||
return new AuthResult(null, 1, "GamecodeLogin not implemented", List.of());
|
||||
}
|
||||
|
||||
@POST
|
||||
@@ -83,7 +84,7 @@ public class AccountEndpoints {
|
||||
@Produces("application/json")
|
||||
public CheckUsernameResponse checkUsername(final CheckUsernameRequest request) {
|
||||
logger.info("CheckUsername called : " + request);
|
||||
if (accountService.exists(request.username())) {
|
||||
if (accountService().exists(request.username())) {
|
||||
return new CheckUsernameResponse(new CheckUsernameResponseBody(true, true, 0));
|
||||
} else {
|
||||
return new CheckUsernameResponse(new CheckUsernameResponseBody(false, false, 1));
|
||||
@@ -96,7 +97,7 @@ public class AccountEndpoints {
|
||||
@Produces("application/json")
|
||||
public CheckEmailResponse checkEmail(final CheckEmailRequest request) {
|
||||
logger.info("CheckEmail called : " + request);
|
||||
if (accountService.exists(request.email())) {
|
||||
if (accountService().exists(request.email())) {
|
||||
return new CheckEmailResponse(new CheckEmailResponseBody(true, 0));
|
||||
} else {
|
||||
return new CheckEmailResponse(new CheckEmailResponseBody(false, 1));
|
||||
@@ -107,10 +108,13 @@ public class AccountEndpoints {
|
||||
@Path("bnetRefreshSession")
|
||||
@Consumes("application/json")
|
||||
@Produces("application/json")
|
||||
public RefreshSessionResponse refreshSession(final RefreshSessionRequest request) {
|
||||
public RefreshSessionResponse refreshSession(@HeaderParam("Authorization") final String authentication,
|
||||
final RefreshSessionRequest request) {
|
||||
logger.info("RefreshSession called : " + request);
|
||||
final var token = accountService.refresh(request.bnetKeyPlatform());
|
||||
final var timeToRefresh = Duration.between(java.time.Instant.now(), token.expirationTimestamp()).getSeconds();
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
final var token = accountService().refreshToken(steamID);
|
||||
final var timeToRefresh = Duration.between(java.time.Instant.now(), token.expirationTimestamp())
|
||||
.minus(Duration.ofMinutes(5)).getSeconds();
|
||||
return new RefreshSessionResponse((int) timeToRefresh, token.token());
|
||||
}
|
||||
|
||||
@@ -121,7 +125,8 @@ public class AccountEndpoints {
|
||||
public LegalDocumentsResponse getLegalDocumentsForUser(@HeaderParam("Authorization") final String authentication,
|
||||
final GetLegalDocumentsForUserRequest request) {
|
||||
logger.info("GetLegalDocumentsForUser called : " + request);
|
||||
return null;
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
return new LegalDocumentsResponse(List.of());
|
||||
}
|
||||
|
||||
@POST
|
||||
@@ -130,6 +135,7 @@ public class AccountEndpoints {
|
||||
public void acceptLegalDocument(@HeaderParam("Authorization") final String authentication,
|
||||
final AcceptLegalDocumentRequest request) {
|
||||
logger.info("acceptLegalDocument called : " + request);
|
||||
authenticateOrThrow(authentication);
|
||||
}
|
||||
|
||||
@POST
|
||||
@@ -138,6 +144,6 @@ public class AccountEndpoints {
|
||||
@Produces("application/json")
|
||||
public LegalDocumentsResponse getAllLegalDocuments(final GetAllLegalDocumentsRequest request) {
|
||||
logger.info("GetAllLegalDocuments called : " + request);
|
||||
return null;
|
||||
return new LegalDocumentsResponse(List.of());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package ch.gtache.elderscrollslegends.service.account;
|
||||
|
||||
import ch.gtache.elderscrollslegends.service.BaseService;
|
||||
import ch.gtache.elderscrollslegends.service.SteamService;
|
||||
import ch.gtache.elderscrollslegends.service.Token;
|
||||
import ch.gtache.elderscrollslegends.service.account.auth.AuthData;
|
||||
@@ -15,24 +16,25 @@ import java.util.List;
|
||||
import static java.util.Objects.requireNonNull;
|
||||
|
||||
@ApplicationScoped
|
||||
public class AccountService {
|
||||
public class AccountService extends BaseService {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(AccountService.class);
|
||||
|
||||
private final JWTService jwtService;
|
||||
private final SteamService steamService;
|
||||
private final DataSource dataSource;
|
||||
|
||||
@Inject
|
||||
AccountService(final SteamService steamService, final DataSource dataSource) {
|
||||
AccountService(final DataSource dataSource, final JWTService jwtService, final SteamService steamService) {
|
||||
super(dataSource);
|
||||
this.jwtService = requireNonNull(jwtService);
|
||||
this.steamService = requireNonNull(steamService);
|
||||
this.dataSource = requireNonNull(dataSource);
|
||||
}
|
||||
|
||||
|
||||
public AuthData authenticate(final String steamID) {
|
||||
AuthData authenticate(final String steamID) {
|
||||
if (!exists(steamID)) {
|
||||
final var longId = Long.parseLong(steamID);
|
||||
final var name = steamService.getName(steamID);
|
||||
try (final var connection = dataSource.getConnection();
|
||||
try (final var connection = dataSource().getConnection();
|
||||
final var statement = connection.prepareStatement("INSERT INTO player (steam_id, name) VALUES (?, ?)")) {
|
||||
statement.setLong(1, longId);
|
||||
statement.setString(2, name);
|
||||
@@ -43,14 +45,14 @@ public class AccountService {
|
||||
}
|
||||
}
|
||||
updateNameIfNeeded(steamID);
|
||||
final var token = getOrCreateToken(steamID);
|
||||
final var token = jwtService.createToken(steamID);
|
||||
return getAuthData(steamID, token);
|
||||
}
|
||||
|
||||
private void updateNameIfNeeded(final String steamID) {
|
||||
final var longId = Long.parseLong(steamID);
|
||||
final var name = steamService.getName(steamID);
|
||||
try (final var connection = dataSource.getConnection();
|
||||
try (final var connection = dataSource().getConnection();
|
||||
final var statement = connection.prepareStatement("UPDATE player SET name=? WHERE steam_id=?")) {
|
||||
statement.setString(1, name);
|
||||
statement.setLong(2, longId);
|
||||
@@ -60,47 +62,19 @@ public class AccountService {
|
||||
}
|
||||
}
|
||||
|
||||
private Token getOrCreateToken(final String steamID) {
|
||||
final var longId = Long.parseLong(steamID);
|
||||
try (final var connection = dataSource.getConnection();
|
||||
final var statement = connection.prepareStatement("SELECT token, expiration FROM token WHERE player_id=(SELECT id FROM player WHERE steam_id=?)")) {
|
||||
statement.setLong(1, longId);
|
||||
try (final var rs = statement.executeQuery()) {
|
||||
if (rs.next()) {
|
||||
final var token = rs.getString(1);
|
||||
final var expiration = rs.getTimestamp(2).toInstant();
|
||||
if (expiration.isAfter(java.time.Instant.now())) {
|
||||
return new Token(token, expiration);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (final SQLException e) {
|
||||
logger.error("Error checking for player " + steamID, e);
|
||||
}
|
||||
try (final var connection = dataSource.getConnection();
|
||||
final var statement = connection.prepareStatement("INSERT INTO token (player_id) VALUES ((SELECT id FROM player WHERE steam_id=?)) RETURNING token, expiration")) {
|
||||
statement.setLong(1, longId);
|
||||
try (final var rs = statement.executeQuery()) {
|
||||
return rs.next() ? new Token(rs.getString(1), rs.getTimestamp(2).toInstant()) : null;
|
||||
}
|
||||
} catch (final SQLException e) {
|
||||
logger.error("Error inserting player " + steamID, e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private AuthData getAuthData(final String steamID, final Token token) {
|
||||
if (token != null) {
|
||||
final var longId = Long.parseLong(steamID);
|
||||
try (final var connection = dataSource.getConnection();
|
||||
final var statement = connection.prepareStatement("SELECT 1 FROM player WHERE steam_id=?")) {
|
||||
try (final var connection = dataSource().getConnection();
|
||||
final var statement = connection.prepareStatement("SELECT name FROM player WHERE steam_id=?")) {
|
||||
statement.setLong(1, longId);
|
||||
try (final var rs = statement.executeQuery()) {
|
||||
if (rs.next()) {
|
||||
final var uuid = token.token();
|
||||
final var name = rs.getString(1);
|
||||
final var timeToRefresh = Duration.between(java.time.Instant.now(), token.expirationTimestamp()).getSeconds();
|
||||
return new AuthData(uuid, "", "", "", "", steamID, steamID, steamID,
|
||||
"", steamID, "CH", false, false, (int) timeToRefresh,
|
||||
return new AuthData(uuid, "", "steam", "", uuid, steamID, steamID, steamID,
|
||||
"", name, "US", false, false, (int) timeToRefresh,
|
||||
5, 5, false, "", "",
|
||||
0, List.of(), false);
|
||||
}
|
||||
@@ -112,9 +86,9 @@ public class AccountService {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean exists(final String steamID) {
|
||||
boolean exists(final String steamID) {
|
||||
final var longId = Long.parseLong(steamID);
|
||||
try (final var connection = dataSource.getConnection();
|
||||
try (final var connection = dataSource().getConnection();
|
||||
final var statement = connection.prepareStatement("SELECT 1 FROM player WHERE steam_id=?")) {
|
||||
statement.setLong(1, longId);
|
||||
try (final var rs = statement.executeQuery()) {
|
||||
@@ -126,19 +100,11 @@ public class AccountService {
|
||||
return false;
|
||||
}
|
||||
|
||||
public Token refresh(final String steamID) {
|
||||
if (exists(steamID)) {
|
||||
final var longId = Long.parseLong(steamID);
|
||||
try (final var connection = dataSource.getConnection();
|
||||
final var statement = connection.prepareStatement("DELETE FROM token WHERE player_id=(SELECT id FROM player WHERE steam_id=?)")) {
|
||||
statement.setLong(1, longId);
|
||||
statement.executeUpdate();
|
||||
} catch (final SQLException e) {
|
||||
logger.error("Error checking for player " + steamID, e);
|
||||
}
|
||||
return getOrCreateToken(steamID);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
Token refreshToken(final String steamID) {
|
||||
return jwtService.createToken(steamID);
|
||||
}
|
||||
|
||||
public String getSteamIDFromToken(final String token) {
|
||||
return jwtService.getSteamID(token);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
package ch.gtache.elderscrollslegends.service.account;
|
||||
|
||||
import ch.gtache.elderscrollslegends.service.Token;
|
||||
import com.auth0.jwt.JWT;
|
||||
import com.auth0.jwt.JWTVerifier;
|
||||
import com.auth0.jwt.algorithms.Algorithm;
|
||||
import com.auth0.jwt.exceptions.JWTVerificationException;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import jakarta.inject.Inject;
|
||||
import org.eclipse.microprofile.config.inject.ConfigProperty;
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.util.Objects;
|
||||
|
||||
@ApplicationScoped
|
||||
class JWTService {
|
||||
private static final Logger logger = Logger.getLogger(JWTService.class.getName());
|
||||
|
||||
private static final String ISSUER = "TESL";
|
||||
|
||||
private final Duration timeToLive;
|
||||
private final Algorithm algorithm;
|
||||
private final JWTVerifier verifier;
|
||||
|
||||
@Inject
|
||||
JWTService(@ConfigProperty(name = "jwt.hs256.key.secret") final String key, final Duration timeToLive) {
|
||||
this.timeToLive = Objects.requireNonNull(timeToLive);
|
||||
this.algorithm = Algorithm.HMAC256(key);
|
||||
this.verifier = JWT.require(algorithm).withIssuer(ISSUER).build();
|
||||
}
|
||||
|
||||
public String getSteamID(final String token) {
|
||||
try {
|
||||
final var decoded = verifier.verify(token);
|
||||
return decoded.getSubject();
|
||||
} catch (final JWTVerificationException e) {
|
||||
logger.warn("Invalid token " + token, e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isValid(final String token) {
|
||||
try {
|
||||
verifier.verify(token);
|
||||
return true;
|
||||
} catch (final JWTVerificationException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Token createToken(final String steamID) {
|
||||
final var expiration = Instant.now().plus(timeToLive);
|
||||
final var token = JWT.create()
|
||||
.withSubject(steamID)
|
||||
.withIssuer(ISSUER)
|
||||
.withIssuedAt(Instant.now())
|
||||
.withExpiresAt(expiration).sign(algorithm);
|
||||
return new Token(token, expiration);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package ch.gtache.elderscrollslegends.service.account.auth;
|
||||
|
||||
public record LogoutSteamRequest(String steamId) {
|
||||
record ABTestingSet(String setKey, String groupKey) {
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
package ch.gtache.elderscrollslegends.service.account.auth;
|
||||
|
||||
import ch.gtache.elderscrollslegends.service.account.ABTestingSet;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public record AuthData(String token,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package ch.gtache.elderscrollslegends.service.account.transfer;
|
||||
|
||||
public record LegalDocEntry(String doctype, String full_name, int id, String url) {
|
||||
record LegalDocEntry(String doctype, String full_name, int id, String url) {
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package ch.gtache.elderscrollslegends.service.account.transfer;
|
||||
|
||||
import ch.gtache.elderscrollslegends.service.inventory.SelectedItem;
|
||||
import ch.gtache.elderscrollslegends.service.inventory.InventorySelectedItem;
|
||||
import ch.gtache.elderscrollslegends.service.profile.ProfileStruct;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
record TransferResponse_Phase0(List<LegalDocEntry> items, String buid, String sessionToken, boolean hasTeslUserData,
|
||||
ProfileStruct profile, List<SelectedItem> categories) {
|
||||
ProfileStruct profile, List<InventorySelectedItem> categories) {
|
||||
}
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
package ch.gtache.elderscrollslegends.service.analytics;
|
||||
|
||||
public record AnalysticsEventPayload(AnalyticsEventType eventType, String data) {
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
package ch.gtache.elderscrollslegends.service.analytics;
|
||||
|
||||
import ch.gtache.elderscrollslegends.service.BaseEndpoints;
|
||||
import ch.gtache.elderscrollslegends.service.account.AccountService;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.ws.rs.GET;
|
||||
import jakarta.ws.rs.HeaderParam;
|
||||
import jakarta.ws.rs.POST;
|
||||
@@ -7,32 +10,42 @@ import jakarta.ws.rs.Path;
|
||||
import jakarta.ws.rs.Produces;
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Path("/analytics")
|
||||
public class AnalyticsEndpoints {
|
||||
public class AnalyticsEndpoints extends BaseEndpoints {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(AnalyticsEndpoints.class);
|
||||
private final AnalyticsService analyticsService;
|
||||
|
||||
@Inject
|
||||
AnalyticsEndpoints(final AccountService accountService, final AnalyticsService analyticsService) {
|
||||
super(accountService);
|
||||
this.analyticsService = Objects.requireNonNull(analyticsService);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/clientEvent")
|
||||
public void newAnalytics(@HeaderParam("Authorization") final String authentication,
|
||||
final AnalyticsEvent analyticsEvent) {
|
||||
logger.info("Report analytics called by " + authentication + " : " + analyticsEvent);
|
||||
//Do nothing
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("Report analytics called by " + steamID + " : " + analyticsEvent);
|
||||
analyticsService.newAnalytics(steamID, analyticsEvent);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/clientEventPA")
|
||||
public void newAnalyticsPA(@HeaderParam("Authorization") final String authentication,
|
||||
final AnalyticsEvent analyticsEvent) {
|
||||
logger.info("Report analyticsPA called by " + authentication + " : " + analyticsEvent);
|
||||
//Do nothing
|
||||
public void newAnalyticsPA(final AnalyticsEvent analyticsEvent) {
|
||||
logger.info("Report analyticsPA called : " + analyticsEvent);
|
||||
analyticsService.newAnalytics(analyticsEvent);
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/reportingConfig")
|
||||
@Produces("application/json")
|
||||
public FetchResponse getReportingConfig(@HeaderParam("Authorization") final String authentication) {
|
||||
logger.info("ReportingConfig called by " + authentication);
|
||||
return null;
|
||||
public AnalyticsFetchResponse getReportingConfig(@HeaderParam("Authorization") final String authentication) {
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("ReportingConfig called by " + steamID);
|
||||
return new AnalyticsFetchResponse(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,5 +2,5 @@ package ch.gtache.elderscrollslegends.service.analytics;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public record AnalyticsEvent(int platformId, int clientVersion, String eventData, List<AnalysticsEventPayload> events) {
|
||||
public record AnalyticsEvent(int platformId, int clientVersion, String eventData, List<AnalyticsEventPayload> events) {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
package ch.gtache.elderscrollslegends.service.analytics;
|
||||
|
||||
public record AnalyticsEventPayload(AnalyticsEventType eventType, String data) {
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package ch.gtache.elderscrollslegends.service.analytics;
|
||||
|
||||
public record AnalyticsFetchResponse(boolean enableReporting) {
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package ch.gtache.elderscrollslegends.service.analytics;
|
||||
|
||||
import ch.gtache.elderscrollslegends.service.BaseService;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import jakarta.inject.Inject;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
@ApplicationScoped
|
||||
class AnalyticsService extends BaseService {
|
||||
|
||||
@Inject
|
||||
AnalyticsService(final DataSource dataSource) {
|
||||
super(dataSource);
|
||||
}
|
||||
|
||||
void newAnalytics(final AnalyticsEvent analyticsEvent) {
|
||||
|
||||
}
|
||||
|
||||
void newAnalytics(final String steamID, final AnalyticsEvent analyticsEvent) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
package ch.gtache.elderscrollslegends.service.analytics;
|
||||
|
||||
public record FetchResponse(boolean enableReporting) {
|
||||
}
|
||||
@@ -1,57 +1,95 @@
|
||||
package ch.gtache.elderscrollslegends.service.arena;
|
||||
|
||||
import ch.gtache.elderscrollslegends.service.BaseEndpoints;
|
||||
import ch.gtache.elderscrollslegends.service.CardService;
|
||||
import ch.gtache.elderscrollslegends.service.ClassService;
|
||||
import ch.gtache.elderscrollslegends.service.account.AccountService;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.ws.rs.Consumes;
|
||||
import jakarta.ws.rs.GET;
|
||||
import jakarta.ws.rs.HeaderParam;
|
||||
import jakarta.ws.rs.POST;
|
||||
import jakarta.ws.rs.Path;
|
||||
import jakarta.ws.rs.Produces;
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
import static java.util.Objects.requireNonNull;
|
||||
|
||||
@Path("/arena")
|
||||
public class ArenaEndpoints {
|
||||
public class ArenaEndpoints extends BaseEndpoints {
|
||||
private static final Logger logger = Logger.getLogger(ArenaEndpoints.class);
|
||||
|
||||
private final ArenaService arenaService;
|
||||
private final CardService cardService;
|
||||
private final ClassService classService;
|
||||
|
||||
@Inject
|
||||
ArenaEndpoints(final AccountService accountService, final ArenaService arenaService,
|
||||
final CardService cardService, final ClassService classService) {
|
||||
super(accountService);
|
||||
this.arenaService = requireNonNull(arenaService);
|
||||
this.cardService = requireNonNull(cardService);
|
||||
this.classService = requireNonNull(classService);
|
||||
}
|
||||
|
||||
@Path("purchaseArena")
|
||||
@POST
|
||||
@Path("purchaseArena")
|
||||
@Consumes("application/json")
|
||||
@Produces("application/json")
|
||||
public FetchArenaInstancesResult purchaseArena(@HeaderParam("Authorization") final String authentication,
|
||||
final PurchaseArenaRequest request) {
|
||||
return null;
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("purchaseArena called by " + steamID + " : " + request);
|
||||
arenaService.purchaseArena(steamID, request.arenaType(), request.currencyType());
|
||||
final var data = arenaService.getArenaClientData(steamID);
|
||||
return new FetchArenaInstancesResult(data);
|
||||
}
|
||||
|
||||
@Path("resignArena")
|
||||
@POST
|
||||
@Path("resignArena")
|
||||
@Consumes("application/json")
|
||||
@Produces("application/json")
|
||||
public ResignArenaResult resignArena(@HeaderParam("Authorization") final String authentication,
|
||||
final ResignArenaRequest request) {
|
||||
return null;
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("resignArena called by " + steamID + " : " + request);
|
||||
arenaService.resignArena(steamID, request.arenaType());
|
||||
return new ResignArenaResult();
|
||||
}
|
||||
|
||||
@Path("selectCard")
|
||||
@POST
|
||||
@Path("selectCard")
|
||||
@Consumes("application/json")
|
||||
@Produces("application/json")
|
||||
public SelectCardResult selectCard(@HeaderParam("Authorization") final String authentication,
|
||||
final SelectCardRequest request) {
|
||||
return null;
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("selectCard called by " + steamID + " : " + request);
|
||||
final var card = cardService.getCard(request.cardTypeHash());
|
||||
arenaService.selectCard(steamID, request.arenaType(), card);
|
||||
return new SelectCardResult(arenaService.getArenaClientData(steamID));
|
||||
}
|
||||
|
||||
@Path("selectClassType")
|
||||
@POST
|
||||
@Path("selectClassType")
|
||||
@Consumes("application/json")
|
||||
@Produces("application/json")
|
||||
public SelectClassResult selectClassType(@HeaderParam("Authorization") final String authentication,
|
||||
final SelectClassRequest request) {
|
||||
return null;
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("selectClassType called by " + steamID + " : " + request);
|
||||
final var clazz = classService.getClass(request.classTypeHash());
|
||||
arenaService.selectClass(steamID, request.arenaType(), clazz);
|
||||
return new SelectClassResult(arenaService.getArenaClientData(steamID));
|
||||
}
|
||||
|
||||
@Path("fetchActiveArenaInstances")
|
||||
@GET
|
||||
@Path("fetchActiveArenaInstances")
|
||||
@Consumes("application/json")
|
||||
@Produces("application/json")
|
||||
public FetchArenaInstancesResult fetchActiveArenaInstances() {
|
||||
return null;
|
||||
public FetchArenaInstancesResult fetchActiveArenaInstances(@HeaderParam("Authorization") final String authentication) {
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("fetchActiveArenaInstances called by " + steamID);
|
||||
return new FetchArenaInstancesResult(arenaService.getArenaClientData(steamID));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package ch.gtache.elderscrollslegends.service.arena;
|
||||
|
||||
import ch.gtache.elderscrollslegends.service.BaseService;
|
||||
import ch.gtache.elderscrollslegends.service.Card;
|
||||
import ch.gtache.elderscrollslegends.service.Clazz;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import jakarta.inject.Inject;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.util.List;
|
||||
|
||||
@ApplicationScoped
|
||||
class ArenaService extends BaseService {
|
||||
|
||||
@Inject
|
||||
ArenaService(final DataSource dataSource) {
|
||||
super(dataSource);
|
||||
}
|
||||
|
||||
public void purchaseArena(final String steamID, final ArenaType arenaType,
|
||||
final ArenaPurchaseCurrencyType currencyType) {
|
||||
}
|
||||
|
||||
public void resignArena(final String steamID, final ArenaType arenaType) {
|
||||
}
|
||||
|
||||
public ArenaClientDataStruct getArenaClientData(final String steamID) {
|
||||
return new ArenaClientDataStruct(0, 0, List.of());
|
||||
}
|
||||
|
||||
void selectCard(final String steamID, final ArenaType arenaType, final Card card) {
|
||||
}
|
||||
|
||||
void selectClass(final String steamID, final ArenaType arenaType, final Clazz clazz) {
|
||||
}
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
package ch.gtache.elderscrollslegends.service.arena;
|
||||
|
||||
public record PurchaseArenaResult(ArenaClientDataStruct clientData) {
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
package ch.gtache.elderscrollslegends.service.campaign;
|
||||
|
||||
import ch.gtache.elderscrollslegends.service.BaseEndpoints;
|
||||
import ch.gtache.elderscrollslegends.service.account.AccountService;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.ws.rs.Consumes;
|
||||
import jakarta.ws.rs.GET;
|
||||
import jakarta.ws.rs.HeaderParam;
|
||||
@@ -8,18 +11,28 @@ import jakarta.ws.rs.Path;
|
||||
import jakarta.ws.rs.Produces;
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Path("/campaign")
|
||||
public class CampaignEndpoints {
|
||||
public class CampaignEndpoints extends BaseEndpoints {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(CampaignEndpoints.class);
|
||||
private final CampaignService campaignService;
|
||||
|
||||
@Inject
|
||||
CampaignEndpoints(final AccountService accountService, final CampaignService campaignService) {
|
||||
super(accountService);
|
||||
this.campaignService = Objects.requireNonNull(campaignService);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("checkCampaignProgress")
|
||||
@Consumes("application/json")
|
||||
public void checkCampaignProgress(@HeaderParam("Authorization") final String authentication,
|
||||
final CheckCampaignRequest request) {
|
||||
logger.info("CheckCampaignProgress called by " + authentication + " : " + request);
|
||||
//TODO
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("CheckCampaignProgress called by " + steamID + " : " + request);
|
||||
campaignService.getCampaign(steamID, request.campaignId(), request.isMastery());
|
||||
}
|
||||
|
||||
@POST
|
||||
@@ -28,8 +41,8 @@ public class CampaignEndpoints {
|
||||
@Produces("application/json")
|
||||
public void debugAddNextChapter(@HeaderParam("Authorization") final String authentication,
|
||||
final DebugAddNextChapterRequest request) {
|
||||
logger.info("DebugAddNextChapter called by " + authentication + " : " + request);
|
||||
//Do nothing
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("DebugAddNextChapter called by " + steamID + " : " + request);
|
||||
}
|
||||
|
||||
@POST
|
||||
@@ -38,9 +51,8 @@ public class CampaignEndpoints {
|
||||
@Produces("application/json")
|
||||
public void debugAddNextEvent(@HeaderParam("Authorization") final String authentication,
|
||||
final DebugAddNextEventRequest request) {
|
||||
|
||||
logger.info("DebugAddNextEvent called by " + authentication + " : " + request);
|
||||
//Do nothing
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("DebugAddNextEvent called by " + steamID + " : " + request);
|
||||
}
|
||||
|
||||
@POST
|
||||
@@ -49,9 +61,9 @@ public class CampaignEndpoints {
|
||||
@Produces("application/json")
|
||||
public SetChapterDialogResult setChapterDialogStatus(@HeaderParam("Authorization") final String authentication,
|
||||
final SetChapterDialogStatusRequest request) {
|
||||
logger.info("SetChapterDialogStatus called by " + authentication + " : " + request);
|
||||
//TODO
|
||||
return null;
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("SetChapterDialogStatus called by " + steamID + " : " + request);
|
||||
return new SetChapterDialogResult(campaignService.getRewards(steamID, request));
|
||||
}
|
||||
|
||||
@POST
|
||||
@@ -60,17 +72,17 @@ public class CampaignEndpoints {
|
||||
@Produces("application/json")
|
||||
public SetChapterEventResult setChapterEventChoice(@HeaderParam("Authorization") final String authentication,
|
||||
final SetChapterEventChoiceRequest request) {
|
||||
logger.info("SetChapterEventChoice called by " + authentication + " : " + request);
|
||||
//TODO
|
||||
return null;
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("SetChapterEventChoice called by " + steamID + " : " + request);
|
||||
return new SetChapterEventResult(campaignService.getRewards(steamID, request));
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("list")
|
||||
@Produces("application/json")
|
||||
public ListCampaignsResponse getList(@HeaderParam("Authorization") final String authentication) {
|
||||
logger.info("List called by " + authentication);
|
||||
//TODO
|
||||
return null;
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("List called by " + steamID);
|
||||
return new ListCampaignsResponse(campaignService.getCampaigns(steamID));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package ch.gtache.elderscrollslegends.service.campaign;
|
||||
|
||||
import ch.gtache.elderscrollslegends.service.BaseService;
|
||||
import ch.gtache.elderscrollslegends.service.reward.RewardDescription;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import jakarta.inject.Inject;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.util.List;
|
||||
|
||||
@ApplicationScoped
|
||||
class CampaignService extends BaseService {
|
||||
|
||||
@Inject
|
||||
CampaignService(final DataSource dataSource) {
|
||||
super(dataSource);
|
||||
}
|
||||
|
||||
UserCampaignData getCampaign(final String steamID, final int id, final boolean mastery) {
|
||||
return null;
|
||||
}
|
||||
|
||||
List<UserCampaignData> getCampaigns(final String steamID) {
|
||||
return List.of();
|
||||
}
|
||||
|
||||
List<RewardDescription> getRewards(final String steamID, final SetChapterEventChoiceRequest request) {
|
||||
return List.of();
|
||||
}
|
||||
|
||||
List<RewardDescription> getRewards(final String steamID, final SetChapterDialogStatusRequest request) {
|
||||
return List.of();
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,6 @@
|
||||
package ch.gtache.elderscrollslegends.service.campaign;
|
||||
|
||||
public record ListCampaignsResponse(UserCampaignData campaignDatas) {
|
||||
import java.util.List;
|
||||
|
||||
public record ListCampaignsResponse(List<UserCampaignData> campaignDatas) {
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package ch.gtache.elderscrollslegends.service.campaign;
|
||||
|
||||
public record SetChapterEventChoiceRequest(int campaignId, int actId, int chapterId, int cinematicId,
|
||||
boolean isMastery, DialogModalType modalType, UserCampaignChoice choiceType) {
|
||||
boolean isMastery, DialogModalType modalType,
|
||||
UserCampaignChoice choiceType) {
|
||||
}
|
||||
|
||||
@@ -3,5 +3,5 @@ package ch.gtache.elderscrollslegends.service.campaign;
|
||||
import java.util.List;
|
||||
|
||||
public record UserCampaignData(int campaignId, boolean isActive, int lastPlayedActIndex, int lastPlayedChapterIndex,
|
||||
int lastPlayedChapterEventINdex, List<UserActData> actData, List<Integer> ownedActs) {
|
||||
int lastPlayedChapterEventIndex, List<UserActData> actData, List<Integer> ownedActs) {
|
||||
}
|
||||
|
||||
@@ -1,18 +1,35 @@
|
||||
package ch.gtache.elderscrollslegends.service.chat;
|
||||
|
||||
import ch.gtache.elderscrollslegends.service.BaseEndpoints;
|
||||
import ch.gtache.elderscrollslegends.service.account.AccountService;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.ws.rs.Consumes;
|
||||
import jakarta.ws.rs.HeaderParam;
|
||||
import jakarta.ws.rs.POST;
|
||||
import jakarta.ws.rs.Path;
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Path("/chat")
|
||||
public class ChatEndpoints {
|
||||
public class ChatEndpoints extends BaseEndpoints {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(ChatEndpoints.class);
|
||||
private final ChatService chatService;
|
||||
|
||||
@Inject
|
||||
ChatEndpoints(final AccountService accountService, final ChatService chatService) {
|
||||
super(accountService);
|
||||
this.chatService = Objects.requireNonNull(chatService);
|
||||
}
|
||||
|
||||
@Path("sendChatMessage")
|
||||
@POST
|
||||
@Path("sendChatMessage")
|
||||
@Consumes("application/json")
|
||||
public void sendChatMessage(@HeaderParam("Authorization") final String authentication,
|
||||
final OutgoingMessage message) {
|
||||
//Do nothing
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("SendChatMessage called by " + steamID + " : " + message);
|
||||
chatService.sendMessage(steamID, message.toBuid(), message.message());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package ch.gtache.elderscrollslegends.service.chat;
|
||||
|
||||
import ch.gtache.elderscrollslegends.service.BaseService;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import jakarta.inject.Inject;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
@ApplicationScoped
|
||||
class ChatService extends BaseService {
|
||||
|
||||
@Inject
|
||||
ChatService(final DataSource dataSource) {
|
||||
super(dataSource);
|
||||
}
|
||||
|
||||
void sendMessage(final String senderID, final String receiverID, final String message) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package ch.gtache.elderscrollslegends.service.crafting;
|
||||
|
||||
import ch.gtache.elderscrollslegends.service.Card;
|
||||
|
||||
record CraftResult(Card card, int totalGems, int regularRemaining, int premiumRemaining) {
|
||||
|
||||
}
|
||||
@@ -1,38 +1,71 @@
|
||||
package ch.gtache.elderscrollslegends.service.crafting;
|
||||
|
||||
import ch.gtache.elderscrollslegends.service.BaseEndpoints;
|
||||
import ch.gtache.elderscrollslegends.service.CardService;
|
||||
import ch.gtache.elderscrollslegends.service.account.AccountService;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.ws.rs.Consumes;
|
||||
import jakarta.ws.rs.HeaderParam;
|
||||
import jakarta.ws.rs.POST;
|
||||
import jakarta.ws.rs.Path;
|
||||
import jakarta.ws.rs.Produces;
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Path("/crafting")
|
||||
public class CraftingEndpoints {
|
||||
public class CraftingEndpoints extends BaseEndpoints {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(CraftingEndpoints.class);
|
||||
|
||||
private final CraftingService craftingService;
|
||||
private final CardService cardService;
|
||||
|
||||
@Inject
|
||||
CraftingEndpoints(final AccountService accountService, final CraftingService craftingService,
|
||||
final CardService cardService) {
|
||||
super(accountService);
|
||||
this.craftingService = Objects.requireNonNull(craftingService);
|
||||
this.cardService = Objects.requireNonNull(cardService);
|
||||
}
|
||||
|
||||
@Path("soulTrapExtras")
|
||||
@POST
|
||||
@Path("soulTrapExtras")
|
||||
@Consumes("application/json")
|
||||
@Produces("application/json")
|
||||
public SoulTrapExtrasResponse soulTrapExtras(@HeaderParam("Authorization") final String authentication,
|
||||
final SoulTrapExtrasRequest request) {
|
||||
return null;
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("SoulTrapExtras called by " + steamID + " : " + request);
|
||||
final var soulTrapped = craftingService.soulTrap(steamID, request.priority());
|
||||
return new SoulTrapExtrasResponse(soulTrapped);
|
||||
}
|
||||
|
||||
@Path("sell")
|
||||
@POST
|
||||
@Path("sell")
|
||||
@Consumes("application/json")
|
||||
@Produces("application/json")
|
||||
public CraftingResponse sell(@HeaderParam("Authorization") final String authentication,
|
||||
final CraftingRequest request) {
|
||||
return null;
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("Sell called by " + steamID + " : " + request);
|
||||
final var card = cardService.getCard(request.typeHash());
|
||||
final var result = craftingService.sell(steamID, card, request.amount(), request.isPremium());
|
||||
return new CraftingResponse(card.hash(), result.totalGems(), result.regularRemaining(),
|
||||
result.premiumRemaining(), false);
|
||||
}
|
||||
|
||||
@Path("purchase")
|
||||
@POST
|
||||
@Path("purchase")
|
||||
@Consumes("application/json")
|
||||
@Produces("application/json")
|
||||
public CraftingResponse purchase(@HeaderParam("Authorization") final String authentication,
|
||||
final CraftingRequest request) {
|
||||
return null;
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("Purchase called by " + steamID + " : " + request);
|
||||
final var card = cardService.getCard(request.typeHash());
|
||||
final var result = craftingService.purchase(steamID, card, request.amount(), request.isPremium());
|
||||
return new CraftingResponse(card.hash(), result.totalGems(), result.regularRemaining(),
|
||||
result.premiumRemaining(), false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package ch.gtache.elderscrollslegends.service.crafting;
|
||||
|
||||
import ch.gtache.elderscrollslegends.service.BaseService;
|
||||
import ch.gtache.elderscrollslegends.service.Card;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import jakarta.inject.Inject;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
@ApplicationScoped
|
||||
class CraftingService extends BaseService {
|
||||
|
||||
@Inject
|
||||
CraftingService(final DataSource dataSource) {
|
||||
super(dataSource);
|
||||
}
|
||||
|
||||
int soulTrap(final String steamID, final String priority) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
CraftResult sell(final String steamID, final Card card, final int amount, final boolean premium) {
|
||||
return new CraftResult(card, 0, 0, 0);
|
||||
}
|
||||
|
||||
CraftResult purchase(final String steamID, final Card card, final int amount, final boolean premium) {
|
||||
return new CraftResult(card, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package ch.gtache.elderscrollslegends.service.dailyreward;
|
||||
|
||||
public record AcceptDailyRewardResponse(AcceptDailyRewardResult result) {
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package ch.gtache.elderscrollslegends.service.dailyreward;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public record AcceptDailyRewardResult(int xp, int gold, int gems, List<DailyItemType> items) {
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package ch.gtache.elderscrollslegends.service.dailyreward;
|
||||
|
||||
public record DailyItemType(String type, int typeId, int count, boolean isPremium) {
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package ch.gtache.elderscrollslegends.service.dailyreward;
|
||||
|
||||
public record DailyRewardDescription(String scheduleKey, PreRewardedVisibilityType preRewardedVisibility,
|
||||
String displayKey, int amount, boolean delivered, boolean deliveredToday) {
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package ch.gtache.elderscrollslegends.service.dailyreward;
|
||||
|
||||
import ch.gtache.elderscrollslegends.service.BaseEndpoints;
|
||||
import ch.gtache.elderscrollslegends.service.account.AccountService;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.ws.rs.GET;
|
||||
import jakarta.ws.rs.HeaderParam;
|
||||
import jakarta.ws.rs.POST;
|
||||
import jakarta.ws.rs.Path;
|
||||
import jakarta.ws.rs.Produces;
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Path("/dailyrewards")
|
||||
public class DailyRewardsEndpoints extends BaseEndpoints {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(DailyRewardsEndpoints.class);
|
||||
|
||||
private final DailyRewardsService dailyRewardsService;
|
||||
|
||||
@Inject
|
||||
DailyRewardsEndpoints(final AccountService accountService, final DailyRewardsService dailyRewardsService) {
|
||||
super(accountService);
|
||||
this.dailyRewardsService = Objects.requireNonNull(dailyRewardsService);
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("list")
|
||||
@Produces("application/json")
|
||||
public ListDailyRewardsResponse list(@HeaderParam("Authorization") final String authentication) {
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("List called by " + steamID);
|
||||
final var rewards = dailyRewardsService.listRewards(steamID);
|
||||
return new ListDailyRewardsResponse(rewards);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("acceptReward")
|
||||
@Produces("application/json")
|
||||
public AcceptDailyRewardResponse acceptReward(@HeaderParam("Authorization") final String authentication) {
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("AcceptReward called by " + steamID);
|
||||
final var result = dailyRewardsService.acceptReward(steamID);
|
||||
return new AcceptDailyRewardResponse(result);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package ch.gtache.elderscrollslegends.service.dailyreward;
|
||||
|
||||
import ch.gtache.elderscrollslegends.service.BaseService;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import jakarta.inject.Inject;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.util.List;
|
||||
|
||||
@ApplicationScoped
|
||||
class DailyRewardsService extends BaseService {
|
||||
|
||||
@Inject
|
||||
DailyRewardsService(final DataSource dataSource) {
|
||||
super(dataSource);
|
||||
}
|
||||
|
||||
List<DailyRewardDescription> listRewards(final String steamID) {
|
||||
return List.of();
|
||||
}
|
||||
|
||||
AcceptDailyRewardResult acceptReward(final String steamID) {
|
||||
return new AcceptDailyRewardResult(0, 0, 0, List.of());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package ch.gtache.elderscrollslegends.service.dailyreward;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public record ListDailyRewardsResponse(List<DailyRewardDescription> rewards) {
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package ch.gtache.elderscrollslegends.service.dailyrewards;
|
||||
package ch.gtache.elderscrollslegends.service.dailyreward;
|
||||
|
||||
public enum PreRewardedVisibilityType {
|
||||
Unknown,
|
||||
@@ -1,4 +0,0 @@
|
||||
package ch.gtache.elderscrollslegends.service.dailyrewards;
|
||||
|
||||
public record AcceptRewardResponse(AcceptRewardResult result) {
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
package ch.gtache.elderscrollslegends.service.dailyrewards;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public record AcceptRewardResult(int xp, int gold, int gems, List<ItemType> items) {
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package ch.gtache.elderscrollslegends.service.dailyrewards;
|
||||
|
||||
import jakarta.ws.rs.GET;
|
||||
import jakarta.ws.rs.HeaderParam;
|
||||
import jakarta.ws.rs.POST;
|
||||
import jakarta.ws.rs.Path;
|
||||
import jakarta.ws.rs.Produces;
|
||||
|
||||
@Path("/dailyrewards")
|
||||
public class DailyRewardsEndpoints {
|
||||
|
||||
@Path("list")
|
||||
@GET
|
||||
@Produces("application/json")
|
||||
public ListRewardsResponse list(@HeaderParam("Authorization") final String authentication) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Path("acceptReward")
|
||||
@POST
|
||||
@Produces("application/json")
|
||||
public AcceptRewardResponse acceptReward(@HeaderParam("Authorization") final String authentication) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
package ch.gtache.elderscrollslegends.service.dailyrewards;
|
||||
|
||||
public record ItemType(String type, int typeId, int count, boolean isPremium) {
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
package ch.gtache.elderscrollslegends.service.dailyrewards;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public record ListRewardsResponse(List<RewardDescription> rewards) {
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
package ch.gtache.elderscrollslegends.service.dailyrewards;
|
||||
|
||||
public record RewardDescription(String scheduleKey, PreRewardedVisibilityType preRewardedVisibility,
|
||||
String displayKey, int amount, boolean delivered, boolean deliveredToday) {
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
package ch.gtache.elderscrollslegends.service.error;
|
||||
|
||||
import ch.gtache.elderscrollslegends.service.BaseEndpoints;
|
||||
import ch.gtache.elderscrollslegends.service.account.AccountService;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.ws.rs.GET;
|
||||
import jakarta.ws.rs.HeaderParam;
|
||||
import jakarta.ws.rs.POST;
|
||||
@@ -8,21 +11,29 @@ import org.jboss.logging.Logger;
|
||||
|
||||
|
||||
@Path("/errorreporting")
|
||||
public class ErrorEndpoints {
|
||||
public class ErrorEndpoints extends BaseEndpoints {
|
||||
private static final Logger logger = Logger.getLogger(ErrorEndpoints.class);
|
||||
|
||||
private final ErrorService errorService;
|
||||
|
||||
@Inject
|
||||
ErrorEndpoints(final AccountService accountService, final ErrorService errorService) {
|
||||
super(accountService);
|
||||
this.errorService = errorService;
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("reportError")
|
||||
public void reportError(@HeaderParam("Authorization") final String authentication,
|
||||
final ErrorReport errorReport) {
|
||||
logger.info("Report error called by " + authentication + " : " + errorReport);
|
||||
//Do nothing
|
||||
errorService.reportError(errorReport.report());
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("reportingConfig")
|
||||
public FetchResponse getReportingConfig(@HeaderParam("Authorization") final String authentication) {
|
||||
logger.info("ReportingConfig called by " + authentication);
|
||||
return null;
|
||||
return new FetchResponse(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package ch.gtache.elderscrollslegends.service.error;
|
||||
|
||||
import ch.gtache.elderscrollslegends.service.BaseService;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import jakarta.inject.Inject;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
@ApplicationScoped
|
||||
class ErrorService extends BaseService {
|
||||
|
||||
@Inject
|
||||
ErrorService(final DataSource dataSource) {
|
||||
super(dataSource);
|
||||
}
|
||||
|
||||
void reportError(final String report) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package ch.gtache.elderscrollslegends.service.events;
|
||||
|
||||
public record Event(long id) {
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package ch.gtache.elderscrollslegends.service.events;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public record EventLeaderboard(Event event, long totalPages, long userPage, List<LeaderboardEntry> entries) {
|
||||
}
|
||||
@@ -1,20 +1,44 @@
|
||||
package ch.gtache.elderscrollslegends.service.events;
|
||||
|
||||
import ch.gtache.elderscrollslegends.service.BaseEndpoints;
|
||||
import ch.gtache.elderscrollslegends.service.DeckService;
|
||||
import ch.gtache.elderscrollslegends.service.account.AccountService;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.ws.rs.Consumes;
|
||||
import jakarta.ws.rs.GET;
|
||||
import jakarta.ws.rs.HeaderParam;
|
||||
import jakarta.ws.rs.POST;
|
||||
import jakarta.ws.rs.Path;
|
||||
import jakarta.ws.rs.Produces;
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
import static java.util.Objects.requireNonNull;
|
||||
|
||||
@Path("events")
|
||||
public class EventsEndpoints {
|
||||
public class EventsEndpoints extends BaseEndpoints {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(EventsEndpoints.class);
|
||||
|
||||
private final EventsService eventsService;
|
||||
private final DeckService deckService;
|
||||
|
||||
@Inject
|
||||
EventsEndpoints(final AccountService accountService, final EventsService eventsService,
|
||||
final DeckService deckService) {
|
||||
super(accountService);
|
||||
this.eventsService = requireNonNull(eventsService);
|
||||
this.deckService = requireNonNull(deckService);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("finalizeEvent")
|
||||
@Consumes("application/json")
|
||||
public void finalizeEvent(@HeaderParam("Authorization") final String authentication,
|
||||
final FinalizeEventRequest request) {
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("finalizeEvent called by " + steamID + " : " + request);
|
||||
final var event = eventsService.getEvent(request.eventId());
|
||||
eventsService.finalizeEvent(steamID, event);
|
||||
}
|
||||
|
||||
@POST
|
||||
@@ -22,6 +46,10 @@ public class EventsEndpoints {
|
||||
@Consumes("application/json")
|
||||
public void finalizeEventRun(@HeaderParam("Authorization") final String authentication,
|
||||
final FinalizeEventRunRequest request) {
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("finalizeEventRun called by " + steamID + " : " + request);
|
||||
final var event = eventsService.getEvent(request.eventId());
|
||||
eventsService.finalizeEventRun(steamID, event);
|
||||
}
|
||||
|
||||
@POST
|
||||
@@ -30,7 +58,12 @@ public class EventsEndpoints {
|
||||
@Produces("application/json")
|
||||
public GetEventLeaderboardResponse getEventLeaderboard(@HeaderParam("Authorization") final String authentication,
|
||||
final GetEventLeaderboardRequest request) {
|
||||
return null;
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("getEventLeaderboard called by " + steamID + " : " + request);
|
||||
final var event = eventsService.getEvent(request.eventId());
|
||||
final var leaderboard = eventsService.getEventLeaderboard(steamID, event);
|
||||
return new GetEventLeaderboardResponse(event.id(), leaderboard.totalPages(),
|
||||
leaderboard.userPage(), leaderboard.entries());
|
||||
}
|
||||
|
||||
@POST
|
||||
@@ -39,7 +72,11 @@ public class EventsEndpoints {
|
||||
@Produces("application/json")
|
||||
public PurchaseEventResult purchaseEvent(@HeaderParam("Authorization") final String authentication,
|
||||
final PurchaseEventRequest request) {
|
||||
return null;
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("purchaseEvent called by " + steamID + " : " + request);
|
||||
final var event = eventsService.getEvent(request.eventId());
|
||||
eventsService.purchaseEvent(steamID, event, request.purchaseType());
|
||||
return new PurchaseEventResult();
|
||||
}
|
||||
|
||||
@POST
|
||||
@@ -48,7 +85,11 @@ public class EventsEndpoints {
|
||||
@Produces("application/json")
|
||||
public PurchaseEventRunResult purchaseEventRun(@HeaderParam("Authorization") final String authentication,
|
||||
final PurchaseEventRunRequest request) {
|
||||
return null;
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("purchaseEvent called by " + steamID + " : " + request);
|
||||
final var event = eventsService.getEvent(request.eventId());
|
||||
eventsService.purchaseEventRun(steamID, event, request.purchaseType());
|
||||
return new PurchaseEventRunResult();
|
||||
}
|
||||
|
||||
@POST
|
||||
@@ -56,6 +97,11 @@ public class EventsEndpoints {
|
||||
@Consumes("application/json")
|
||||
public void selectExplicitDeck(@HeaderParam("Authorization") final String authentication,
|
||||
final SelectExplicitDeckRequest request) {
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("selectExplicitDeck called by " + steamID + " : " + request);
|
||||
final var event = eventsService.getEvent(request.eventId());
|
||||
final var deck = deckService.getDeck(steamID, request.deckTypeHash());
|
||||
eventsService.selectExplicitDeck(steamID, event, deck);
|
||||
}
|
||||
|
||||
@POST
|
||||
@@ -64,13 +110,20 @@ public class EventsEndpoints {
|
||||
@Produces("application/json")
|
||||
public UpdateEventLeaderboardRankResponse getEventLeaderboardRank(@HeaderParam("Authorization") final String authentication,
|
||||
final UpdateEventLeaderboardRankRequest request) {
|
||||
return null;
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("getEventLeaderboardRank called by " + steamID + " : " + request);
|
||||
final var event = eventsService.getEvent(request.eventId());
|
||||
final var ranking = eventsService.updateEventLeaderboardRank(steamID, event);
|
||||
return new UpdateEventLeaderboardRankResponse(event.id(), ranking);
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("fetch")
|
||||
@Produces("application/json")
|
||||
public ListEventsResponse fetchEvents(@HeaderParam("Authorization") final String authentication) {
|
||||
return null;
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("fetchEvents called by " + steamID);
|
||||
final var events = eventsService.getEvents(steamID);
|
||||
return new ListEventsResponse(events);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
package ch.gtache.elderscrollslegends.service.events;
|
||||
|
||||
import ch.gtache.elderscrollslegends.service.BaseService;
|
||||
import ch.gtache.elderscrollslegends.service.inventory.Deck;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import jakarta.inject.Inject;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.util.List;
|
||||
|
||||
@ApplicationScoped
|
||||
class EventsService extends BaseService {
|
||||
|
||||
@Inject
|
||||
EventsService(final DataSource dataSource) {
|
||||
super(dataSource);
|
||||
}
|
||||
|
||||
Event getEvent(final long id) {
|
||||
return new Event(id);
|
||||
}
|
||||
|
||||
void finalizeEvent(final String steamID, final Event event) {
|
||||
|
||||
}
|
||||
|
||||
void finalizeEventRun(final String steamID, final Event event) {
|
||||
|
||||
}
|
||||
|
||||
EventLeaderboard getEventLeaderboard(final String steamID, final Event event) {
|
||||
return new EventLeaderboard(event, 0, 0, List.of());
|
||||
}
|
||||
|
||||
void purchaseEvent(final String steamID, final Event event, final PurchaseType purchaseType) {
|
||||
|
||||
}
|
||||
|
||||
void purchaseEventRun(final String steamID, final Event event, final PurchaseType purchaseType) {
|
||||
|
||||
}
|
||||
|
||||
void selectExplicitDeck(final String steamID, final Event event, final Deck deck) {
|
||||
|
||||
}
|
||||
|
||||
long updateEventLeaderboardRank(final String steamID, final Event event) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
EventDescriptionStruct getEvents(final String steamID) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package ch.gtache.elderscrollslegends.service.friends;
|
||||
|
||||
public record BlockedItem(String buid, String username, String service_account_id, String platform) {
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package ch.gtache.elderscrollslegends.service.friends;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public record BlockedResponse(List<BlockedItem> blocked, int total_count, int start_keys) {
|
||||
}
|
||||
@@ -1,14 +1,45 @@
|
||||
package ch.gtache.elderscrollslegends.service.friends;
|
||||
|
||||
import ch.gtache.elderscrollslegends.service.BaseEndpoints;
|
||||
import ch.gtache.elderscrollslegends.service.account.AccountService;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.ws.rs.Consumes;
|
||||
import jakarta.ws.rs.GET;
|
||||
import jakarta.ws.rs.HeaderParam;
|
||||
import jakarta.ws.rs.POST;
|
||||
import jakarta.ws.rs.Path;
|
||||
import jakarta.ws.rs.Produces;
|
||||
import jakarta.ws.rs.QueryParam;
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Path("/beam/social/v3/friends")
|
||||
public class FriendsEndpoints {
|
||||
public class FriendsEndpoints extends BaseEndpoints {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(FriendsEndpoints.class);
|
||||
|
||||
private final FriendsService friendsService;
|
||||
|
||||
@Inject
|
||||
FriendsEndpoints(final AccountService accountService, final FriendsService friendsService) {
|
||||
super(accountService);
|
||||
this.friendsService = friendsService;
|
||||
}
|
||||
|
||||
@GET
|
||||
@Consumes("application/json")
|
||||
@Produces("application/json")
|
||||
public FriendsResponse get(@HeaderParam("Authorization") final String authentication,
|
||||
@QueryParam("product_id") final String productId,
|
||||
@QueryParam("start_keys") final int startKeys,
|
||||
@QueryParam("size") final int size,
|
||||
@QueryParam("language") final String language,
|
||||
@QueryParam("detail") final String detail) {
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("get called by " + steamID + " : " + productId + " ; " + startKeys + " ; " + size + " ; " + language + " ; " + detail);
|
||||
return new FriendsResponse(List.of(), 0, 0);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/unfriend")
|
||||
@@ -16,7 +47,27 @@ public class FriendsEndpoints {
|
||||
@Produces("application/json")
|
||||
public ActionResponse unfriend(@HeaderParam("Authorization") final String authentication,
|
||||
final ActionBody request) {
|
||||
return null;
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("unfriend called by " + steamID + " : " + request);
|
||||
for (final var buid : request.buids()) {
|
||||
friendsService.unfriend(steamID, buid);
|
||||
}
|
||||
return new ActionResponse(List.of());
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/block")
|
||||
@Consumes("application/json")
|
||||
@Produces("application/json")
|
||||
public BlockedResponse getBlocked(@HeaderParam("Authorization") final String authentication,
|
||||
@QueryParam("product_id") final String productId,
|
||||
@QueryParam("start_keys") final int startKeys,
|
||||
@QueryParam("size") final int size,
|
||||
@QueryParam("language") final String language,
|
||||
@QueryParam("detail") final String detail) {
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("getBlocked called by " + steamID + " : " + productId + " ; " + startKeys + " ; " + size + " ; " + language + " ; " + detail);
|
||||
return new BlockedResponse(List.of(), 0, 0);
|
||||
}
|
||||
|
||||
@POST
|
||||
@@ -25,7 +76,12 @@ public class FriendsEndpoints {
|
||||
@Produces("application/json")
|
||||
public ActionResponse block(@HeaderParam("Authorization") final String authentication,
|
||||
final ActionBody request) {
|
||||
return null;
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("block called by " + steamID + " : " + request);
|
||||
for (final var buid : request.buids()) {
|
||||
friendsService.block(steamID, buid);
|
||||
}
|
||||
return new ActionResponse(List.of());
|
||||
}
|
||||
|
||||
@POST
|
||||
@@ -34,17 +90,46 @@ public class FriendsEndpoints {
|
||||
@Produces("application/json")
|
||||
public ActionResponse unblock(@HeaderParam("Authorization") final String authentication,
|
||||
final ActionBody request) {
|
||||
return null;
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("unblock called by " + steamID + " : " + request);
|
||||
for (final var buid : request.buids()) {
|
||||
friendsService.unblock(steamID, buid);
|
||||
}
|
||||
return new ActionResponse(List.of());
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a friend request
|
||||
*
|
||||
* @param authentication
|
||||
* @param startKeys
|
||||
* @param size
|
||||
* @return
|
||||
*/
|
||||
@GET
|
||||
@Path("/requests")
|
||||
@Consumes("application/json")
|
||||
@Produces("application/json")
|
||||
public RequestsResponse getRequests(@HeaderParam("Authorization") final String authentication,
|
||||
@QueryParam("start_keys") final int startKeys,
|
||||
@QueryParam("size") final int size) {
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("getRequests called by " + steamID + " : " + startKeys + " ; " + size);
|
||||
return new RequestsResponse(List.of(), 0);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/requests")
|
||||
@Consumes("application/json")
|
||||
@Produces("application/json")
|
||||
public ActionResponse getRequests(@HeaderParam("Authorization") final String authentication,
|
||||
@QueryParam("size") final int size,
|
||||
final ActionBody request) {
|
||||
return null;
|
||||
public ActionResponse requests(@HeaderParam("Authorization") final String authentication,
|
||||
final ActionBody requests) {
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("requests called by " + steamID);
|
||||
for (final var buid : requests.buids()) {
|
||||
friendsService.sendRequest(steamID, buid);
|
||||
}
|
||||
return new ActionResponse(List.of());
|
||||
}
|
||||
|
||||
@POST
|
||||
@@ -53,7 +138,12 @@ public class FriendsEndpoints {
|
||||
@Produces("application/json")
|
||||
public ActionResponse cancelRequest(@HeaderParam("Authorization") final String authentication,
|
||||
final ActionBody request) {
|
||||
return null;
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("cancelRequest called by " + steamID + " : " + request);
|
||||
for (final var buid : request.buids()) {
|
||||
friendsService.cancelRequest(steamID, buid);
|
||||
}
|
||||
return new ActionResponse(List.of());
|
||||
}
|
||||
|
||||
@POST
|
||||
@@ -62,7 +152,12 @@ public class FriendsEndpoints {
|
||||
@Produces("application/json")
|
||||
public ActionResponse acceptRequest(@HeaderParam("Authorization") final String authentication,
|
||||
final ActionBody request) {
|
||||
return null;
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("acceptRequest called by " + steamID + " : " + request);
|
||||
for (final var buid : request.buids()) {
|
||||
friendsService.acceptRequest(steamID, buid);
|
||||
}
|
||||
return new ActionResponse(List.of());
|
||||
}
|
||||
|
||||
@POST
|
||||
@@ -71,28 +166,39 @@ public class FriendsEndpoints {
|
||||
@Produces("application/json")
|
||||
public ActionResponse rejectRequest(@HeaderParam("Authorization") final String authentication,
|
||||
final ActionBody request) {
|
||||
return null;
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("rejectRequest called by " + steamID + " : " + request);
|
||||
for (final var buid : request.buids()) {
|
||||
friendsService.rejectRequest(steamID, buid);
|
||||
}
|
||||
return new ActionResponse(List.of());
|
||||
}
|
||||
|
||||
@POST
|
||||
@GET
|
||||
@Path("/requests/sent")
|
||||
@Consumes("application/json")
|
||||
@Produces("application/json")
|
||||
public ActionResponse getSentRequests(@HeaderParam("Authorization") final String authentication,
|
||||
@QueryParam("size") final int size,
|
||||
final ActionBody request) {
|
||||
return null;
|
||||
public SentRequestsResponse getSentRequests(@HeaderParam("Authorization") final String authentication,
|
||||
@QueryParam("start_keys") final int startKeys,
|
||||
@QueryParam("size") final int size,
|
||||
final ActionBody request) {
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("getSentRequests called by " + steamID + " : " + startKeys + " ; " + size + " ; " + request);
|
||||
return new SentRequestsResponse(List.of(), 0);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/search")
|
||||
@Consumes("application/json")
|
||||
@Produces("application/json")
|
||||
public ActionResponse search(@HeaderParam("Authorization") final String authentication,
|
||||
public SearchResponse search(@HeaderParam("Authorization") final String authentication,
|
||||
@QueryParam("search_term") final String searchTerm,
|
||||
@QueryParam("start_keys") final int startKeys,
|
||||
@QueryParam("size") final int size,
|
||||
final ActionBody request) {
|
||||
return null;
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("search called by " + steamID + " : " + searchTerm + " ; " + startKeys + " ; " + size + " ; " + request);
|
||||
return new SearchResponse(List.of(), 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
package ch.gtache.elderscrollslegends.service.friends;
|
||||
|
||||
public record FriendsItem(String buid, String username, boolean blocked, String firends_since,
|
||||
String service_account_id, String friendship_type, Presence presence) {
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package ch.gtache.elderscrollslegends.service.friends;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public record FriendsResponse(List<FriendsItem> friend_list, int total_count, int start_keys) {
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package ch.gtache.elderscrollslegends.service.friends;
|
||||
|
||||
import ch.gtache.elderscrollslegends.service.BaseService;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import jakarta.inject.Inject;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
@ApplicationScoped
|
||||
class FriendsService extends BaseService {
|
||||
|
||||
@Inject
|
||||
FriendsService(final DataSource dataSource) {
|
||||
super(dataSource);
|
||||
}
|
||||
|
||||
void unfriend(final String steamID, final String buid) {
|
||||
|
||||
}
|
||||
|
||||
void block(final String steamID, final String buid) {
|
||||
|
||||
}
|
||||
|
||||
void unblock(final String steamID, final String buid) {
|
||||
|
||||
}
|
||||
|
||||
void cancelRequest(final String steamID, final String buid) {
|
||||
|
||||
}
|
||||
|
||||
void acceptRequest(final String steamID, final String buid) {
|
||||
|
||||
}
|
||||
|
||||
void rejectRequest(final String steamID, final String buid) {
|
||||
|
||||
}
|
||||
|
||||
Object getRequests(final String steamID, final int size) {
|
||||
return null;
|
||||
}
|
||||
|
||||
void sendRequest(final String steamID, final String buid) {
|
||||
|
||||
}
|
||||
|
||||
Object getSentRequests(final String steamID) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package ch.gtache.elderscrollslegends.service.friends;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public record Presence(String status, String first_party_status, List<PresenceStatusInfo> status_info) {
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package ch.gtache.elderscrollslegends.service.friends;
|
||||
|
||||
public record PresenceStatusInfo(String last_activity_timestamp, String product_id, String platform,
|
||||
String main_game_status, String player_status, String custom_data,
|
||||
Status idle_status, Status offline_status) {
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package ch.gtache.elderscrollslegends.service.friends;
|
||||
|
||||
public record Requester(String buid, String username, String avatar) {
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package ch.gtache.elderscrollslegends.service.friends;
|
||||
|
||||
public record RequestsItem(String request_date, Requester requester) {
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package ch.gtache.elderscrollslegends.service.friends;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public record RequestsResponse(List<RequestsItem> requests_list, int start_keys) {
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package ch.gtache.elderscrollslegends.service.friends;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public record SearchResponse(List<Requester> result, int start_keys) {
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package ch.gtache.elderscrollslegends.service.friends;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public record SentRequestsResponse(List<RequestsItem> requests_list, int start_keys) {
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package ch.gtache.elderscrollslegends.service.friends;
|
||||
|
||||
public record Status(int seconds, String timestamp, String text) {
|
||||
}
|
||||
@@ -1,23 +1,42 @@
|
||||
package ch.gtache.elderscrollslegends.service.inventory;
|
||||
|
||||
import ch.gtache.elderscrollslegends.service.BaseEndpoints;
|
||||
import ch.gtache.elderscrollslegends.service.account.AccountService;
|
||||
import jakarta.ws.rs.GET;
|
||||
import jakarta.ws.rs.HeaderParam;
|
||||
import jakarta.ws.rs.POST;
|
||||
import jakarta.ws.rs.Path;
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Path("/genericinventory")
|
||||
public class GenericInventoryEndpoints {
|
||||
public class GenericInventoryEndpoints extends BaseEndpoints {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(GenericInventoryEndpoints.class.getName());
|
||||
|
||||
private final GenericsInventoryService genericsInventoryService;
|
||||
|
||||
GenericInventoryEndpoints(final AccountService accountService,
|
||||
final GenericsInventoryService genericsInventoryService) {
|
||||
super(accountService);
|
||||
this.genericsInventoryService = Objects.requireNonNull(genericsInventoryService);
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("fetch")
|
||||
public FetchResponse fetch(@HeaderParam("Authorization") final String authentication) {
|
||||
return null;
|
||||
public InventoryFetchResponse fetch(@HeaderParam("Authorization") final String authentication) {
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("fetch called by " + steamID);
|
||||
return new InventoryFetchResponse(genericsInventoryService.getInventory(steamID));
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("setSelected")
|
||||
public void setSelected(@HeaderParam("Authorization") final String authentication,
|
||||
final SetSelectedRequest request) {
|
||||
|
||||
final InventorySetSelectedRequest request) {
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("setSelected called by " + steamID);
|
||||
genericsInventoryService.setSelected(steamID, request.category(), request.itemKey());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package ch.gtache.elderscrollslegends.service.inventory;
|
||||
|
||||
import ch.gtache.elderscrollslegends.service.BaseService;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import jakarta.inject.Inject;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.util.List;
|
||||
|
||||
@ApplicationScoped
|
||||
class GenericsInventoryService extends BaseService {
|
||||
|
||||
@Inject
|
||||
GenericsInventoryService(final DataSource dataSource) {
|
||||
super(dataSource);
|
||||
}
|
||||
|
||||
List<CategoryData> getInventory(final String steamID) {
|
||||
return List.of();
|
||||
}
|
||||
|
||||
void setSelected(final String steamID, final String category, final String itemKey) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -38,8 +38,8 @@ public class InventoryEndpoints {
|
||||
@Path("saveDeck_v2")
|
||||
@Consumes("application/json")
|
||||
@Produces("application/json")
|
||||
public SaveResult saveDeck(@HeaderParam("Authorization") final String authentication,
|
||||
final Deck request) {
|
||||
public InventorySaveResult saveDeck(@HeaderParam("Authorization") final String authentication,
|
||||
final Deck request) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -47,8 +47,8 @@ public class InventoryEndpoints {
|
||||
@Path("setSeens")
|
||||
@Consumes("application/json")
|
||||
@Produces("application/json")
|
||||
public SaveResult setSeens(@HeaderParam("Authorization") final String authentication,
|
||||
final SetSeens request) {
|
||||
public InventorySaveResult setSeens(@HeaderParam("Authorization") final String authentication,
|
||||
final InventorySetSeens request) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,5 +2,5 @@ package ch.gtache.elderscrollslegends.service.inventory;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public record FetchResponse(List<CategoryData> categories) {
|
||||
public record InventoryFetchResponse(List<CategoryData> categories) {
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package ch.gtache.elderscrollslegends.service.inventory;
|
||||
|
||||
public record SaveResult(boolean success) {
|
||||
public record InventorySaveResult(boolean success) {
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package ch.gtache.elderscrollslegends.service.inventory;
|
||||
|
||||
public record InventorySeenEntry(int cardTypeHash, boolean isPremium, boolean isRegular) {
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package ch.gtache.elderscrollslegends.service.inventory;
|
||||
|
||||
public record InventorySelectedItem(String category, String selected) {
|
||||
}
|
||||
@@ -2,5 +2,5 @@ package ch.gtache.elderscrollslegends.service.inventory;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public record SetSeens(List<SeenEntry> entries) {
|
||||
public record InventorySetSeens(List<InventorySeenEntry> entries) {
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package ch.gtache.elderscrollslegends.service.inventory;
|
||||
|
||||
public record InventorySetSelectedRequest(String category, String itemKey) {
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
package ch.gtache.elderscrollslegends.service.inventory;
|
||||
|
||||
public record SeenEntry(int cardTypeHash, boolean isPremium, boolean isRegular) {
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
package ch.gtache.elderscrollslegends.service.inventory;
|
||||
|
||||
public record SelectedItem(String category, String selected) {
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
package ch.gtache.elderscrollslegends.service.inventory;
|
||||
|
||||
public record SetSelectedRequest(String category, String itemKey) {
|
||||
}
|
||||
@@ -1,20 +1,38 @@
|
||||
package ch.gtache.elderscrollslegends.service.matching;
|
||||
|
||||
import ch.gtache.elderscrollslegends.service.BaseEndpoints;
|
||||
import ch.gtache.elderscrollslegends.service.account.AccountService;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.ws.rs.Consumes;
|
||||
import jakarta.ws.rs.GET;
|
||||
import jakarta.ws.rs.HeaderParam;
|
||||
import jakarta.ws.rs.POST;
|
||||
import jakarta.ws.rs.Path;
|
||||
import jakarta.ws.rs.Produces;
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Path("matching")
|
||||
public class MatchingEndpoints {
|
||||
public class MatchingEndpoints extends BaseEndpoints {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(MatchingEndpoints.class.getName());
|
||||
|
||||
private final MatchingService matchingService;
|
||||
|
||||
@Inject
|
||||
MatchingEndpoints(final AccountService accountService, final MatchingService matchingService) {
|
||||
super(accountService);
|
||||
this.matchingService = Objects.requireNonNull(matchingService);
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("reserve")
|
||||
@Produces("application/json")
|
||||
public ClientMatchReserveRequestResult reserve(@HeaderParam("Authorization") final String authentication) {
|
||||
return null;
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("reserve called by " + steamID);
|
||||
return new ClientMatchReserveRequestResult("", MatchErrorType.InternalError);
|
||||
}
|
||||
|
||||
@POST
|
||||
@@ -23,7 +41,9 @@ public class MatchingEndpoints {
|
||||
@Produces("application/json")
|
||||
public ClientMatchRequestResult add(@HeaderParam("Authorization") final String authentication,
|
||||
final ClientMatchRequest request) {
|
||||
return null;
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("add called by " + steamID + " : " + request);
|
||||
return new ClientMatchRequestResult("", "", Integer.MAX_VALUE, Integer.MAX_VALUE);
|
||||
}
|
||||
|
||||
@POST
|
||||
@@ -31,6 +51,9 @@ public class MatchingEndpoints {
|
||||
@Consumes("application/json")
|
||||
public void cancel(@HeaderParam("Authorization") final String authentication,
|
||||
final ClientMatchCancelRequest request) {
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("cancel called by " + steamID + " : " + request);
|
||||
matchingService.cancel(steamID, request.requestId(), request.friendBuid());
|
||||
}
|
||||
|
||||
@POST
|
||||
@@ -38,6 +61,9 @@ public class MatchingEndpoints {
|
||||
@Consumes("application/json")
|
||||
public void respondChallenge(@HeaderParam("Authorization") final String authentication,
|
||||
final ClientChallengeRequest request) {
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("respondChallenge called by " + steamID + " : " + request);
|
||||
matchingService.respondChallenge(steamID, request.friendBuid(), request.type());
|
||||
}
|
||||
|
||||
@POST
|
||||
@@ -46,20 +72,25 @@ public class MatchingEndpoints {
|
||||
@Produces("application/json")
|
||||
public RefreshResult refresh(@HeaderParam("Authorization") final String authentication,
|
||||
final RefreshRequest request) {
|
||||
return null;
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("refresh called by " + steamID + " : " + request);
|
||||
return new RefreshResult(Integer.MAX_VALUE, null);
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("rejoin")
|
||||
@Produces("application/json")
|
||||
public ClientMatchRejoinResult rejoin(@HeaderParam("Authorization") final String authentication) {
|
||||
return null;
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("rejoin called by " + steamID);
|
||||
return new ClientMatchRejoinResult(null);
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("rejoindeny")
|
||||
public void rejoinDeny(@HeaderParam("Authorization") final String authentication) {
|
||||
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("rejoinDeny called by " + steamID);
|
||||
}
|
||||
|
||||
@POST
|
||||
@@ -68,7 +99,10 @@ public class MatchingEndpoints {
|
||||
@Produces("application/json")
|
||||
public ClientOpponentBuidResult requestOpponent(@HeaderParam("Authorization") final String authentication,
|
||||
final ClientOpponentBuidRequest request) {
|
||||
return null;
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("requestOpponent called by " + steamID + " : " + request);
|
||||
final var opponentID = matchingService.requestOpponent(steamID, request.friendBuid());
|
||||
return new ClientOpponentBuidResult(opponentID);
|
||||
}
|
||||
|
||||
@POST
|
||||
@@ -77,7 +111,9 @@ public class MatchingEndpoints {
|
||||
@Produces("application/json")
|
||||
public ClientSpectateRequestResult spectate(@HeaderParam("Authorization") final String authentication,
|
||||
final ClientSpectateRequest request) {
|
||||
return null;
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("spectate called by " + steamID + " : " + request);
|
||||
return new ClientSpectateRequestResult("", null);
|
||||
}
|
||||
|
||||
@POST
|
||||
@@ -86,8 +122,8 @@ public class MatchingEndpoints {
|
||||
@Produces("application/json")
|
||||
public ClientSpectateRequestResult dualSpectate(@HeaderParam("Authorization") final String authentication,
|
||||
final ClientSpectateRequest request) {
|
||||
return null;
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("dualspectate called by " + steamID + " : " + request);
|
||||
return new ClientSpectateRequestResult("", null);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package ch.gtache.elderscrollslegends.service.matching;
|
||||
|
||||
import ch.gtache.elderscrollslegends.service.BaseService;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import jakarta.inject.Inject;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
@ApplicationScoped
|
||||
class MatchingService extends BaseService {
|
||||
|
||||
@Inject
|
||||
MatchingService(final DataSource dataSource) {
|
||||
super(dataSource);
|
||||
}
|
||||
|
||||
Object reserve(final String steamID) {
|
||||
return null;
|
||||
}
|
||||
|
||||
void cancel(final String steamID, final String requestID, final String friendID) {
|
||||
|
||||
}
|
||||
|
||||
void respondChallenge(final String steamID, final String friendID, final String type) {
|
||||
|
||||
}
|
||||
|
||||
String requestOpponent(final String steamID, final String friendID) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,20 +1,35 @@
|
||||
package ch.gtache.elderscrollslegends.service.packages;
|
||||
|
||||
import ch.gtache.elderscrollslegends.service.BaseEndpoints;
|
||||
import ch.gtache.elderscrollslegends.service.account.AccountService;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.ws.rs.Consumes;
|
||||
import jakarta.ws.rs.GET;
|
||||
import jakarta.ws.rs.HeaderParam;
|
||||
import jakarta.ws.rs.POST;
|
||||
import jakarta.ws.rs.Path;
|
||||
import jakarta.ws.rs.Produces;
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Path("packages")
|
||||
public class PackagesEndpoints {
|
||||
public class PackagesEndpoints extends BaseEndpoints {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(PackagesEndpoints.class);
|
||||
|
||||
@Inject
|
||||
PackagesEndpoints(final AccountService accountService, final PackagesService packagesService) {
|
||||
super(accountService);
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("list")
|
||||
@Produces("application/json")
|
||||
public ListPackagesResponse list(@HeaderParam("Authorization") final String authentication) {
|
||||
return null;
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("list called by " + steamID);
|
||||
return new ListPackagesResponse(0, List.of());
|
||||
}
|
||||
|
||||
@POST
|
||||
@@ -23,7 +38,9 @@ public class PackagesEndpoints {
|
||||
@Produces("application/json")
|
||||
public DeliverResponse deliver(@HeaderParam("Authorization") final String authentication,
|
||||
final DeliverRequest deliverRequest) {
|
||||
return null;
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("deliver called by " + steamID + " : " + deliverRequest);
|
||||
return new DeliverResponse(new Delivered(0, 0, List.of()));
|
||||
}
|
||||
|
||||
@POST
|
||||
@@ -32,6 +49,8 @@ public class PackagesEndpoints {
|
||||
@Produces("application/json")
|
||||
public MassPackOpeningResponse massPackOpening(@HeaderParam("Authorization") final String authentication,
|
||||
final MassPackOpeningRequest massPackOpeningRequest) {
|
||||
return null;
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("massPackOpening called by " + steamID + " : " + massPackOpeningRequest);
|
||||
return new MassPackOpeningResponse(0, List.of());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package ch.gtache.elderscrollslegends.service.packages;
|
||||
|
||||
import ch.gtache.elderscrollslegends.service.BaseService;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import jakarta.inject.Inject;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
@ApplicationScoped
|
||||
class PackagesService extends BaseService {
|
||||
|
||||
@Inject
|
||||
PackagesService(final DataSource dataSource) {
|
||||
super(dataSource);
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,24 @@
|
||||
package ch.gtache.elderscrollslegends.service.presence;
|
||||
|
||||
import ch.gtache.elderscrollslegends.service.BaseEndpoints;
|
||||
import ch.gtache.elderscrollslegends.service.account.AccountService;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.ws.rs.Consumes;
|
||||
import jakarta.ws.rs.HeaderParam;
|
||||
import jakarta.ws.rs.POST;
|
||||
import jakarta.ws.rs.Path;
|
||||
import jakarta.ws.rs.Produces;
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
@Path("/beam/presence/v1")
|
||||
public class PresenceEndpoints {
|
||||
public class PresenceEndpoints extends BaseEndpoints {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(PresenceEndpoints.class);
|
||||
|
||||
@Inject
|
||||
PresenceEndpoints(final AccountService accountService, final PresenceService presenceService) {
|
||||
super(accountService);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("presence")
|
||||
@@ -15,6 +26,8 @@ public class PresenceEndpoints {
|
||||
@Produces("application/json")
|
||||
public PostPresenceResponse presence(@HeaderParam("Authorization") final String authentication,
|
||||
final PostPresenceBody postPresenceBody) {
|
||||
return null;
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("presence called by " + steamID + " : " + postPresenceBody);
|
||||
return new PostPresenceResponse("", 0, new PresenceResponse(0));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package ch.gtache.elderscrollslegends.service.presence;
|
||||
|
||||
import ch.gtache.elderscrollslegends.service.BaseService;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import jakarta.inject.Inject;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
@ApplicationScoped
|
||||
class PresenceService extends BaseService {
|
||||
|
||||
@Inject
|
||||
PresenceService(final DataSource dataSource) {
|
||||
super(dataSource);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package ch.gtache.elderscrollslegends.service.profile;
|
||||
|
||||
import ch.gtache.elderscrollslegends.service.BaseEndpoints;
|
||||
import ch.gtache.elderscrollslegends.service.account.AccountService;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.ws.rs.GET;
|
||||
import jakarta.ws.rs.HeaderParam;
|
||||
@@ -11,59 +13,60 @@ import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Path("/profile")
|
||||
public class ProfileEndpoints {
|
||||
public class ProfileEndpoints extends BaseEndpoints {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(ProfileEndpoints.class);
|
||||
|
||||
private final ProfileService profileService;
|
||||
|
||||
@Inject
|
||||
ProfileEndpoints(final ProfileService profileService) {
|
||||
ProfileEndpoints(final AccountService accountService, final ProfileService profileService) {
|
||||
super(accountService);
|
||||
this.profileService = Objects.requireNonNull(profileService);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/doE3Reset")
|
||||
public void doE3Reset(@HeaderParam("Authorization") final String authentication) {
|
||||
logger.info("doE3Reset called by " + authentication);
|
||||
//Do nothing
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("doE3Reset called by " + steamID);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/requestOptOut")
|
||||
public void requestOptOut(@HeaderParam("Authorization") final String authentication) {
|
||||
logger.info("requestOptOut called by " + authentication);
|
||||
//Do nothing
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("requestOptOut called by " + steamID);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/requestOptIn")
|
||||
public void requestOptIn(@HeaderParam("Authorization") final String authentication) {
|
||||
logger.info("requestOptIn called by " + authentication);
|
||||
//Do nothing
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("requestOptIn called by " + steamID);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/setOnboardingProgress")
|
||||
public void setOnboardingProgress(@HeaderParam("Authorization") final String authentication,
|
||||
final SetOnboardingProgressRequest request) {
|
||||
logger.info("setOnboardingProgress called by " + authentication + " : " + request);
|
||||
//Do nothing
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("setOnboardingProgress called by " + steamID + " : " + request);
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/setSeen")
|
||||
public String setSeen(@HeaderParam("Authorization") final String authentication) {
|
||||
logger.info("setSeen called by " + authentication);
|
||||
//Do nothing
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("setSeen called by " + steamID);
|
||||
return null;
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/doSeasonRollover")
|
||||
public String doSeasonRollover(@HeaderParam("Authorization") final String authentication) {
|
||||
logger.info("doSeasonRollover called by " + authentication);
|
||||
//Do nothing
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("doSeasonRollover called by " + steamID);
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -71,8 +74,9 @@ public class ProfileEndpoints {
|
||||
@Path("getProfileForBuid")
|
||||
public ProfileForBuidResponse getProfileForBuid(@HeaderParam("Authorization") final String authentication,
|
||||
final GetProfileForBuidRequest request) {
|
||||
logger.info("getProfileForBuid called by " + authentication + " : " + request);
|
||||
final var profile = profileService.getProfile(request.buid());
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("getProfileForBuid called by " + steamID + " : " + request);
|
||||
final var profile = profileService.getProfile(steamID, request.buid());
|
||||
return new ProfileForBuidResponse(profile, List.of());
|
||||
}
|
||||
|
||||
@@ -80,14 +84,15 @@ public class ProfileEndpoints {
|
||||
@Path("logMatchStart")
|
||||
public void logMatchStart(@HeaderParam("Authorization") final String authentication,
|
||||
final MatchStartLogData request) {
|
||||
logger.info("logMatchStart called by " + authentication + " : " + request);
|
||||
//Do nothing
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("logMatchStart called by " + steamID + " : " + request);
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/fetch")
|
||||
public FetchProfileResponse getFetch(@HeaderParam("Authorization") final String authentication) {
|
||||
logger.info("fetch called by " + authentication);
|
||||
return null;
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("fetch called by " + steamID);
|
||||
return new FetchProfileResponse(profileService.getProfile(steamID, steamID));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package ch.gtache.elderscrollslegends.service.profile;
|
||||
|
||||
import ch.gtache.elderscrollslegends.service.inventory.SelectedItem;
|
||||
import ch.gtache.elderscrollslegends.service.inventory.InventorySelectedItem;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public record ProfileForBuidResponse(ProfileStruct profile, List<SelectedItem> categories) {
|
||||
public record ProfileForBuidResponse(ProfileStruct profile, List<InventorySelectedItem> categories) {
|
||||
}
|
||||
|
||||
@@ -1,22 +1,21 @@
|
||||
package ch.gtache.elderscrollslegends.service.profile;
|
||||
|
||||
import ch.gtache.elderscrollslegends.service.BaseService;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import jakarta.inject.Inject;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.util.Objects;
|
||||
|
||||
@ApplicationScoped
|
||||
public class ProfileService {
|
||||
public class ProfileService extends BaseService {
|
||||
|
||||
private final DataSource dataSource;
|
||||
|
||||
@Inject
|
||||
ProfileService(final DataSource dataSource) {
|
||||
this.dataSource = Objects.requireNonNull(dataSource);
|
||||
super(dataSource);
|
||||
}
|
||||
|
||||
ProfileStruct getProfile(final String steamID) {
|
||||
ProfileStruct getProfile(final String steamID, final String profileID) {
|
||||
return null;//new ProfileStruct(name, level, gold, gems, xp, tickets, onboardingProgressFlags, dailyGold, dailyGems, ratins, maxRatings, collectionStats, seasonRollovers);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,35 @@
|
||||
package ch.gtache.elderscrollslegends.service.pubsub;
|
||||
|
||||
import ch.gtache.elderscrollslegends.service.BaseEndpoints;
|
||||
import ch.gtache.elderscrollslegends.service.account.AccountService;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.ws.rs.GET;
|
||||
import jakarta.ws.rs.HeaderParam;
|
||||
import jakarta.ws.rs.Path;
|
||||
import jakarta.ws.rs.Produces;
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Path("pubsubauth")
|
||||
public class PubSubAuthEndpoints {
|
||||
public class PubSubAuthEndpoints extends BaseEndpoints {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(PubSubAuthEndpoints.class);
|
||||
|
||||
private final PubSubService pubSubService;
|
||||
|
||||
@Inject
|
||||
PubSubAuthEndpoints(final AccountService accountService, final PubSubService pubSubService) {
|
||||
super(accountService);
|
||||
this.pubSubService = Objects.requireNonNull(pubSubService);
|
||||
}
|
||||
|
||||
@GET
|
||||
@Produces("application/json")
|
||||
public PubSubResponse get(@HeaderParam("Authorization") final String authentication) {
|
||||
return null;
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("get called by " + steamID);
|
||||
final var chatRooms = pubSubService.getChatRooms(steamID);
|
||||
return new PubSubResponse(authentication.replace("Bearer ", ""), chatRooms);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package ch.gtache.elderscrollslegends.service.pubsub;
|
||||
|
||||
import ch.gtache.elderscrollslegends.service.BaseService;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import jakarta.inject.Inject;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.util.List;
|
||||
|
||||
@ApplicationScoped
|
||||
class PubSubService extends BaseService {
|
||||
|
||||
@Inject
|
||||
PubSubService(final DataSource dataSource) {
|
||||
super(dataSource);
|
||||
}
|
||||
|
||||
ChatRooms getChatRooms(final String steamID) {
|
||||
return new ChatRooms(List.of());
|
||||
}
|
||||
}
|
||||
@@ -1,43 +1,64 @@
|
||||
package ch.gtache.elderscrollslegends.service.quests;
|
||||
|
||||
import ch.gtache.elderscrollslegends.service.BaseEndpoints;
|
||||
import ch.gtache.elderscrollslegends.service.account.AccountService;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.ws.rs.Consumes;
|
||||
import jakarta.ws.rs.GET;
|
||||
import jakarta.ws.rs.HeaderParam;
|
||||
import jakarta.ws.rs.POST;
|
||||
import jakarta.ws.rs.Path;
|
||||
import jakarta.ws.rs.Produces;
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Path("quests")
|
||||
public class QuestsEndpoints {
|
||||
public class QuestsEndpoints extends BaseEndpoints {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(QuestsEndpoints.class);
|
||||
|
||||
private final QuestsService questsService;
|
||||
|
||||
@Inject
|
||||
QuestsEndpoints(final AccountService accountService, final QuestsService questsService) {
|
||||
super(accountService);
|
||||
this.questsService = Objects.requireNonNull(questsService);
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("fetch")
|
||||
@Produces("application/json")
|
||||
public QuestsFetchResponse fetch(@HeaderParam("Authorization") final String authentication) {
|
||||
return null;
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("fetch called by " + steamID);
|
||||
return new QuestsFetchResponse();
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("setSeen")
|
||||
@Consumes("application/json")
|
||||
public void setSeen(@HeaderParam("Authorization") final String authentication,
|
||||
final SetSeenRequest request) {
|
||||
|
||||
final QuestsSetSeenRequest request) {
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("setSeen called by " + steamID + " : " + request);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("skip")
|
||||
@Consumes("application/json")
|
||||
public void skip(@HeaderParam("Authorization") final String authentication,
|
||||
final SkipRequest request) {
|
||||
|
||||
final QuestsSkipRequest request) {
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("skip called by " + steamID + " : " + request);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("select")
|
||||
@Consumes("application/json")
|
||||
public void select(@HeaderParam("Authorization") final String authentication,
|
||||
final SelectRequest request) {
|
||||
|
||||
final QuestsSelectRequest request) {
|
||||
final var steamID = authenticateOrThrow(authentication);
|
||||
logger.info("select called by " + steamID + " : " + request);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package ch.gtache.elderscrollslegends.service.quests;
|
||||
|
||||
public record SelectRequest(int questTypeHash) {
|
||||
public record QuestsSelectRequest(int questTypeHash) {
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package ch.gtache.elderscrollslegends.service.quests;
|
||||
|
||||
import ch.gtache.elderscrollslegends.service.BaseService;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import jakarta.inject.Inject;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
@ApplicationScoped
|
||||
class QuestsService extends BaseService {
|
||||
|
||||
@Inject
|
||||
QuestsService(final DataSource dataSource) {
|
||||
super(dataSource);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package ch.gtache.elderscrollslegends.service.quests;
|
||||
|
||||
public record SetSeenRequest() {
|
||||
public record QuestsSetSeenRequest() {
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package ch.gtache.elderscrollslegends.service.quests;
|
||||
|
||||
public record SkipRequest() {
|
||||
public record QuestsSkipRequest() {
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user