53 lines
1.4 KiB
TypeScript
53 lines
1.4 KiB
TypeScript
import { BaseService } from './base-service'
|
|
import { Game } from '../interfaces/game'
|
|
|
|
export class GameService extends BaseService {
|
|
|
|
public getGames(): Promise<Game[]> {
|
|
return this.get<Game[]>("games")
|
|
}
|
|
|
|
public getGame(gameId: string): Promise<Game> {
|
|
return this.get<Game>(`games/${gameId}`)
|
|
}
|
|
|
|
public async upload(game: Game) : Promise<void> {
|
|
return this.post<any>(`games`, null).then();
|
|
}
|
|
|
|
public async update(game: Game) : Promise<void> {
|
|
return this.put<any>(`games`, null).then();
|
|
}
|
|
|
|
public async activate(gameId: string): Promise<void> {
|
|
return this.post<any>(`games/${gameId}/activate`, null).then();
|
|
}
|
|
|
|
public async deactivate(gameId: string): Promise<void> {
|
|
return this.post<any>(`games/${gameId}/deactivate`, null).then();
|
|
}
|
|
|
|
public async download(gameId: string): Promise<void> {
|
|
return this.get<any>(`games/${gameId}/download`).then();
|
|
}
|
|
|
|
public async downloadAll(): Promise<void> {
|
|
return this.get<any>(`games/download`).then();
|
|
}
|
|
|
|
public async patch(): Promise<void> {
|
|
return this.put<any>(`games/patch`, null).then();
|
|
}
|
|
|
|
public async minor(): Promise<void> {
|
|
return this.put<any>(`games/minor`, null).then();
|
|
}
|
|
|
|
public async major(): Promise<void> {
|
|
return this.put<any>(`games/major`, null).then();
|
|
}
|
|
|
|
public async metadata(): Promise<void> {
|
|
return this.post<any>(`games/metadata`, null).then();
|
|
}
|
|
} |