Skip to content

Commit

Permalink
feat(server): adding player details for credit amount
Browse files Browse the repository at this point in the history
  • Loading branch information
rallieon committed Apr 18, 2023
1 parent 8a3316f commit c693a18
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"url": "https://github.com/playhaste/haste-sdk/issues"
},
"dependencies": {
"@hastearcade/models": "^2.1.0",
"@hastearcade/models": "^2.2.0",
"axios": "^0.21.1",
"jsonwebtoken": "^9.0.0",
"jwks-rsa": "^2.0.4"
Expand Down
3 changes: 3 additions & 0 deletions packages/server/src/api/haste.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,18 @@ import { buildUrl } from '../util/urlBuilder';
import { validateAuthenticationToken } from './auth/validate';
import { isBrowser } from '../util/environmentCheck';
import { PlayResource } from './resources/game/playResource';
import { PlayerResource } from './resources/game/playerResource';
export class Haste {
private configuration?: HasteConfiguration;
game: GameResource;
play: PlayResource;
player: PlayerResource;

private constructor(configuration: HasteConfiguration, gameDetails: Game) {
this.configuration = configuration;
this.game = new GameResource(this.configuration, gameDetails);
this.play = new PlayResource(this.configuration);
this.player = new PlayerResource(this.configuration);
}

static async getJwt(
Expand Down
9 changes: 9 additions & 0 deletions packages/server/src/api/resources/game/playerResource.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { PlayerDetails } from '@hastearcade/models';
import { BaseResource } from '../baseResource';

export class PlayerResource extends BaseResource {
async details(id: string) {
const path = `/players/${id}/details`;
return await this.get<PlayerDetails>(path);
}
}

0 comments on commit c693a18

Please sign in to comment.