@kulkan/kulterra-api-client 1.2.1 → 1.2.2
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/CHANGELOG.md +1 -1
- package/README.md +14 -11
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -22,23 +22,26 @@ npm install @kulkan/kulterra-api-client @kulkan/kulterra-contracts
|
|
|
22
22
|
| `createApiClient(options)` | Factory returning `healthCheck` + **`auth`** namespace |
|
|
23
23
|
| `ApiClient` / `CreateApiClientOptions` | Typed client and `{ http: HttpClient }` options |
|
|
24
24
|
| `HttpClient` | **`get`** and **`post`** (minimal surface compatible with Axios) |
|
|
25
|
-
| `HttpGet` / `HttpPost`
|
|
25
|
+
| `HttpGet` / `HttpPost` / `HttpPatch` | Method signatures |
|
|
26
26
|
| Named auth helpers | `postRegister`, `postLogin`, `getGoogleOAuthStart`, `postGoogleOAuthCallback`, `postRefresh`, `postLogout`, `getMe` (see `src/endpoints/auth.ts`) |
|
|
27
|
+
| Named user helpers | `patchUpdateUserRoleByAdmin` (see `src/endpoints/user.ts`) |
|
|
27
28
|
|
|
28
29
|
### Endpoints implemented
|
|
29
30
|
|
|
30
|
-
| HTTP
|
|
31
|
-
|
|
|
32
|
-
| `GET`
|
|
33
|
-
| `POST`
|
|
34
|
-
| `POST`
|
|
35
|
-
| `GET`
|
|
36
|
-
| `POST`
|
|
37
|
-
| `POST`
|
|
38
|
-
| `POST`
|
|
39
|
-
| `GET`
|
|
31
|
+
| HTTP | Path | Client |
|
|
32
|
+
| ------- | ------------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
|
|
33
|
+
| `GET` | `/api/v1/health-check` | `client.healthCheck()` |
|
|
34
|
+
| `POST` | `/api/v1/auth/register` | `client.auth.register(body)` or `postRegister(http, body)` |
|
|
35
|
+
| `POST` | `/api/v1/auth/login` | `client.auth.login(body)` or `postLogin(http, body)` |
|
|
36
|
+
| `GET` | `/api/v1/auth/oauth/google/start?redirectUri=...` | `client.auth.getGoogleOAuthStart(redirectUri)` or `getGoogleOAuthStart(http, redirectUri)` |
|
|
37
|
+
| `POST` | `/api/v1/auth/oauth/google/callback` | `client.auth.postGoogleOAuthCallback(body)` or `postGoogleOAuthCallback(http, body)` |
|
|
38
|
+
| `POST` | `/api/v1/auth/refresh` | `client.auth.refresh(body)` or `postRefresh(http, body)` |
|
|
39
|
+
| `POST` | `/api/v1/auth/logout` | `client.auth.logout(body)` or `postLogout(http, body)` |
|
|
40
|
+
| `GET` | `/api/v1/auth/me` | `client.auth.me(accessToken)` or `getMe(http, accessToken)` |
|
|
41
|
+
| `PATCH` | `/api/v1/users/:id/role` | `client.user.updateRoleUserByAdmin(http, {id}, body)` or `patchUpdateRoleUserByAdmin(http, { id }, body)` |
|
|
40
42
|
|
|
41
43
|
Responses follow **`IApiResponse<T>`** from contracts (`success`, `data`, etc.). Auth session payloads are **`AuthSessionResponse`** (`TokenPair` + `user`). **`logout`** returns **204** with no JSON body.
|
|
44
|
+
User session payloads are **`UserSessionResponse`_(not implemented yet)_. **`updateRoleUserByAdmin`** returns **204\*\* with no JSON body.
|
|
42
45
|
|
|
43
46
|
### Usage example (Axios)
|
|
44
47
|
|