npm package: @rivet-gg/game
Description: Rivet Game API
Author: Rivet Gaming, LLC
Latest version: 0.0.12
Deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

# Rivet Game API

## Installation
### Browser
```html
<script src="https://cdn.jsdelivr.net/npm/@rivet-gg/game@0.0.12/dist/lib.umd.js"></script>
```

### NodeJS
```sh
npm install @rivet-gg/game@0.0.12 --save
```

## Usage
### Browser
API is available under `window.rivet`.

### NodeJS
```
const rivet = require("@rivet-gg/game");
```

## API Endpoints

### `ClientApi`



Method | Return Type | Description
------ | ----------- | -----------
`findLobby(inlineObject1: InlineObject1, initOverrides?: RequestInit)` | `Promise<InlineResponse200>` | 
`joinLobby(inlineObject: InlineObject, initOverrides?: RequestInit)` | `Promise<InlineResponse200>` | 
`recommendRegions(initOverrides?: RequestInit)` | `Promise<InlineResponse2001>` | 
`setupUser(inlineObject5: InlineObject5, initOverrides?: RequestInit)` | `Promise<InlineResponse2002>` | 



### `ServerApi`



Method | Return Type | Description
------ | ----------- | -----------
`lobbyReady(body: object, initOverrides?: RequestInit)` | `Promise<object>` | 
`playerConnected(inlineObject3: InlineObject3, initOverrides?: RequestInit)` | `Promise<object>` | 
`playerDisconnected(inlineObject4: InlineObject4, initOverrides?: RequestInit)` | `Promise<object>` | 
`setLobbyClosed(inlineObject2: InlineObject2, initOverrides?: RequestInit)` | `Promise<object>` | 



### `UserApi`



Method | Return Type | Description
------ | ----------- | -----------
`addFriend(userId: string, body: object, initOverrides?: RequestInit)` | `Promise<`void`>` | 
`getUser(userId: string, initOverrides?: RequestInit)` | `Promise<InlineResponse2004>` | 
`getUserLinkStatus(linkId: string, initOverrides?: RequestInit)` | `Promise<InlineResponse2007>` | 
`getUserSelf(initOverrides?: RequestInit)` | `Promise<InlineResponse2003>` | 
`removeFriend(userId: string, initOverrides?: RequestInit)` | `Promise<`void`>` | 
`removeUserGameActivity(initOverrides?: RequestInit)` | `Promise<`void`>` | 
`requestUserLink(body: object, initOverrides?: RequestInit)` | `Promise<InlineResponse2006>` | 
`searchUsers(query: string, anchor?: string, limit?: number, initOverrides?: RequestInit)` | `Promise<InlineResponse2005>` | 
`setUserGameActivity(inlineObject6: InlineObject6, initOverrides?: RequestInit)` | `Promise<`void`>` | 
`updateUserStatus(inlineObject7: InlineObject7, initOverrides?: RequestInit)` | `Promise<`void`>` | 




## Models

### `CaptchaConfig`
Name | Type | Default Value | Description
---- | ---- | ------------- | -----------
`hcaptcha` | `CaptchaConfigHcaptcha | undefined` | `undefined` | 


### `CaptchaConfigHcaptcha`
Name | Type | Default Value | Description
---- | ---- | ------------- | -----------
`clientResponse` | `string` | `undefined` | 


### `GameActivity`
Name | Type | Default Value | Description
---- | ---- | ------------- | -----------
`game` | `GameHandle` | `undefined` | 
`message` | `string` | `undefined` | 
`publicMetadata` | `object` | `undefined` | 
`friendMetadata` | `object` | `undefined` | 


### `GameHandle`
Name | Type | Default Value | Description
---- | ---- | ------------- | -----------
`gameId` | `string` | `undefined` | 
`nameId` | `string` | `undefined` | 
`displayName` | `string` | `undefined` | 


### `InlineObject`
Name | Type | Default Value | Description
---- | ---- | ------------- | -----------
`lobbyId` | `string` | `undefined` | 
`captcha` | `CaptchaConfig | undefined` | `undefined` | 


### `InlineObject1`
Name | Type | Default Value | Description
---- | ---- | ------------- | -----------
`gameModes` | `Array<string>` | `undefined` | 
`regions` | `Array<string>` | `undefined` | 
`preventAutoCreateLobby` | `boolean` | `undefined` | 
`captcha` | `CaptchaConfig | undefined` | `undefined` | 


### `InlineObject2`
Name | Type | Default Value | Description
---- | ---- | ------------- | -----------
`isClosed` | `boolean` | `undefined` | 


### `InlineObject3`
Name | Type | Default Value | Description
---- | ---- | ------------- | -----------
`playerToken` | `string` | `undefined` | 


### `InlineObject4`
Name | Type | Default Value | Description
---- | ---- | ------------- | -----------
`playerToken` | `string` | `undefined` | 


### `InlineObject5`
Name | Type | Default Value | Description
---- | ---- | ------------- | -----------
`userToken` | `string` | `undefined` | 


### `InlineObject6`
Name | Type | Default Value | Description
---- | ---- | ------------- | -----------
`gameActivity` | `GameActivity` | `undefined` | 


### `InlineObject7`
Name | Type | Default Value | Description
---- | ---- | ------------- | -----------
`status` | `UserPresenceStatus` | `undefined` | 


### `InlineResponse200`
Name | Type | Default Value | Description
---- | ---- | ------------- | -----------
`lobby` | `MatchmakerLobby | undefined` | `undefined` | 


### `InlineResponse2001`
Name | Type | Default Value | Description
---- | ---- | ------------- | -----------
`regions` | `Array<InlineResponse2001Regions>` | `undefined` | 


### `InlineResponse2001Regions`
Name | Type | Default Value | Description
---- | ---- | ------------- | -----------
`regionId` | `string` | `undefined` | 


### `InlineResponse2002`
Name | Type | Default Value | Description
---- | ---- | ------------- | -----------
`userToken` | `string` | `undefined` | 
`userTokenExpireTs` | `number` | `undefined` | 
`user` | `UserSummary` | `undefined` | 


### `InlineResponse2003`
Name | Type | Default Value | Description
---- | ---- | ------------- | -----------
`user` | `UserSummary` | `undefined` | 


### `InlineResponse2004`
Name | Type | Default Value | Description
---- | ---- | ------------- | -----------
`user` | `UserSummary` | `undefined` | 
`presence` | `UserPresence` | `undefined` | 


### `InlineResponse2005`
Name | Type | Default Value | Description
---- | ---- | ------------- | -----------
`users` | `Array<UserSearchResult>` | `undefined` | 


### `InlineResponse2006`
Name | Type | Default Value | Description
---- | ---- | ------------- | -----------
`userId` | `string` | `undefined` | 
`linkUrl` | `string` | `undefined` | 
`expireTs` | `number` | `undefined` | 


### `InlineResponse2007`
Name | Type | Default Value | Description
---- | ---- | ------------- | -----------
`status` | `UserLinkStatus` | `undefined` | 


### `MatchmakerLobby`
Name | Type | Default Value | Description
---- | ---- | ------------- | -----------
`lobbyId` | `string` | `undefined` | 
`region` | `MatchmakerLobbyRegion` | `undefined` | 
`ports` | `{ [key: string]: MatchmakerLobbyPort; }` | `undefined` | 
`player` | `MatchmakerLobbyPlayer` | `undefined` | 


### `MatchmakerLobbyPlayer`
Name | Type | Default Value | Description
---- | ---- | ------------- | -----------
`token` | `string` | `undefined` | 


### `MatchmakerLobbyPort`
Name | Type | Default Value | Description
---- | ---- | ------------- | -----------
`hostname` | `string` | `undefined` | 
`port` | `number` | `undefined` | 
`origin` | `string` | `undefined` | 
`isTls` | `boolean` | `undefined` | 


### `MatchmakerLobbyRegion`
Name | Type | Default Value | Description
---- | ---- | ------------- | -----------
`regionId` | `string` | `undefined` | 
`displayName` | `string` | `undefined` | 


### `ResponseError`
Name | Type | Default Value | Description
---- | ---- | ------------- | -----------
`message` | `string` | `undefined` | 


### `UpdateGameActivity`
Name | Type | Default Value | Description
---- | ---- | ------------- | -----------
`message` | `string` | `undefined` | 
`publicMetadata` | `object` | `undefined` | 
`friendMetadata` | `object` | `undefined` | 


### `UserLinkStatus`
Name | Type | Default Value | Description
---- | ---- | ------------- | -----------


### `UserPresence`
Name | Type | Default Value | Description
---- | ---- | ------------- | -----------
`status` | `UserPresenceStatus` | `undefined` | 
`updateTs` | `number` | `undefined` | 
`gameActivity` | `GameActivity | undefined` | `undefined` | 


### `UserPresenceStatus`
Name | Type | Default Value | Description
---- | ---- | ------------- | -----------


### `UserSearchResult`
Name | Type | Default Value | Description
---- | ---- | ------------- | -----------
`user` | `UserSummary` | `undefined` | 
`presence` | `UserPresence` | `undefined` | 


### `UserSummary`
Name | Type | Default Value | Description
---- | ---- | ------------- | -----------
`userId` | `string` | `undefined` | 
`displayName` | `string` | `undefined` | 
`accountNumber` | `number` | `undefined` | 
`avatarUrl` | `string` | `undefined` | 
`isMyFriend` | `boolean` | `undefined` | 
`isTheirFriend` | `boolean` | `undefined` | 
`isMutualFriend` | `boolean` | `undefined` | 
`isRegistered` | `boolean` | `undefined` | 
`joinTs` | `number` | `undefined` | 
`bio` | `string` | `undefined` | 
`profileUrl` | `string` | `undefined` | 
`settingsUrl` | `string` | `undefined` |