@globalscoutme/api-client 1.0.2 → 1.0.3
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 +85 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# @globalscoutme/api-client
|
|
2
|
+
|
|
3
|
+
Auto-generated TypeScript HTTP client for the GlobalScoutMe API, built with [`@hey-api/openapi-ts`](https://heyapi.dev/) and axios.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @globalscoutme/api-client
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Setup
|
|
12
|
+
|
|
13
|
+
Configure the client once at app startup with your API base URL and auth token:
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { client } from '@globalscoutme/api-client';
|
|
17
|
+
|
|
18
|
+
client.setConfig({
|
|
19
|
+
baseURL: 'https://your-api-url.com',
|
|
20
|
+
headers: {
|
|
21
|
+
Authorization: `Bearer ${yourSupabaseAccessToken}`,
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
All endpoints are grouped by controller and fully typed:
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
import { Players, Profile, Documents, Videos, Achievements, Body, Index, Organizations } from '@globalscoutme/api-client';
|
|
32
|
+
|
|
33
|
+
// Players
|
|
34
|
+
const player = await Players.getPlayersMe();
|
|
35
|
+
await Players.patchPlayersMe({ body: { fullName: 'John Doe' } });
|
|
36
|
+
await Players.deletePlayersMe();
|
|
37
|
+
const dashboard = await Players.getPlayersMeDashboard();
|
|
38
|
+
|
|
39
|
+
// Profile
|
|
40
|
+
const profile = await Profile.getProfileMe();
|
|
41
|
+
await Profile.putProfileMe({ body: { dominantFoot: 'Right' } });
|
|
42
|
+
|
|
43
|
+
// Documents
|
|
44
|
+
const docs = await Documents.getDocumentsMe();
|
|
45
|
+
await Documents.postDocuments({ body: { type: 'license' } });
|
|
46
|
+
|
|
47
|
+
// Videos
|
|
48
|
+
const videos = await Videos.getVideosMe();
|
|
49
|
+
await Videos.postVideos({ body: { type: 'cmj', storagePath: 'path/to/video' } });
|
|
50
|
+
await Videos.deleteVideosById({ path: { id: 'video-id' } });
|
|
51
|
+
|
|
52
|
+
// Achievements
|
|
53
|
+
const achievements = await Achievements.getAchievementsMe();
|
|
54
|
+
await Achievements.postAchievements({ body: { title: 'Top scorer' } });
|
|
55
|
+
|
|
56
|
+
// Body measurements
|
|
57
|
+
const measurement = await Body.getBodyMeasurementsMe();
|
|
58
|
+
await Body.postBodyMeasurements({ body: { heightCm: 180 } });
|
|
59
|
+
|
|
60
|
+
// Index (lookup tables)
|
|
61
|
+
const positions = await Index.getIndexByTableName({ path: { tableName: 'positions' } });
|
|
62
|
+
|
|
63
|
+
// Organizations
|
|
64
|
+
const org = await Organizations.getOrganizationsMe();
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Updating auth token
|
|
68
|
+
|
|
69
|
+
Update the Bearer token after sign-in or token refresh:
|
|
70
|
+
|
|
71
|
+
```ts
|
|
72
|
+
client.setConfig({
|
|
73
|
+
headers: {
|
|
74
|
+
Authorization: `Bearer ${newAccessToken}`,
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Versioning
|
|
80
|
+
|
|
81
|
+
This package is auto-generated from the backend OpenAPI spec. Version increments follow semver:
|
|
82
|
+
|
|
83
|
+
- **patch** — no API shape changes
|
|
84
|
+
- **minor** — new endpoints added
|
|
85
|
+
- **major** — breaking changes (renamed/removed endpoints or fields)
|