@kulkan/kulterra-api-client 1.3.0 → 1.3.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 +13 -0
- package/README.md +171 -116
- package/dist/index.d.mts +26 -52
- package/dist/index.d.ts +26 -52
- package/dist/index.js +69 -153
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +63 -140
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -19,6 +19,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
19
19
|
|
|
20
20
|
### Security
|
|
21
21
|
|
|
22
|
+
## [1.3.1] - 2026-08-05
|
|
23
|
+
|
|
24
|
+
### Changed
|
|
25
|
+
|
|
26
|
+
- **User endpoints** (`src/endpoints/user.ts`): aligned endpoint names, routes, request contracts, and response types with the current API implementation: `getUsers`, `getUserById`, `patchUpdateMe`, `patchUpdateUserRoleByAdmin`, and `patchUpdateUserBySAdmin`.
|
|
27
|
+
- **Company endpoints** (`src/endpoints/company.ts`): updated company operations to use `getCompanies`, `getMyCompany`, `getCompanyBySlug`, `postCreateCompany`, `patchUpdateMyCompany`, and `patchUpdateCompanyBySAdmin`.
|
|
28
|
+
- **Project endpoints** (`src/endpoints/project.ts`): updated project operations to use `getProjects`, `getMyProjects`, `getMyProjectById`, `getProjectByCompanyAndSlug`, `getProjectsByCompany`, `postCreateProject`, and `patchUpdateProject`.
|
|
29
|
+
- **Property endpoints** (`src/endpoints/property.ts`): updated property operations to use `getProperties`, `getMyProperties`, `getMyPropertyById`, `getPropertiesByProject`, `getPropertyByProjectAndCode`, `postCreateProperty`, and `patchUpdateProperty`.
|
|
30
|
+
- **Typed API client** (`src/api-client.ts`): updated the `ApiClient` interface and `createApiClient` factory to expose the current user, company, project, and property endpoint functions.
|
|
31
|
+
- Corrected company routes to use `/api/v1/me/company`, `:companySlug`, and `:companyId` where applicable.
|
|
32
|
+
- Renamed `patchUpdateRoleUserByAdmin` to `patchUpdateUserRoleByAdmin`.
|
|
33
|
+
- Renamed `patchUpdatePropertyBySAdmin` to `patchUpdateProperty` to reflect that authorization is handled by the API service.
|
|
34
|
+
|
|
22
35
|
## [1.3.0] - 2026-04-04
|
|
23
36
|
|
|
24
37
|
### Added
|
package/README.md
CHANGED
|
@@ -1,181 +1,236 @@
|
|
|
1
1
|
# `@kulkan/kulterra-api-client`
|
|
2
2
|
|
|
3
|
-
Typed HTTP client for the
|
|
3
|
+
Typed HTTP client for the Kulterra API. It is intended for web, mobile, and other TypeScript consumers.
|
|
4
|
+
|
|
5
|
+
The package does not bake in a base URL. Pass a preconfigured HTTP layer through `createApiClient({ http })`. Request and response contracts come from `@kulkan/kulterra-contracts`.
|
|
4
6
|
|
|
5
7
|
## Requirements
|
|
6
8
|
|
|
7
9
|
- **Node.js** ≥ 18.18
|
|
8
|
-
- **Peer dependency:** `@kulkan/kulterra-contracts`
|
|
10
|
+
- **Peer dependency:** `@kulkan/kulterra-contracts` (see `package.json` for the exact supported version range)
|
|
9
11
|
|
|
10
12
|
## Installation
|
|
11
13
|
|
|
12
14
|
```bash
|
|
13
15
|
pnpm add @kulkan/kulterra-api-client @kulkan/kulterra-contracts
|
|
16
|
+
|
|
14
17
|
# or
|
|
15
18
|
npm install @kulkan/kulterra-api-client @kulkan/kulterra-contracts
|
|
16
19
|
```
|
|
17
20
|
|
|
18
21
|
## What ships today
|
|
19
22
|
|
|
20
|
-
| Export
|
|
21
|
-
|
|
|
22
|
-
| `createApiClient(options)`
|
|
23
|
-
| `ApiClient` / `CreateApiClientOptions`
|
|
24
|
-
| `HttpClient`
|
|
25
|
-
| `HttpGet` / `HttpPost` / `HttpPatch`
|
|
26
|
-
|
|
|
27
|
-
|
|
|
28
|
-
|
|
|
29
|
-
|
|
|
30
|
-
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
`
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
### Endpoints implemented
|
|
40
|
-
|
|
41
|
-
| HTTP | Path | Client |
|
|
23
|
+
| Export | Description |
|
|
24
|
+
| -------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
25
|
+
| `createApiClient(options)` | Factory that wires the provided `HttpClient` into the API namespaces and `healthCheck()` |
|
|
26
|
+
| `ApiClient` / `CreateApiClientOptions` | Typed client and `{ http: HttpClient }` options |
|
|
27
|
+
| `HttpClient` | HTTP abstraction used by the package |
|
|
28
|
+
| `HttpGet` / `HttpPost` / `HttpPatch` | Supported HTTP method signatures |
|
|
29
|
+
| Auth helpers | `postRegister`, `postLogin`, `getGoogleOAuthStart`, `postGoogleOAuthCallback`, `postRefresh`, `postLogout`, `getMe` |
|
|
30
|
+
| User helpers | `getUsers`, `getUserById`, `patchUpdateMe`, `patchUpdateUserRoleByAdmin`, `patchUpdateUserBySAdmin` |
|
|
31
|
+
| Company helpers | `getCompanies`, `getCompanyBySlug`, `getMyCompany`, `postCreateCompany`, `patchUpdateMyCompany`, `patchUpdateCompanyBySAdmin` |
|
|
32
|
+
| Project helpers | `getProjects`, `getMyProjects`, `getMyProjectById`, `getProjectByCompanyAndSlug`, `getProjectsByCompany`, `postCreateProject`, `patchUpdateProject` |
|
|
33
|
+
| Property helpers | `getProperties`, `getMyProperties`, `getMyPropertyById`, `getPropertiesByProject`, `getPropertyByProjectAndCode`, `postCreateProperty`, `patchUpdateProperty` |
|
|
34
|
+
|
|
35
|
+
## Endpoints implemented
|
|
36
|
+
|
|
37
|
+
All resource endpoints below require `Authorization: Bearer <accessToken>` unless noted otherwise.
|
|
38
|
+
|
|
39
|
+
### Health
|
|
40
|
+
|
|
41
|
+
| HTTP | Path | Helper |
|
|
42
42
|
| ----- | ---------------------- | ---------------------- |
|
|
43
43
|
| `GET` | `/api/v1/health-check` | `client.healthCheck()` |
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
|
48
|
-
|
|
|
49
|
-
| `
|
|
50
|
-
| `
|
|
51
|
-
|
|
52
|
-
`
|
|
53
|
-
| `
|
|
54
|
-
| `
|
|
55
|
-
| `GET`
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
|
62
|
-
|
|
|
63
|
-
| `GET`
|
|
64
|
-
| `GET`
|
|
65
|
-
| `
|
|
66
|
-
| `
|
|
67
|
-
| `
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
|
73
|
-
| `GET`
|
|
74
|
-
| `GET`
|
|
75
|
-
| `GET`
|
|
76
|
-
| `
|
|
77
|
-
| `
|
|
78
|
-
| `
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
|
83
|
-
|
|
|
84
|
-
|
|
85
|
-
`
|
|
86
|
-
| `GET`
|
|
87
|
-
| `GET`
|
|
88
|
-
| `
|
|
89
|
-
| `POST`
|
|
90
|
-
| `
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
45
|
+
### Auth routes
|
|
46
|
+
|
|
47
|
+
| HTTP | Path | Helper |
|
|
48
|
+
| ------ | ------------------------------------------------- | ---------------------------------------- |
|
|
49
|
+
| `POST` | `/api/v1/auth/register` | `postRegister(http, body)` |
|
|
50
|
+
| `POST` | `/api/v1/auth/login` | `postLogin(http, body)` |
|
|
51
|
+
| `GET` | `/api/v1/auth/oauth/google/start?redirectUri=...` | `getGoogleOAuthStart(http, redirectUri)` |
|
|
52
|
+
| `POST` | `/api/v1/auth/oauth/google/callback` | `postGoogleOAuthCallback(http, body)` |
|
|
53
|
+
| `POST` | `/api/v1/auth/refresh` | `postRefresh(http, body)` |
|
|
54
|
+
| `POST` | `/api/v1/auth/logout` | `postLogout(http, body)` |
|
|
55
|
+
| `GET` | `/api/v1/auth/me` | `getMe(http, accessToken)` |
|
|
56
|
+
|
|
57
|
+
`register`, `login`, Google OAuth start/callback, and `refresh` do not require an access token. `me` does.
|
|
58
|
+
|
|
59
|
+
### User routes
|
|
60
|
+
|
|
61
|
+
| HTTP | Path | Helper |
|
|
62
|
+
| ------- | ------------------------ | --------------------------------- |
|
|
63
|
+
| `GET` | `/api/v1/users` | `getUsers(...)` |
|
|
64
|
+
| `GET` | `/api/v1/users/:userId` | `getUserById(...)` |
|
|
65
|
+
| `PATCH` | `/api/v1/users/me` | `patchUpdateMe(...)` |
|
|
66
|
+
| `PATCH` | `/api/v1/users/:id/role` | `patchUpdateUserRoleByAdmin(...)` |
|
|
67
|
+
| `PATCH` | `/api/v1/users/:userId` | `patchUpdateUserBySAdmin(...)` |
|
|
68
|
+
|
|
69
|
+
### Company routes
|
|
70
|
+
|
|
71
|
+
| HTTP | Path | Helper |
|
|
72
|
+
| ------- | -------------------------------- | ------------------------------------------------------ |
|
|
73
|
+
| `GET` | `/api/v1/companies` | `getCompanies(http, accessToken, companyQuery)` |
|
|
74
|
+
| `GET` | `/api/v1/me/company` | `getMyCompany(http, accessToken)` |
|
|
75
|
+
| `GET` | `/api/v1/companies/:companySlug` | `getCompanyBySlug(http, accessToken, { companySlug })` |
|
|
76
|
+
| `POST` | `/api/v1/companies` | `postCreateCompany(...)` |
|
|
77
|
+
| `PATCH` | `/api/v1/me/company` | `patchUpdateMyCompany(...)` |
|
|
78
|
+
| `PATCH` | `/api/v1/companies/:companyId` | `patchUpdateCompanyBySAdmin(...)` |
|
|
79
|
+
|
|
80
|
+
### Project routes
|
|
81
|
+
|
|
82
|
+
| HTTP | Path | Helper |
|
|
83
|
+
| ------- | ------------------------------------------------------ | ----------------------------------------------------------------------------- |
|
|
84
|
+
| `GET` | `/api/v1/projects` | `getProjects(http, accessToken, projectQuery)` |
|
|
85
|
+
| `GET` | `/api/v1/me/projects` | `getMyProjects(http, accessToken, projectQuery)` |
|
|
86
|
+
| `GET` | `/api/v1/me/projects/:projectId` | `getMyProjectById(http, accessToken, { projectId })` |
|
|
87
|
+
| `GET` | `/api/v1/companies/:companySlug/projects` | `getProjectsByCompany(http, accessToken, { companySlug }, projectQuery)` |
|
|
88
|
+
| `GET` | `/api/v1/companies/:companySlug/projects/:projectSlug` | `getProjectByCompanyAndSlug(http, accessToken, { companySlug, projectSlug })` |
|
|
89
|
+
| `POST` | `/api/v1/companies/:companySlug/projects` | `postCreateProject(http, accessToken, { companySlug }, newProjectRequest)` |
|
|
90
|
+
| `PATCH` | `/api/v1/companies/:companySlug/projects/:projectSlug` | `patchUpdateProject(http, accessToken, { companySlug, projectSlug }, patch)` |
|
|
91
|
+
|
|
92
|
+
`getProjects()` targets **`GET /api/v1/projects`**.
|
|
93
|
+
`getProjectsByCompany()` targets **`GET /api/v1/companies/:companySlug/projects`**.
|
|
94
|
+
|
|
95
|
+
These are intentionally different endpoints.
|
|
96
|
+
|
|
97
|
+
### Property routes
|
|
98
|
+
|
|
99
|
+
| HTTP | Path | Helper |
|
|
100
|
+
| ------- | ------------------------------------------------------------------------------- | ------------------------------------------------------ |
|
|
101
|
+
| `GET` | `/api/v1/properties` | `getProperties(http, accessToken, propertyQuery)` |
|
|
102
|
+
| `GET` | `/api/v1/me/properties` | `getMyProperties(http, accessToken, propertyQuery)` |
|
|
103
|
+
| `GET` | `/api/v1/me/properties/:propertyId` | `getMyPropertyById(http, accessToken, { propertyId })` |
|
|
104
|
+
| `GET` | `/api/v1/companies/:companySlug/projects/:projectSlug/properties` | `getPropertiesByProject(...)` |
|
|
105
|
+
| `GET` | `/api/v1/companies/:companySlug/projects/:projectSlug/properties/:propertyCode` | `getPropertyByProjectAndCode(...)` |
|
|
106
|
+
| `POST` | `/api/v1/companies/:companySlug/projects/:projectSlug/properties` | `postCreateProperty(...)` |
|
|
107
|
+
| `PATCH` | `/api/v1/companies/:companySlug/projects/:projectSlug/properties/:propertyCode` | `patchUpdateProperty(...)` |
|
|
108
|
+
|
|
109
|
+
## Response shapes
|
|
110
|
+
|
|
111
|
+
Responses use `IApiResponse<T>` from `@kulkan/kulterra-contracts`.
|
|
112
|
+
|
|
113
|
+
Common payloads include:
|
|
114
|
+
|
|
115
|
+
- `AuthSessionResponse`
|
|
116
|
+
- `PublicCompanyResponse`
|
|
117
|
+
- `SAdminCompanyResponse`
|
|
118
|
+
- `ProjectResponse`
|
|
119
|
+
- `PublicProjectResponse`
|
|
120
|
+
- `OwnerProjectResponse`
|
|
121
|
+
- `PropertyResponse`
|
|
122
|
+
- `PublicPropertyResponse`
|
|
123
|
+
- `BuyerPropertyResponse`
|
|
124
|
+
- `IPaginatedResponse<T>`
|
|
125
|
+
- `IPaginatedByTokenResponse<T>`
|
|
126
|
+
|
|
127
|
+
Write endpoints that are defined as `204 No Content` return no JSON body.
|
|
128
|
+
|
|
129
|
+
## Usage example
|
|
130
|
+
|
|
131
|
+
Paths are relative to the base URL configured in the provided HTTP client.
|
|
132
|
+
|
|
133
|
+
```ts
|
|
105
134
|
import axios from 'axios';
|
|
106
135
|
import { createApiClient } from '@kulkan/kulterra-api-client';
|
|
107
136
|
|
|
108
137
|
const http = axios.create({
|
|
109
138
|
baseURL: process.env.API_BASE_URL,
|
|
110
139
|
timeout: 30_000,
|
|
111
|
-
headers: {
|
|
140
|
+
headers: {
|
|
141
|
+
'Content-Type': 'application/json',
|
|
142
|
+
},
|
|
112
143
|
});
|
|
113
144
|
|
|
114
145
|
const api = createApiClient({ http });
|
|
115
146
|
|
|
116
147
|
const health = await api.healthCheck();
|
|
117
|
-
const session = await api.auth.login({ email: 'user@example.com', password: '********' });
|
|
118
|
-
// session.data — IApiResponse<AuthSessionResponse>; use session.data?.data for the inner payload when using Axios default response shape
|
|
119
|
-
```
|
|
120
148
|
|
|
121
|
-
|
|
149
|
+
const session = await api.auth.login({
|
|
150
|
+
email: 'user@example.com',
|
|
151
|
+
password: '********',
|
|
152
|
+
});
|
|
153
|
+
```
|
|
122
154
|
|
|
123
|
-
|
|
155
|
+
When using Axios, the package expects an HTTP layer with the `{ data: T }` response shape.
|
|
124
156
|
|
|
125
|
-
|
|
126
|
-
2. Open **`authorizationUrl`** in a browser / `ASWebAuthenticationSession`.
|
|
127
|
-
3. After redirect, **`POST`** the **`code`**, **`state`**, and **`redirectUri`** to **`postGoogleOAuthCallback`**.
|
|
157
|
+
## OAuth (mobile / web)
|
|
128
158
|
|
|
129
|
-
|
|
159
|
+
1. Call `getGoogleOAuthStart` with the same `redirectUri` registered in Auth0 and allowed by the API.
|
|
160
|
+
2. Open the returned `authorizationUrl`.
|
|
161
|
+
3. After the redirect, send `code`, `state`, and `redirectUri` to `postGoogleOAuthCallback`.
|
|
130
162
|
|
|
131
|
-
|
|
163
|
+
## Why a factory?
|
|
132
164
|
|
|
133
|
-
|
|
165
|
+
`createApiClient({ http })` keeps transport and environment configuration outside the package, supports different consumers, and makes the client straightforward to test with a fake `HttpClient`.
|
|
134
166
|
|
|
135
167
|
## Architecture
|
|
136
168
|
|
|
137
|
-
1. **`HttpClient`** — abstraction over GET
|
|
138
|
-
2. **`src/endpoints/*.ts`** — thin functions
|
|
139
|
-
3. **`createApiClient`** — wires
|
|
140
|
-
4. **`@kulkan/kulterra-contracts`** — DTOs
|
|
169
|
+
1. **`HttpClient`** — abstraction over `GET`, `POST`, and `PATCH`.
|
|
170
|
+
2. **`src/endpoints/*.ts`** — thin endpoint functions.
|
|
171
|
+
3. **`createApiClient`** — wires the HTTP implementation into the endpoint namespaces.
|
|
172
|
+
4. **`@kulkan/kulterra-contracts`** — shared DTOs, request types, response types, enums, and envelopes.
|
|
141
173
|
|
|
142
174
|
### Extending further
|
|
143
175
|
|
|
144
|
-
If
|
|
176
|
+
If PUT or DELETE support is added later, extend `HttpClient` in `src/http-client.ts` and add the corresponding endpoint helpers.
|
|
145
177
|
|
|
146
|
-
|
|
178
|
+
For query params and headers, keep the adapter compatible with the request config expected by the package.
|
|
147
179
|
|
|
148
180
|
## Testing
|
|
149
181
|
|
|
150
|
-
Inject a fake
|
|
182
|
+
Inject a fake `HttpClient` and assert the generated URL, params, headers, and body.
|
|
151
183
|
|
|
152
|
-
```
|
|
184
|
+
```ts
|
|
153
185
|
import type { HttpClient } from '@kulkan/kulterra-api-client';
|
|
154
186
|
import { createApiClient } from '@kulkan/kulterra-api-client';
|
|
155
187
|
|
|
156
188
|
const http: HttpClient = {
|
|
157
|
-
get: jest.fn().mockResolvedValue({
|
|
158
|
-
|
|
189
|
+
get: jest.fn().mockResolvedValue({
|
|
190
|
+
data: { success: true, data: {} },
|
|
191
|
+
}),
|
|
192
|
+
post: jest.fn().mockResolvedValue({
|
|
193
|
+
data: { success: true, data: {} },
|
|
194
|
+
}),
|
|
195
|
+
patch: jest.fn().mockResolvedValue({
|
|
196
|
+
data: undefined,
|
|
197
|
+
}),
|
|
159
198
|
};
|
|
160
199
|
|
|
161
200
|
const api = createApiClient({ http });
|
|
201
|
+
|
|
162
202
|
await api.healthCheck();
|
|
203
|
+
|
|
163
204
|
expect(http.get).toHaveBeenCalledWith('/api/v1/health-check', undefined);
|
|
164
205
|
```
|
|
165
206
|
|
|
166
|
-
|
|
207
|
+
For project endpoint tests, explicitly assert that:
|
|
208
|
+
|
|
209
|
+
```ts
|
|
210
|
+
await api.project.projects(accessToken, projectQuery);
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
requests:
|
|
167
214
|
|
|
168
|
-
|
|
215
|
+
```text
|
|
216
|
+
/api/v1/projects
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
and not:
|
|
220
|
+
|
|
221
|
+
```text
|
|
222
|
+
/api/v1/companies/projects
|
|
223
|
+
```
|
|
169
224
|
|
|
170
|
-
|
|
171
|
-
| ------------------------- | ------------------------------------ |
|
|
172
|
-
| `pnpm run build` | `tsup` → `dist/` (CJS, ESM, `.d.ts`) |
|
|
173
|
-
| `pnpm run typecheck` | `tsc --noEmit` |
|
|
174
|
-
| `pnpm run lint` | ESLint |
|
|
175
|
-
| `pnpm run validate` | typecheck + lint + Prettier check |
|
|
176
|
-
| `pnpm run prepublishOnly` | validate + build before publish |
|
|
225
|
+
## Development
|
|
177
226
|
|
|
178
|
-
|
|
227
|
+
| Script | Purpose |
|
|
228
|
+
| ------------------------- | --------------------------------- |
|
|
229
|
+
| `pnpm run build` | `tsup` → `dist/` |
|
|
230
|
+
| `pnpm run typecheck` | `tsc --noEmit` |
|
|
231
|
+
| `pnpm run lint` | ESLint |
|
|
232
|
+
| `pnpm run validate` | Typecheck + lint + Prettier check |
|
|
233
|
+
| `pnpm run prepublishOnly` | Validate + build before publish |
|
|
179
234
|
|
|
180
235
|
## Changelog
|
|
181
236
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IApiResponse, HealthCheck, RegisterRequest, AuthSessionResponse, LoginRequest, OAuthGoogleStartResponse, OAuthGoogleCallbackRequest, RefreshRequest, LogoutRequest, AuthUserResponse, GetUsersQueryByTokenRequest, IPaginatedByTokenResponse, ToAdminUsersResponse, ToSAdminUsersResponse, UpdateUserByUserRequest, UpdateUserRoleByAdminRequest, UpdateUserBySAdminRequest, GetCompaniesQueryRequest, IPaginatedResponse, PublicCompanyResponse, SAdminCompanyResponse, AdminCompanyResponse, CreateCompanyRequest, UpdateCompanyByAdminRequest, UpdateCompanyBySAdminRequest, GetProjectsQueryByTokenRequest, ProjectResponse, PublicProjectResponse, OwnerProjectResponse, CreateProjectRequest, UpdateProjectRequest, GetPropertiesQueryByTokenRequest, PropertyResponse, PublicPropertyResponse, BuyerPropertyResponse, CreatePropertyRequest, UpdatePropertyRequest } from '@kulkan/kulterra-contracts';
|
|
2
2
|
|
|
3
3
|
type HttpGet = <TResponse>(url: string, config?: unknown) => Promise<{
|
|
4
4
|
data: TResponse;
|
|
@@ -15,6 +15,8 @@ interface HttpClient {
|
|
|
15
15
|
readonly patch: HttpPatch;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
declare function fetchHealthCheck(http: HttpClient): Promise<IApiResponse<HealthCheck>>;
|
|
19
|
+
|
|
18
20
|
declare function postRegister(http: HttpClient, body: RegisterRequest): Promise<IApiResponse<AuthSessionResponse>>;
|
|
19
21
|
declare function postLogin(http: HttpClient, body: LoginRequest): Promise<IApiResponse<AuthSessionResponse>>;
|
|
20
22
|
declare function getGoogleOAuthStart(http: HttpClient, redirectUri: string): Promise<IApiResponse<OAuthGoogleStartResponse>>;
|
|
@@ -28,20 +30,18 @@ declare function getUserById(http: HttpClient, accessToken: string, { userId }:
|
|
|
28
30
|
userId: string;
|
|
29
31
|
}): Promise<IApiResponse<ToSAdminUsersResponse>>;
|
|
30
32
|
declare function patchUpdateMe(http: HttpClient, accessToken: string, patch: UpdateUserByUserRequest): Promise<void>;
|
|
31
|
-
declare function
|
|
33
|
+
declare function patchUpdateUserRoleByAdmin(http: HttpClient, accessToken: string, { userId }: {
|
|
32
34
|
userId: string;
|
|
33
35
|
}, body: UpdateUserRoleByAdminRequest): Promise<void>;
|
|
34
36
|
declare function patchUpdateUserBySAdmin(http: HttpClient, accessToken: string, { userId }: {
|
|
35
37
|
userId: string;
|
|
36
38
|
}, patch: UpdateUserBySAdminRequest): Promise<void>;
|
|
37
39
|
|
|
38
|
-
declare function fetchHealthCheck(http: HttpClient): Promise<IApiResponse<HealthCheck>>;
|
|
39
|
-
|
|
40
40
|
declare function getCompanies(http: HttpClient, accessToken: string, companyQuery: GetCompaniesQueryRequest): Promise<IApiResponse<IPaginatedResponse<PublicCompanyResponse | SAdminCompanyResponse>>>;
|
|
41
41
|
declare function getMyCompany(http: HttpClient, accessToken: string): Promise<IApiResponse<AdminCompanyResponse>>;
|
|
42
|
-
declare function
|
|
43
|
-
|
|
44
|
-
}): Promise<IApiResponse<SAdminCompanyResponse>>;
|
|
42
|
+
declare function getCompanyBySlug(http: HttpClient, accessToken: string, { companySlug }: {
|
|
43
|
+
companySlug: string;
|
|
44
|
+
}): Promise<IApiResponse<PublicCompanyResponse | SAdminCompanyResponse>>;
|
|
45
45
|
declare function postCreateCompany(http: HttpClient, accessToken: string, newCompanyRequest: CreateCompanyRequest): Promise<IApiResponse<SAdminCompanyResponse>>;
|
|
46
46
|
declare function patchUpdateMyCompany(http: HttpClient, accessToken: string, patch: UpdateCompanyByAdminRequest): Promise<void>;
|
|
47
47
|
declare function patchUpdateCompanyBySAdmin(http: HttpClient, accessToken: string, { companyId }: {
|
|
@@ -49,10 +49,10 @@ declare function patchUpdateCompanyBySAdmin(http: HttpClient, accessToken: strin
|
|
|
49
49
|
}, patch: UpdateCompanyBySAdminRequest): Promise<void>;
|
|
50
50
|
|
|
51
51
|
declare function getProjects(http: HttpClient, accessToken: string, projectQuery: GetProjectsQueryByTokenRequest): Promise<IApiResponse<IPaginatedByTokenResponse<ProjectResponse | PublicProjectResponse>>>;
|
|
52
|
-
declare function getMyProjects(http: HttpClient, accessToken: string, projectQuery: GetProjectsQueryByTokenRequest): Promise<IApiResponse<IPaginatedByTokenResponse<
|
|
53
|
-
declare function
|
|
54
|
-
|
|
55
|
-
}): Promise<IApiResponse<
|
|
52
|
+
declare function getMyProjects(http: HttpClient, accessToken: string, projectQuery: GetProjectsQueryByTokenRequest): Promise<IApiResponse<IPaginatedByTokenResponse<OwnerProjectResponse>>>;
|
|
53
|
+
declare function getMyProjectById(http: HttpClient, accessToken: string, { projectId }: {
|
|
54
|
+
projectId: string;
|
|
55
|
+
}): Promise<IApiResponse<OwnerProjectResponse>>;
|
|
56
56
|
declare function getProjectByCompanyAndSlug(http: HttpClient, accessToken: string, { companySlug, projectSlug }: {
|
|
57
57
|
companySlug: string;
|
|
58
58
|
projectSlug: string;
|
|
@@ -60,52 +60,33 @@ declare function getProjectByCompanyAndSlug(http: HttpClient, accessToken: strin
|
|
|
60
60
|
declare function getProjectsByCompany(http: HttpClient, accessToken: string, { companySlug }: {
|
|
61
61
|
companySlug: string;
|
|
62
62
|
}, projectQuery: GetProjectsQueryByTokenRequest): Promise<IApiResponse<IPaginatedByTokenResponse<ProjectResponse | PublicProjectResponse>>>;
|
|
63
|
-
declare function
|
|
64
|
-
declare function postCreateProjectBySAdmin(http: HttpClient, accessToken: string, { companySlug }: {
|
|
63
|
+
declare function postCreateProject(http: HttpClient, accessToken: string, { companySlug }: {
|
|
65
64
|
companySlug: string;
|
|
66
65
|
}, newProjectRequest: CreateProjectRequest): Promise<IApiResponse<ProjectResponse>>;
|
|
67
|
-
declare function
|
|
68
|
-
projectSlug: string;
|
|
69
|
-
}, patch: UpdateProjectRequest): Promise<void>;
|
|
70
|
-
declare function patchUpdateProjectBySAdmin(http: HttpClient, accessToken: string, { companySlug, projectSlug }: {
|
|
66
|
+
declare function patchUpdateProject(http: HttpClient, accessToken: string, { companySlug, projectSlug }: {
|
|
71
67
|
companySlug: string;
|
|
72
68
|
projectSlug: string;
|
|
73
69
|
}, patch: UpdateProjectRequest): Promise<void>;
|
|
74
70
|
|
|
75
|
-
declare function getProperties(http: HttpClient, accessToken: string,
|
|
76
|
-
declare function getMyProperties(http: HttpClient, accessToken: string,
|
|
71
|
+
declare function getProperties(http: HttpClient, accessToken: string, query: GetPropertiesQueryByTokenRequest): Promise<IApiResponse<IPaginatedByTokenResponse<PropertyResponse | PublicPropertyResponse>>>;
|
|
72
|
+
declare function getMyProperties(http: HttpClient, accessToken: string, query: GetPropertiesQueryByTokenRequest): Promise<IApiResponse<IPaginatedByTokenResponse<BuyerPropertyResponse>>>;
|
|
77
73
|
declare function getMyPropertyById(http: HttpClient, accessToken: string, { propertyId }: {
|
|
78
74
|
propertyId: string;
|
|
79
75
|
}): Promise<IApiResponse<BuyerPropertyResponse>>;
|
|
80
|
-
declare function getPropertiesByAdmin(http: HttpClient, accessToken: string, propertyQuery: GetPropertiesQueryByTokenRequest): Promise<IApiResponse<IPaginatedByTokenResponse<PropertyResponse>>>;
|
|
81
|
-
declare function getPropertiesByProjectByAdmin(http: HttpClient, accessToken: string, { projectSlug }: {
|
|
82
|
-
projectSlug: string;
|
|
83
|
-
}, propertyQuery: GetPropertiesQueryByTokenRequest): Promise<IApiResponse<IPaginatedByTokenResponse<PropertyResponse>>>;
|
|
84
|
-
declare function getPropertyByProjectAndCodeByAdmin(http: HttpClient, accessToken: string, { projectSlug, propertyCode }: {
|
|
85
|
-
projectSlug: string;
|
|
86
|
-
propertyCode: string;
|
|
87
|
-
}): Promise<IApiResponse<PropertyResponse>>;
|
|
88
76
|
declare function getPropertiesByProject(http: HttpClient, accessToken: string, { companySlug, projectSlug }: {
|
|
89
77
|
companySlug: string;
|
|
90
78
|
projectSlug: string;
|
|
91
|
-
},
|
|
79
|
+
}, query: GetPropertiesQueryByTokenRequest): Promise<IApiResponse<IPaginatedByTokenResponse<PropertyResponse | PublicPropertyResponse>>>;
|
|
92
80
|
declare function getPropertyByProjectAndCode(http: HttpClient, accessToken: string, { companySlug, projectSlug, propertyCode, }: {
|
|
93
81
|
companySlug: string;
|
|
94
82
|
projectSlug: string;
|
|
95
83
|
propertyCode: string;
|
|
96
84
|
}): Promise<IApiResponse<PropertyResponse | PublicPropertyResponse>>;
|
|
97
|
-
declare function
|
|
98
|
-
projectSlug: string;
|
|
99
|
-
}, newPropertyRequest: CreatePropertyRequest): Promise<IApiResponse<PropertyResponse>>;
|
|
100
|
-
declare function postCreatePropertyBySAdmin(http: HttpClient, accessToken: string, { companySlug, projectSlug }: {
|
|
85
|
+
declare function postCreateProperty(http: HttpClient, accessToken: string, { companySlug, projectSlug }: {
|
|
101
86
|
companySlug: string;
|
|
102
87
|
projectSlug: string;
|
|
103
88
|
}, newPropertyRequest: CreatePropertyRequest): Promise<IApiResponse<PropertyResponse>>;
|
|
104
|
-
declare function
|
|
105
|
-
projectSlug: string;
|
|
106
|
-
propertyCode: string;
|
|
107
|
-
}, patch: UpdatePropertyRequest): Promise<void>;
|
|
108
|
-
declare function patchUpdatePropertyBySAdmin(http: HttpClient, accessToken: string, { companySlug, projectSlug, propertyCode, }: {
|
|
89
|
+
declare function patchUpdateProperty(http: HttpClient, accessToken: string, { companySlug, projectSlug, propertyCode, }: {
|
|
109
90
|
companySlug: string;
|
|
110
91
|
projectSlug: string;
|
|
111
92
|
propertyCode: string;
|
|
@@ -129,13 +110,13 @@ interface ApiClient {
|
|
|
129
110
|
readonly users: (accessToken: string, userQuery: Parameters<typeof getUsers>[2]) => ReturnType<typeof getUsers>;
|
|
130
111
|
readonly userById: (accessToken: Parameters<typeof getUserById>[1], { userId }: Parameters<typeof getUserById>[2]) => ReturnType<typeof getUserById>;
|
|
131
112
|
readonly updateMe: (accessToken: Parameters<typeof patchUpdateMe>[1], patch: Parameters<typeof patchUpdateMe>[2]) => ReturnType<typeof patchUpdateMe>;
|
|
132
|
-
readonly
|
|
113
|
+
readonly updateUserRoleByAdmin: (accessToken: Parameters<typeof patchUpdateUserRoleByAdmin>[1], { userId }: Parameters<typeof patchUpdateUserRoleByAdmin>[2], body: Parameters<typeof patchUpdateUserRoleByAdmin>[3]) => ReturnType<typeof patchUpdateUserRoleByAdmin>;
|
|
133
114
|
readonly updateUserBySAdmin: (accessToken: Parameters<typeof patchUpdateUserBySAdmin>[1], { userId }: Parameters<typeof patchUpdateUserBySAdmin>[2], patch: Parameters<typeof patchUpdateUserBySAdmin>[3]) => ReturnType<typeof patchUpdateUserBySAdmin>;
|
|
134
115
|
};
|
|
135
116
|
readonly company: {
|
|
136
117
|
readonly companies: (accessToken: Parameters<typeof getCompanies>[1], companyQuery: Parameters<typeof getCompanies>[2]) => ReturnType<typeof getCompanies>;
|
|
137
118
|
readonly myCompany: (accessToken: Parameters<typeof getMyCompany>[1]) => ReturnType<typeof getMyCompany>;
|
|
138
|
-
readonly
|
|
119
|
+
readonly companyBySlug: (accessToken: Parameters<typeof getCompanyBySlug>[1], { companySlug }: Parameters<typeof getCompanyBySlug>[2]) => ReturnType<typeof getCompanyBySlug>;
|
|
139
120
|
readonly createCompany: (accessToken: Parameters<typeof postCreateCompany>[1], newCompanyRequest: Parameters<typeof postCreateCompany>[2]) => ReturnType<typeof postCreateCompany>;
|
|
140
121
|
readonly updateMyCompany: (accessToken: Parameters<typeof patchUpdateMyCompany>[1], patch: Parameters<typeof patchUpdateMyCompany>[2]) => ReturnType<typeof patchUpdateMyCompany>;
|
|
141
122
|
readonly updateCompanyBySAdmin: (accessToken: Parameters<typeof patchUpdateCompanyBySAdmin>[1], { companyId }: Parameters<typeof patchUpdateCompanyBySAdmin>[2], patch: Parameters<typeof patchUpdateCompanyBySAdmin>[3]) => ReturnType<typeof patchUpdateCompanyBySAdmin>;
|
|
@@ -143,29 +124,22 @@ interface ApiClient {
|
|
|
143
124
|
readonly project: {
|
|
144
125
|
readonly projects: (accessToken: Parameters<typeof getProjects>[1], projectQuery: Parameters<typeof getProjects>[2]) => ReturnType<typeof getProjects>;
|
|
145
126
|
readonly myProjects: (accessToken: Parameters<typeof getMyProjects>[1], projectQuery: Parameters<typeof getMyProjects>[2]) => ReturnType<typeof getMyProjects>;
|
|
146
|
-
readonly
|
|
127
|
+
readonly myProjectById: (accessToken: Parameters<typeof getMyProjectById>[1], { projectId }: Parameters<typeof getMyProjectById>[2]) => ReturnType<typeof getMyProjectById>;
|
|
147
128
|
readonly projectByCompanyAndSlug: (accessToken: Parameters<typeof getProjectByCompanyAndSlug>[1], { companySlug, projectSlug }: Parameters<typeof getProjectByCompanyAndSlug>[2]) => ReturnType<typeof getProjectByCompanyAndSlug>;
|
|
148
129
|
readonly projectsByCompany: (accessToken: Parameters<typeof getProjectsByCompany>[1], { companySlug }: Parameters<typeof getProjectsByCompany>[2], projectQuery: Parameters<typeof getProjectsByCompany>[3]) => ReturnType<typeof getProjectsByCompany>;
|
|
149
|
-
readonly
|
|
150
|
-
readonly
|
|
151
|
-
readonly updateProjectByAdmin: (accessToken: Parameters<typeof patchUpdateProjectByAdmin>[1], { projectSlug }: Parameters<typeof patchUpdateProjectByAdmin>[2], patch: Parameters<typeof patchUpdateProjectByAdmin>[3]) => ReturnType<typeof patchUpdateProjectByAdmin>;
|
|
152
|
-
readonly updateProjectBySAdmin: (accessToken: Parameters<typeof patchUpdateProjectBySAdmin>[1], { companySlug, projectSlug }: Parameters<typeof patchUpdateProjectBySAdmin>[2], patch: Parameters<typeof patchUpdateProjectBySAdmin>[3]) => ReturnType<typeof patchUpdateProjectBySAdmin>;
|
|
130
|
+
readonly createProject: (accessToken: Parameters<typeof postCreateProject>[1], { companySlug }: Parameters<typeof postCreateProject>[2], newProjectRequest: Parameters<typeof postCreateProject>[3]) => ReturnType<typeof postCreateProject>;
|
|
131
|
+
readonly updateProject: (accessToken: Parameters<typeof patchUpdateProject>[1], { companySlug, projectSlug }: Parameters<typeof patchUpdateProject>[2], patch: Parameters<typeof patchUpdateProject>[3]) => ReturnType<typeof patchUpdateProject>;
|
|
153
132
|
};
|
|
154
133
|
readonly property: {
|
|
155
134
|
readonly properties: (accessToken: Parameters<typeof getProperties>[1], propertyQuery: Parameters<typeof getProperties>[2]) => ReturnType<typeof getProperties>;
|
|
156
135
|
readonly myProperties: (accessToken: Parameters<typeof getMyProperties>[1], propertyQuery: Parameters<typeof getMyProperties>[2]) => ReturnType<typeof getMyProperties>;
|
|
157
136
|
readonly myPropertyById: (accessToken: Parameters<typeof getMyPropertyById>[1], { propertyId }: Parameters<typeof getMyPropertyById>[2]) => ReturnType<typeof getMyPropertyById>;
|
|
158
|
-
readonly propertiesByAdmin: (accessToken: Parameters<typeof getPropertiesByAdmin>[1], propertyQuery: Parameters<typeof getPropertiesByAdmin>[2]) => ReturnType<typeof getPropertiesByAdmin>;
|
|
159
|
-
readonly propertiesByProjectByAdmin: (accessToken: Parameters<typeof getPropertiesByProjectByAdmin>[1], { projectSlug }: Parameters<typeof getPropertiesByProjectByAdmin>[2], propertyQuery: Parameters<typeof getPropertiesByProjectByAdmin>[3]) => ReturnType<typeof getPropertiesByProjectByAdmin>;
|
|
160
|
-
readonly propertyByProjectAndCodeByAdmin: (accessToken: Parameters<typeof getPropertyByProjectAndCodeByAdmin>[1], { projectSlug, propertyCode }: Parameters<typeof getPropertyByProjectAndCodeByAdmin>[2]) => ReturnType<typeof getPropertyByProjectAndCodeByAdmin>;
|
|
161
137
|
readonly propertiesByProject: (accessToken: Parameters<typeof getPropertiesByProject>[1], { companySlug, projectSlug }: Parameters<typeof getPropertiesByProject>[2], propertyQuery: Parameters<typeof getPropertiesByProject>[3]) => ReturnType<typeof getPropertiesByProject>;
|
|
162
138
|
readonly propertyByProjectAndCode: (accessToken: Parameters<typeof getPropertyByProjectAndCode>[1], { companySlug, projectSlug, propertyCode }: Parameters<typeof getPropertyByProjectAndCode>[2]) => ReturnType<typeof getPropertyByProjectAndCode>;
|
|
163
|
-
readonly
|
|
164
|
-
readonly
|
|
165
|
-
readonly updatePropertyByAdmin: (accessToken: Parameters<typeof patchUpdatePropertyByAdmin>[1], { projectSlug, propertyCode }: Parameters<typeof patchUpdatePropertyByAdmin>[2], patch: Parameters<typeof patchUpdatePropertyByAdmin>[3]) => ReturnType<typeof patchUpdatePropertyByAdmin>;
|
|
166
|
-
readonly updatePropertyBySAdmin: (accessToken: Parameters<typeof patchUpdatePropertyBySAdmin>[1], { companySlug, projectSlug, propertyCode }: Parameters<typeof patchUpdatePropertyBySAdmin>[2], patch: Parameters<typeof patchUpdatePropertyBySAdmin>[3]) => ReturnType<typeof patchUpdatePropertyBySAdmin>;
|
|
139
|
+
readonly createProperty: (accessToken: Parameters<typeof postCreateProperty>[1], { companySlug, projectSlug }: Parameters<typeof postCreateProperty>[2], newPropertyRequest: Parameters<typeof postCreateProperty>[3]) => ReturnType<typeof postCreateProperty>;
|
|
140
|
+
readonly updateProperty: (accessToken: Parameters<typeof patchUpdateProperty>[1], { companySlug, projectSlug, propertyCode }: Parameters<typeof patchUpdateProperty>[2], patch: Parameters<typeof patchUpdateProperty>[3]) => ReturnType<typeof patchUpdateProperty>;
|
|
167
141
|
};
|
|
168
142
|
}
|
|
169
143
|
declare function createApiClient(options: CreateApiClientOptions): ApiClient;
|
|
170
144
|
|
|
171
|
-
export { type ApiClient, type CreateApiClientOptions, type HttpClient, type HttpGet, type HttpPost, createApiClient, getCompanies,
|
|
145
|
+
export { type ApiClient, type CreateApiClientOptions, type HttpClient, type HttpGet, type HttpPatch, type HttpPost, createApiClient, getCompanies, getCompanyBySlug, getGoogleOAuthStart, getMe, getMyCompany, getMyProjectById, getMyProjects, getMyProperties, getMyPropertyById, getProjectByCompanyAndSlug, getProjects, getProjectsByCompany, getProperties, getPropertiesByProject, getPropertyByProjectAndCode, getUserById, getUsers, patchUpdateCompanyBySAdmin, patchUpdateMe, patchUpdateMyCompany, patchUpdateProject, patchUpdateProperty, patchUpdateUserBySAdmin, patchUpdateUserRoleByAdmin, postCreateCompany, postCreateProject, postCreateProperty, postGoogleOAuthCallback, postLogin, postLogout, postRefresh, postRegister };
|