@kulkan/kulterra-api-client 1.3.0 → 1.3.1
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/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/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 };
|
package/dist/index.d.ts
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 };
|