-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from maciejpedzich/gh5
Implement Client#getHosts method
- Loading branch information
Showing
16 changed files
with
292 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export class AuthRequiredError extends Error { | ||
constructor() { | ||
super('Authentication is required to proceed'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
src/interfaces/AuthSuccessBody.ts → src/interfaces/auth/Payload.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/** | ||
* Representation of the _personal_ authentication credentials/request body | ||
*/ | ||
export interface AuthPersonalCredentials { | ||
/** Parsec account's email address */ | ||
email: string; | ||
|
||
/** Parsec account's password */ | ||
password: string; | ||
|
||
/** Optional TFA code */ | ||
tfa?: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { Host } from './Host'; | ||
|
||
/** Payload of the `getHosts` call */ | ||
export interface GetHostsPayload { | ||
data: Host[]; | ||
has_more: boolean; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/** | ||
* Object representation of `getHosts` request query params | ||
*/ | ||
export interface GetHostsQueryParams { | ||
/** Host's mode */ | ||
mode: 'desktop' | 'game'; | ||
|
||
/** Host's visibility */ | ||
public?: boolean; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/** | ||
* Host object representation | ||
*/ | ||
export interface Host { | ||
/** Host computer's peer ID */ | ||
peer_id: string; | ||
|
||
/** User that created the host */ | ||
user: { | ||
id: number; | ||
name: string; | ||
warp: boolean; | ||
}; | ||
|
||
/** Internal Parsec game ID */ | ||
game_id: string; | ||
|
||
/** Parsec build number */ | ||
build: string; | ||
|
||
/** Host's description */ | ||
description: string; | ||
|
||
/** Maximal number of players allowed to be connected simultaneously */ | ||
max_players: number; | ||
|
||
/** Host's mode, can be either _desktop_ or _game_ */ | ||
mode: 'desktop' | 'game'; | ||
|
||
/** Host's name */ | ||
name: string; | ||
|
||
/** Number of players currently connected to the host */ | ||
players: number; | ||
|
||
/** Host's visibility */ | ||
public: boolean; | ||
|
||
/** Determines if the host that made the `GET /hosts` call | ||
* is attached to the same sessionID */ | ||
self: boolean; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import axios from 'axios'; | ||
|
||
/** @internal */ | ||
export const httpClient = axios.create({ | ||
export const http = axios.create({ | ||
baseURL: 'https://kessel-api.parsecgaming.com' | ||
}); |
Oops, something went wrong.