@ughuuu/game_server 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +188 -0
- package/dist/ApiClient.js +703 -0
- package/dist/api/AuthenticationApi.js +340 -0
- package/dist/api/HealthApi.js +78 -0
- package/dist/api/UsersApi.js +127 -0
- package/dist/index.js +125 -0
- package/dist/model/GameServerWebApiV1MeControllerShow200Response.js +91 -0
- package/dist/model/GameServerWebApiV1MeControllerShow200ResponseData.js +125 -0
- package/dist/model/GameServerWebApiV1SessionControllerCreate200Response.js +91 -0
- package/dist/model/GameServerWebApiV1SessionControllerCreate200ResponseData.js +139 -0
- package/dist/model/GameServerWebApiV1SessionControllerCreate200ResponseDataUser.js +97 -0
- package/dist/model/GameServerWebApiV1SessionControllerCreateRequest.js +128 -0
- package/dist/model/GameServerWebApiV1SessionControllerDelete200Response.js +89 -0
- package/dist/model/GameServerWebApiV1SessionControllerRefresh200Response.js +91 -0
- package/dist/model/GameServerWebApiV1SessionControllerRefresh200ResponseData.js +126 -0
- package/dist/model/GameServerWebApiV1SessionControllerRefreshRequest.js +113 -0
- package/dist/model/GameServerWebAuthControllerApiCallback200Response.js +91 -0
- package/dist/model/GameServerWebAuthControllerApiCallback200ResponseData.js +139 -0
- package/dist/model/GameServerWebAuthControllerApiCallback200ResponseDataUser.js +109 -0
- package/dist/model/GameServerWebAuthControllerApiCallback409Response.js +97 -0
- package/dist/model/GameServerWebAuthControllerApiRequest200Response.js +103 -0
- package/dist/model/GameServerWebAuthControllerApiSessionStatus200Response.js +140 -0
- package/dist/model/GetCurrentUser200Response.js +91 -0
- package/dist/model/GetCurrentUser200ResponseData.js +125 -0
- package/dist/model/HealthResponse.js +129 -0
- package/dist/model/Login200Response.js +91 -0
- package/dist/model/Login200ResponseData.js +139 -0
- package/dist/model/Login200ResponseDataUser.js +97 -0
- package/dist/model/LoginRequest.js +128 -0
- package/dist/model/Logout200Response.js +89 -0
- package/dist/model/OauthRequest200Response.js +103 -0
- package/dist/model/OauthSessionStatus200Response.js +140 -0
- package/dist/model/RefreshToken200Response.js +91 -0
- package/dist/model/RefreshToken200ResponseData.js +126 -0
- package/dist/model/RefreshTokenRequest.js +113 -0
- package/package.json +46 -0
package/README.md
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
# game_server
|
|
2
|
+
|
|
3
|
+
GameServer - JavaScript client for game_server
|
|
4
|
+
API for Game Server application
|
|
5
|
+
|
|
6
|
+
## Authentication
|
|
7
|
+
|
|
8
|
+
This API uses JWT (JSON Web Tokens) with access and refresh tokens:
|
|
9
|
+
|
|
10
|
+
### Getting Tokens
|
|
11
|
+
- **Email/Password**: POST to `/api/v1/login` with email and password
|
|
12
|
+
- **Discord OAuth**: Use `/api/v1/auth/discord` flow
|
|
13
|
+
- **Google OAuth**: Use `/api/v1/auth/google` flow
|
|
14
|
+
- **Facebook OAuth**: Use `/api/v1/auth/facebook` flow
|
|
15
|
+
- **Apple Sign In**: Use `/auth/apple` browser flow (API flow not yet implemented)
|
|
16
|
+
|
|
17
|
+
Both methods return:
|
|
18
|
+
- `access_token` - Short-lived (15 min), use for API requests
|
|
19
|
+
- `refresh_token` - Long-lived (30 days), use to get new access tokens
|
|
20
|
+
|
|
21
|
+
### Using Tokens
|
|
22
|
+
Include the access token in the Authorization header:
|
|
23
|
+
```
|
|
24
|
+
Authorization: Bearer <access_token>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Refreshing Tokens
|
|
28
|
+
When your access token expires, use POST `/api/v1/refresh` with your refresh token to get a new access token.
|
|
29
|
+
|
|
30
|
+
## Endpoints
|
|
31
|
+
All API endpoints are under `/api/v1`
|
|
32
|
+
|
|
33
|
+
This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
|
|
34
|
+
|
|
35
|
+
- API version: 1.0.0
|
|
36
|
+
- Package version: 1.0.0
|
|
37
|
+
- Generator version: 7.17.0
|
|
38
|
+
- Build package: org.openapitools.codegen.languages.JavascriptClientCodegen
|
|
39
|
+
|
|
40
|
+
## Installation
|
|
41
|
+
|
|
42
|
+
### For [Node.js](https://nodejs.org/)
|
|
43
|
+
|
|
44
|
+
#### npm
|
|
45
|
+
|
|
46
|
+
To publish the library as a [npm](https://www.npmjs.com/), please follow the procedure in ["Publishing npm packages"](https://docs.npmjs.com/getting-started/publishing-npm-packages).
|
|
47
|
+
|
|
48
|
+
Then install it via:
|
|
49
|
+
|
|
50
|
+
```shell
|
|
51
|
+
npm install game_server --save
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Finally, you need to build the module:
|
|
55
|
+
|
|
56
|
+
```shell
|
|
57
|
+
npm run build
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
##### Local development
|
|
61
|
+
|
|
62
|
+
To use the library locally without publishing to a remote npm registry, first install the dependencies by changing into the directory containing `package.json` (and this README). Let's call this `JAVASCRIPT_CLIENT_DIR`. Then run:
|
|
63
|
+
|
|
64
|
+
```shell
|
|
65
|
+
npm install
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Next, [link](https://docs.npmjs.com/cli/link) it globally in npm with the following, also from `JAVASCRIPT_CLIENT_DIR`:
|
|
69
|
+
|
|
70
|
+
```shell
|
|
71
|
+
npm link
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
To use the link you just defined in your project, switch to the directory you want to use your game_server from, and run:
|
|
75
|
+
|
|
76
|
+
```shell
|
|
77
|
+
npm link /path/to/<JAVASCRIPT_CLIENT_DIR>
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Finally, you need to build the module:
|
|
81
|
+
|
|
82
|
+
```shell
|
|
83
|
+
npm run build
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
#### git
|
|
87
|
+
|
|
88
|
+
If the library is hosted at a git repository, e.g.https://github.com/GIT_USER_ID/GIT_REPO_ID
|
|
89
|
+
then install it via:
|
|
90
|
+
|
|
91
|
+
```shell
|
|
92
|
+
npm install GIT_USER_ID/GIT_REPO_ID --save
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### For browser
|
|
96
|
+
|
|
97
|
+
The library also works in the browser environment via npm and [browserify](http://browserify.org/). After following
|
|
98
|
+
the above steps with Node.js and installing browserify with `npm install -g browserify`,
|
|
99
|
+
perform the following (assuming *main.js* is your entry file):
|
|
100
|
+
|
|
101
|
+
```shell
|
|
102
|
+
browserify main.js > bundle.js
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Then include *bundle.js* in the HTML pages.
|
|
106
|
+
|
|
107
|
+
### Webpack Configuration
|
|
108
|
+
|
|
109
|
+
Using Webpack you may encounter the following error: "Module not found: Error:
|
|
110
|
+
Cannot resolve module", most certainly you should disable AMD loader. Add/merge
|
|
111
|
+
the following section to your webpack config:
|
|
112
|
+
|
|
113
|
+
```javascript
|
|
114
|
+
module: {
|
|
115
|
+
rules: [
|
|
116
|
+
{
|
|
117
|
+
parser: {
|
|
118
|
+
amd: false
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Getting Started
|
|
126
|
+
|
|
127
|
+
Please follow the [installation](#installation) instruction and execute the following JS code:
|
|
128
|
+
|
|
129
|
+
```javascript
|
|
130
|
+
var GameServer = require('game_server');
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
var api = new GameServer.AuthenticationApi()
|
|
134
|
+
var opts = {
|
|
135
|
+
'loginRequest': new GameServer.LoginRequest() // {LoginRequest} Login credentials
|
|
136
|
+
};
|
|
137
|
+
api.login(opts).then(function(data) {
|
|
138
|
+
console.log('API called successfully. Returned data: ' + data);
|
|
139
|
+
}, function(error) {
|
|
140
|
+
console.error(error);
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Documentation for API Endpoints
|
|
147
|
+
|
|
148
|
+
All URIs are relative to *http://localhost:4000*
|
|
149
|
+
|
|
150
|
+
Class | Method | HTTP request | Description
|
|
151
|
+
------------ | ------------- | ------------- | -------------
|
|
152
|
+
*GameServer.AuthenticationApi* | [**login**](docs/AuthenticationApi.md#login) | **POST** /api/v1/login | Login
|
|
153
|
+
*GameServer.AuthenticationApi* | [**logout**](docs/AuthenticationApi.md#logout) | **DELETE** /api/v1/logout | Logout
|
|
154
|
+
*GameServer.AuthenticationApi* | [**oauthConflictDelete**](docs/AuthenticationApi.md#oauthConflictDelete) | **POST** /api/v1/auth/{provider}/conflict-delete | Delete conflicting provider account
|
|
155
|
+
*GameServer.AuthenticationApi* | [**oauthRequest**](docs/AuthenticationApi.md#oauthRequest) | **GET** /api/v1/auth/{provider} | Initiate API OAuth
|
|
156
|
+
*GameServer.AuthenticationApi* | [**oauthSessionStatus**](docs/AuthenticationApi.md#oauthSessionStatus) | **GET** /api/v1/auth/session/{session_id} | Get OAuth session status
|
|
157
|
+
*GameServer.AuthenticationApi* | [**refreshToken**](docs/AuthenticationApi.md#refreshToken) | **POST** /api/v1/refresh | Refresh access token
|
|
158
|
+
*GameServer.AuthenticationApi* | [**unlinkProvider**](docs/AuthenticationApi.md#unlinkProvider) | **DELETE** /api/v1/me/providers/{provider} | Unlink OAuth provider
|
|
159
|
+
*GameServer.HealthApi* | [**index**](docs/HealthApi.md#index) | **GET** /api/v1/health | Health check
|
|
160
|
+
*GameServer.UsersApi* | [**getCurrentUser**](docs/UsersApi.md#getCurrentUser) | **GET** /api/v1/me | Return current user info
|
|
161
|
+
*GameServer.UsersApi* | [**getUserMetadata**](docs/UsersApi.md#getUserMetadata) | **GET** /api/v1/me/metadata | Return current user's metadata
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
## Documentation for Models
|
|
165
|
+
|
|
166
|
+
- [GameServer.GetCurrentUser200Response](docs/GetCurrentUser200Response.md)
|
|
167
|
+
- [GameServer.GetCurrentUser200ResponseData](docs/GetCurrentUser200ResponseData.md)
|
|
168
|
+
- [GameServer.HealthResponse](docs/HealthResponse.md)
|
|
169
|
+
- [GameServer.Login200Response](docs/Login200Response.md)
|
|
170
|
+
- [GameServer.Login200ResponseData](docs/Login200ResponseData.md)
|
|
171
|
+
- [GameServer.Login200ResponseDataUser](docs/Login200ResponseDataUser.md)
|
|
172
|
+
- [GameServer.LoginRequest](docs/LoginRequest.md)
|
|
173
|
+
- [GameServer.Logout200Response](docs/Logout200Response.md)
|
|
174
|
+
- [GameServer.OauthRequest200Response](docs/OauthRequest200Response.md)
|
|
175
|
+
- [GameServer.OauthSessionStatus200Response](docs/OauthSessionStatus200Response.md)
|
|
176
|
+
- [GameServer.RefreshToken200Response](docs/RefreshToken200Response.md)
|
|
177
|
+
- [GameServer.RefreshToken200ResponseData](docs/RefreshToken200ResponseData.md)
|
|
178
|
+
- [GameServer.RefreshTokenRequest](docs/RefreshTokenRequest.md)
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
## Documentation for Authorization
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
Authentication schemes defined for the API:
|
|
185
|
+
### authorization
|
|
186
|
+
|
|
187
|
+
- **Type**: Bearer authentication (JWT)
|
|
188
|
+
|