@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 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 Truffa API. Consumed by web and mobile apps. **No baked-in base URL:** pass a preconfigured HTTP layer (typically an [Axios](https://axios-http.com/) instance with `baseURL` set). Request and response shapes come from [`@kulkan/kulterra-contracts`](https://www.npmjs.com/package/@kulkan/contracts).
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` **≥ 1.1.0** (auth types and shared envelopes)
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 | Description |
21
- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
22
- | `createApiClient(options)` | Factory returning `healthCheck` + **`auth`** namespace |
23
- | `ApiClient` / `CreateApiClientOptions` | Typed client and `{ http: HttpClient }` options |
24
- | `HttpClient` | **`get`** and **`post`** (minimal surface compatible with Axios) |
25
- | `HttpGet` / `HttpPost` / `HttpPatch` | Method signatures |
26
- | Named auth helpers | `postRegister`, `postLogin`, `getGoogleOAuthStart`, `postGoogleOAuthCallback`, `postRefresh`, `postLogout`, `getMe` (see `src/endpoints/auth.ts`) |
27
- | Named user helpers | `getUsers`, `getUserById`, `patchUpdateMe`, `patchUpdateRoleUserByAdmin`, `patchUpdateUserBySAdmin` (see `src/endpoints/user.ts`) |
28
- | Named company helpers | `getCompanies`, `getCompanyById`, `getMyCompany`, `patchUpdateCompanyBySAdmin`, `patchUpdateMyCompany`, `postCreateCompany` (see `src/endpoints/company.ts`) |
29
- | Named project helpers |
30
- | `getMyProjectBySlug`, `getMyProjects`, `getProjectByCompanyAndSlug`, `getProjectsByCompany`, `getProjects`, `patchUpdateProjectByAdmin`, `patchUpdateProjectBySAdmin`, `postCreateProjectByAdmin`, `postCreateProjectBySAdmin` (see `src/endpoints/project.ts`) |
31
- | Named property helpers |
32
-
33
- `getMyProperties`,
34
- `getMyPropertyById`,
35
- `getProperties`,
36
- `getPropertiesByAdmin`,
37
- `getPropertiesByProject`, `getPropertiesByProjectByAdmin`, `getPropertyByProjectAndCode`, `getPropertyByProjectAndCodeByAdmin`, `patchUpdatePropertyByAdmin`, `patchUpdatePropertyBySAdmin`, `postCreatePropertyByAdmin`, `postCreatePropertyBySAdmin` (see `src/endpoints/property.ts`) |
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
- `USER ROUTES`
46
- | `GET` | `/api/v1/users/` | `client.user.users(userQuery, accessToken)` or `getUsers(http, userQuery, accessToken)` |
47
- | `GET` | `/api/v1/users/:userId` | `client.user.userById(accessToken, { userId })` or `getUserById(http, accessToken, { userId })` |
48
- | `PATCH` | `/api/v1/users/me` | `client.users.updateMe(accessToken, patch)` or `patchUpdateMe(http, accessToken, patch)` |
49
- | `PATCH` | `/api/v1/users/:id/role` | `client.user.updateRoleUserByAdmin({ id }, accessToken, body)` or `patchUpdateRoleUserByAdmin(http, accessToken, { id }, body)` |
50
- | `PATCH` | `/api/v1/users/:userId` | `client.users.updateUserBySAdmin({ userId }, accessToken, patch)` or `patchUpdateUserBySAdmin(http, { userId }, accessToken, patch)` |
51
-
52
- `COMPANY ROUTES`
53
- | `GET` | `/api/v1/companies/` | `client.company.companies(userQuery, accessToken)` or `getCompanies(http, accessToken, companyQuery)` |
54
- | `GET` | `/api/v1/companies/my` | `client.company.myCompany({ userId }, accessToken)` or `getMyCompany(http, accessToken)` |
55
- | `GET` | `/api/v1/companies/:companyId` | `client.company.companyById(patch, accessToken)` or `getCompanyById(http, accessToken, { companyId })` |
56
- | `POST` | `/api/v1/companies` | `client.company.createCompany({ userId }, patch, accessToken)` or `postCreateCompany(http, accessToken, newCompanyRequest)` |
57
- | `PATCH` | `/api/v1/companies/my` | `client.company.updateMyCompany({ userId }, patch, accessToken)` or `patchUpdateMyCompany(http, accessToken, patch)` |
58
- | `PATCH` | `/api/v1/companies/:id` | `client.company.updateCompanyBySAdmin({ userId }, patch, accessToken)` or `patchUpdateCompanyBySAdmin(http, accessToken, { companyId }, patch)` |
59
-
60
- `PROJECT ROUTES`
61
- | `GET` | `/api/v1/companies/projects` | `client.project.projects(accessToken, projectQuery)` or `getProjects(http, accessToken, projectQuery)` |
62
- | `GET` | `/api/v1/companies/my/projects` | `client.project.myProjects(accessToken, projectQuery)` or `getMyProjects(http, accessToken, projectQuery)` |
63
- | `GET` | `/api/v1/companies/my/projects/:projectSlug` | `client.project.myProjectBySlug(accessToken, { projectSlug })` or `getMyProjectBySlug(http, accessToken, { projectSlug })` |
64
- | `GET` | `/api/v1/companies/:companySlug/projects/:projectSlug` | `client.project.projectByCompanyAndSlug(accessToken, { companySlug, projectSlug })` or `getProjectByCompanyAndSlug(http, accessToken, { companySlug, projectSlug })` |
65
- | `GET` | `/api/v1/companies/:companySlug/projects` | `client.project.projectsByCompany(accessToken, { companySlug }, projectQuery)` or `getProjectsByCompany(http, accessToken, { companySlug }, projectQuery)` |
66
- | `POST` | `/api/v1/companies/my/projects` | `client.project.createProjectByAdmin(accessToken, newProjectRequest)` or `postCreateProjectByAdmin(http, accessToken, newProjectRequest)` |
67
- | `POST` | `/api/v1/companies/:companySlug/projects` | `client.project.createProjectBySAdmin(accessToken, { companySlug }, newProjectRequest)` or `postCreateProjectBySAdmin(http, accessToken, { companySlug }, newProjectRequest)` |
68
- | `PATCH` | `/api/v1/companies/my/projects/:projectSlug` | `client.project.updateProjectByAdmin(accessToken, { projectSlug }, patch)` or `patchUpdateProjectByAdmin(http, accessToken, { projectSlug }, patch)` |
69
- | `PATCH` | `/api/v1/companies/:companySlug/projects/:projectSlug` | `client.project.updateProjectBySAdmin(accessToken, { companySlug, projectSlug }, patch)` or `patchUpdateProjectBySAdmin(http, accessToken, { companySlug, projectSlug }, patch)` |
70
-
71
- `PROPERTY ROUTES`
72
- | `GET` | `/api/v1/properties` | `client.property.properties(accessToken, propertyQuery)` or `getProperties(http, accessToken, propertyQuery)` |
73
- | `GET` | `/api/v1/properties/my` | `client.property.myProperties(accessToken, propertyQuery)` or `getMyProperties(http, accessToken, propertyQuery)` |
74
- | `GET` | `/api/v1/properties/my/:propertyId` | `client.property.myPropertyById(accessToken, { propertyId })` or `getMyPropertyById(http, accessToken, { propertyId })` |
75
- | `GET` | `/api/v1/companies/my/projects/properties` | `client.property.propertiesByAdmin(accessToken, propertyQuery)` or `getPropertiesByAdmin(http, accessToken, propertyQuery)` |
76
- | `GET` | `/api/v1/companies/my/projects/:projectSlug/properties` | `client.property.propertiesByProjectByAdmin: (accessToken, { projectSlug }, propertyQuery)` or `getPropertiesByProjectByAdmin(http, accessToken, { projectSlug }, propertyQuery)` |
77
- | `GET` | `/api/v1/companies/my/projects/:projectSlug/properties/:propertyCode` | `client.property.propertyByProjectAndCodeByAdmin: (accessToken, { projectSlug, propertyCode })` or `getPropertyByProjectAndCodeByAdmin(http, accessToken, { projectSlug, propertyCode })` |
78
- | `GET` | `/api/v1/companies/:companySlug/projects/:projectSlug/properties` | `client.property.propertiesByProject: (accessToken, { companySlug, projectSlug }, propertyQuery)` or `getPropertiesByProject(http, accessToken, { companySlug, projectSlug }, propertyQuery)` |
79
- | `GET` | `/api/v1/companies/:companySlug/projects/:projectSlug/properties/:propertyCode` | `client.property.propertyByProjectAndCode: (accessToken, { companySlug, projectSlug, propertyCode })` or `getPropertyByProjectAndCode(http, accessToken, { companySlug, projectSlug, propertyCode })` |
80
- | `POST` | `/api/v1/companies/my/projects/:projectSlug/properties` | `client.property.createPropertyByAdmin: (accessToken, { projectSlug }, newPropertyRequest)` or `postCreatePropertyByAdmin(http, accessToken, { projectSlug }, newPropertyRequest)` |
81
- | `POST` | `/api/v1/companies/:companySlug/projects/:projectSlug/properties` | `client.property.createPropertyBySAdmin: (accessToken, { companySlug, projectSlug }, newPropertyRequest)` or `postCreatePropertyBySAdmin(http, accessToken, { companySlug, projectSlug }, newPropertyRequest)` |
82
- | `PATCH` | `/api/v1/companies/my/projects/:projectSlug/properties/:propertyCode` | `client.property.updatePropertyByAdmin: (accessToken, { projectSlug, propertyCode }, patch)` or `patchUpdatePropertyByAdmin(http, accessToken, { projectSlug, propertyCode }, patch)` |
83
- | `PATCH` | `/api/v1/companies/:companySlug/projects/:projectSlug/properties/:propertyCode` | `client.property.updatePropertyBySAdmin: (accessToken, { companySlug, projectSlug, propertyCode }, patch)` or `patchUpdatePropertyBySAdmin(http, accessToken, { companySlug, projectSlug, propertyCode }, patch)` |
84
-
85
- `AUTH ROUTES`
86
- | `GET` | `/api/v1/auth/oauth/google/start?redirectUri=...` | `client.auth.getGoogleOAuthStart(redirectUri)` or `getGoogleOAuthStart(http, redirectUri)` |
87
- | `GET` | `/api/v1/auth/me` | `client.auth.me(accessToken)` or `getMe(http, accessToken)` |
88
- | `POST` | `/api/v1/auth/register` | `client.auth.register(body)` or `postRegister(http, body)` |
89
- | `POST` | `/api/v1/auth/login` | `client.auth.login(body)` or `postLogin(http, body)` |
90
- | `POST` | `/api/v1/auth/oauth/google/callback` | `client.auth.postGoogleOAuthCallback(body)` or `postGoogleOAuthCallback(http, body)` |
91
- | `POST` | `/api/v1/auth/refresh` | `client.auth.refresh(body)` or `postRefresh(http, body)` |
92
- | `POST` | `/api/v1/auth/logout` | `client.auth.logout(body)` or `postLogout(http, body)` |
93
-
94
- Responses follow **`IApiResponse<T>`** from contracts (`success`, `data`, etc.). Auth session payloads are **`AuthSessionResponse`** (`TokenPair` + `user`). **`logout`** returns **204** with no JSON body.
95
- User session payloads are **`IPaginatedByTokenResponse<T>`, `ToAdminUsersResponse`, `ToSAdminUsersResponse` **`updateRoleUserByAdmin`, `updateUserBySAdmin`** returns **204\*\* with no JSON body.
96
- Company session payloads are **`IPaginatedByTokenResponse<T>`, `PublicCompanyResponse`, `SAdminCompanyResponse`, `AdminCompanyResponse` **`updateMyCompany`, `updateCompanyBySAdmin`** returns **204\*\* with no JSON body.
97
- Project session payloads are **`IPaginatedByTokenResponse<T>`, `ProjectResponse`, `PublicProjectResponse`, `OwnerProjectResponse` **`updateProjectByAdmin`, `updateProjectBySAdmin`** returns **204\*\* with no JSON body.
98
- Property session payloads are **`IPaginatedByTokenResponse<T>`, `PropertyResponse`, `PublicPropertyResponse`, `BuyerPropertyResponse` **`updatePropertyByAdmin`, `updatePropertyBySAdmin`** returns **204\*\* with no JSON body.
99
-
100
- ### Usage example (Axios)
101
-
102
- Paths are **relative to `baseURL`** (e.g. `https://api.example.com`).
103
-
104
- ```typescript
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: { 'Content-Type': 'application/json' },
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
- Axios returns `{ data: body }` where `body` is the full JSON from the server. For `IApiResponse<AuthSessionResponse>`, the **envelope** is in `response.data`; the **`AuthSessionResponse`** is typically `response.data.data` (depending on your typings).
149
+ const session = await api.auth.login({
150
+ email: 'user@example.com',
151
+ password: '********',
152
+ });
153
+ ```
122
154
 
123
- ### OAuth (mobile / web)
155
+ When using Axios, the package expects an HTTP layer with the `{ data: T }` response shape.
124
156
 
125
- 1. Call **`getGoogleOAuthStart`** with the same **`redirectUri`** you registered in Auth0 and in the API’s `OAUTH_ALLOWED_REDIRECT_URIS`.
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
- ### Why a factory?
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
- `createApiClient({ http })` keeps env and transport out of this package, supports multiple backends in one app, and makes tests easy with a mock `http` object.
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/POST (`{ data: T }` shape, Axios-compatible).
138
- 2. **`src/endpoints/*.ts`** — thin functions: `(http, …args) => Promise<…>`.
139
- 3. **`createApiClient`** — wires `http` into endpoints.
140
- 4. **`@kulkan/kulterra-contracts`** — DTOs (`RegisterRequest`, `AuthSessionResponse`, …).
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 you add PUT/DELETE, extend **`HttpClient`** in `src/http-client.ts` and add endpoint modules. For request config (query params, headers), align types with your adapter (Axios uses a second `config` argument on `get`/`post`).
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 **`HttpClient`** with **`get`** and **`post`** mocks and assert URLs and payloads.
182
+ Inject a fake `HttpClient` and assert the generated URL, params, headers, and body.
151
183
 
152
- ```typescript
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({ data: { success: true, data: {} } }),
158
- post: jest.fn().mockResolvedValue({ data: { success: true, data: {} } }),
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
- ## Development (this repository)
215
+ ```text
216
+ /api/v1/projects
217
+ ```
218
+
219
+ and not:
220
+
221
+ ```text
222
+ /api/v1/companies/projects
223
+ ```
169
224
 
170
- | Script | Purpose |
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 { RegisterRequest, IApiResponse, AuthSessionResponse, LoginRequest, OAuthGoogleStartResponse, OAuthGoogleCallbackRequest, RefreshRequest, LogoutRequest, AuthUserResponse, GetUsersQueryByTokenRequest, IPaginatedByTokenResponse, ToAdminUsersResponse, ToSAdminUsersResponse, UpdateUserByUserRequest, UpdateUserRoleByAdminRequest, UpdateUserBySAdminRequest, HealthCheck, GetCompaniesQueryRequest, IPaginatedResponse, PublicCompanyResponse, SAdminCompanyResponse, AdminCompanyResponse, CreateCompanyRequest, UpdateCompanyByAdminRequest, UpdateCompanyBySAdminRequest, GetProjectsQueryByTokenRequest, ProjectResponse, PublicProjectResponse, OwnerProjectResponse, CreateProjectRequest, UpdateProjectRequest, GetPropertiesQueryByTokenRequest, PropertyResponse, PublicPropertyResponse, BuyerPropertyResponse, CreatePropertyRequest, UpdatePropertyRequest } from '@kulkan/kulterra-contracts';
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 patchUpdateRoleUserByAdmin(http: HttpClient, accessToken: string, { userId }: {
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 getCompanyById(http: HttpClient, accessToken: string, { companyId }: {
43
- companyId: string;
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<ProjectResponse | OwnerProjectResponse>>>;
53
- declare function getMyProjectBySlug(http: HttpClient, accessToken: string, { projectSlug }: {
54
- projectSlug: string;
55
- }): Promise<IApiResponse<ProjectResponse | OwnerProjectResponse>>;
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 postCreateProjectByAdmin(http: HttpClient, accessToken: string, newProjectRequest: CreateProjectRequest): Promise<IApiResponse<ProjectResponse>>;
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 patchUpdateProjectByAdmin(http: HttpClient, accessToken: string, { projectSlug }: {
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, propertyQuery: GetPropertiesQueryByTokenRequest): Promise<IApiResponse<IPaginatedByTokenResponse<PropertyResponse | PublicPropertyResponse>>>;
76
- declare function getMyProperties(http: HttpClient, accessToken: string, propertyQuery: GetPropertiesQueryByTokenRequest): Promise<IApiResponse<IPaginatedByTokenResponse<BuyerPropertyResponse>>>;
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
- }, propertyQuery: GetPropertiesQueryByTokenRequest): Promise<IApiResponse<IPaginatedByTokenResponse<PropertyResponse | PublicPropertyResponse>>>;
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 postCreatePropertyByAdmin(http: HttpClient, accessToken: string, { projectSlug }: {
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 patchUpdatePropertyByAdmin(http: HttpClient, accessToken: string, { projectSlug, propertyCode }: {
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 updateRoleUserByAdmin: (accessToken: Parameters<typeof patchUpdateRoleUserByAdmin>[1], { userId }: Parameters<typeof patchUpdateRoleUserByAdmin>[2], body: Parameters<typeof patchUpdateRoleUserByAdmin>[3]) => ReturnType<typeof patchUpdateRoleUserByAdmin>;
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 companyById: (accessToken: Parameters<typeof getCompanyById>[1], { companyId }: Parameters<typeof getCompanyById>[2]) => ReturnType<typeof getCompanyById>;
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 myProjectBySlug: (accessToken: Parameters<typeof getMyProjectBySlug>[1], { projectSlug }: Parameters<typeof getMyProjectBySlug>[2]) => ReturnType<typeof getMyProjectBySlug>;
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 createProjectByAdmin: (accessToken: Parameters<typeof postCreateProjectByAdmin>[1], newProjectRequest: Parameters<typeof postCreateProjectByAdmin>[2]) => ReturnType<typeof postCreateProjectByAdmin>;
150
- readonly createProjectBySAdmin: (accessToken: Parameters<typeof postCreateProjectBySAdmin>[1], { companySlug }: Parameters<typeof postCreateProjectBySAdmin>[2], newProjectRequest: Parameters<typeof postCreateProjectBySAdmin>[3]) => ReturnType<typeof postCreateProjectBySAdmin>;
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 createPropertyByAdmin: (accessToken: Parameters<typeof postCreatePropertyByAdmin>[1], { projectSlug }: Parameters<typeof postCreatePropertyByAdmin>[2], newPropertyRequest: Parameters<typeof postCreatePropertyByAdmin>[3]) => ReturnType<typeof postCreatePropertyByAdmin>;
164
- readonly createPropertyBySAdmin: (accessToken: Parameters<typeof postCreatePropertyBySAdmin>[1], { companySlug, projectSlug }: Parameters<typeof postCreatePropertyBySAdmin>[2], newPropertyRequest: Parameters<typeof postCreatePropertyBySAdmin>[3]) => ReturnType<typeof postCreatePropertyBySAdmin>;
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, getCompanyById, getGoogleOAuthStart, getMe, getMyCompany, getMyProjectBySlug, getMyProjects, getMyProperties, getMyPropertyById, getProjectByCompanyAndSlug, getProjects, getProjectsByCompany, getProperties, getPropertiesByAdmin, getPropertiesByProject, getPropertiesByProjectByAdmin, getPropertyByProjectAndCode, getPropertyByProjectAndCodeByAdmin, getUserById, getUsers, patchUpdateCompanyBySAdmin, patchUpdateMe, patchUpdateMyCompany, patchUpdateProjectByAdmin, patchUpdateProjectBySAdmin, patchUpdatePropertyByAdmin, patchUpdatePropertyBySAdmin, patchUpdateRoleUserByAdmin, patchUpdateUserBySAdmin, postCreateCompany, postCreateProjectByAdmin, postCreateProjectBySAdmin, postCreatePropertyByAdmin, postCreatePropertyBySAdmin, postGoogleOAuthCallback, postLogin, postLogout, postRefresh, postRegister };
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 };