@justins-home/api-services 1.0.0
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/.turbo/turbo-build.log +14 -0
- package/CHANGELOG.md +32 -0
- package/dist/index.js +619 -0
- package/dist/index.mjs +573 -0
- package/package.json +19 -0
- package/src/api-client.ts +43 -0
- package/src/authService.ts +11 -0
- package/src/generated/admin.ts +311 -0
- package/src/generated/agent.ts +11 -0
- package/src/generated/appointment.ts +36 -0
- package/src/generated/auth.ts +26 -0
- package/src/generated/conversations.ts +31 -0
- package/src/generated/customer.ts +31 -0
- package/src/generated/feature.ts +11 -0
- package/src/generated/github.ts +16 -0
- package/src/generated/google.ts +16 -0
- package/src/generated/inspection.ts +11 -0
- package/src/generated/landlord.ts +116 -0
- package/src/generated/listings.ts +21 -0
- package/src/generated/maintenance.ts +21 -0
- package/src/generated/notification.ts +31 -0
- package/src/generated/plan.ts +16 -0
- package/src/generated/review.ts +36 -0
- package/src/generated/tenancy.ts +61 -0
- package/src/generated/tenant.ts +31 -0
- package/src/generated/userverification.ts +26 -0
- package/src/generated/wishlist.ts +21 -0
- package/src/index.ts +35 -0
- package/src/inspectionService.ts +8 -0
- package/src/listingService.ts +12 -0
- package/src/maintenanceService.ts +8 -0
- package/src/notificationService.ts +8 -0
- package/src/tenancyService.ts +8 -0
- package/src/types/openapi.ts +29 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
|
|
2
|
+
import { api } from "../api-client";
|
|
3
|
+
import type { ApiRequest, ApiPathParams, Expand } from "../types/openapi";
|
|
4
|
+
|
|
5
|
+
export const maintenance = {
|
|
6
|
+
|
|
7
|
+
listingHistory: (params: ApiPathParams<'listingHistoryMaintenance'>) => {
|
|
8
|
+
return api.get('listingHistoryMaintenance', `/api/v1/public/maintenance/listing/${params.listing_uid}`);
|
|
9
|
+
}
|
|
10
|
+
,
|
|
11
|
+
|
|
12
|
+
report: (payload: ApiRequest<'reportMaintenance'>) => {
|
|
13
|
+
return api.post('reportMaintenance', "/api/v1/public/maintenance/report", payload);
|
|
14
|
+
}
|
|
15
|
+
,
|
|
16
|
+
|
|
17
|
+
uploadAttachment: (params: ApiPathParams<'uploadAttachmentMaintenance'>) => {
|
|
18
|
+
return api.post('uploadAttachmentMaintenance', `/api/v1/public/maintenance/${params.maintenance_uid}/attachments`);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
|
|
2
|
+
import { api } from "../api-client";
|
|
3
|
+
import type { ApiRequest, ApiPathParams, Expand } from "../types/openapi";
|
|
4
|
+
|
|
5
|
+
export const notification = {
|
|
6
|
+
|
|
7
|
+
fetch: () => {
|
|
8
|
+
return api.get('fetchNotification', "/api/v1/public/notification/fetch-all");
|
|
9
|
+
}
|
|
10
|
+
,
|
|
11
|
+
|
|
12
|
+
read: (params: ApiPathParams<'readNotification'>) => {
|
|
13
|
+
return api.post('readNotification', `/api/v1/public/notification/${params.notification_id}/read`);
|
|
14
|
+
}
|
|
15
|
+
,
|
|
16
|
+
|
|
17
|
+
readAll: () => {
|
|
18
|
+
return api.post('readAllNotification', "/api/v1/public/notification/read-all");
|
|
19
|
+
}
|
|
20
|
+
,
|
|
21
|
+
|
|
22
|
+
countUnRead: () => {
|
|
23
|
+
return api.get('countUnReadNotification', "/api/v1/public/notification/unread-count");
|
|
24
|
+
}
|
|
25
|
+
,
|
|
26
|
+
|
|
27
|
+
registerDeviceToken: () => {
|
|
28
|
+
return api.post('registerDeviceTokenNotification', "/api/v1/public/notification/device-token");
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
|
|
2
|
+
import { api } from "../api-client";
|
|
3
|
+
import type { ApiRequest, ApiPathParams, Expand } from "../types/openapi";
|
|
4
|
+
|
|
5
|
+
export const plan = {
|
|
6
|
+
|
|
7
|
+
myCapabilities: () => {
|
|
8
|
+
return api.get('myCapabilitiesPlan', "/api/v1/public/plan/me/capabilities");
|
|
9
|
+
}
|
|
10
|
+
,
|
|
11
|
+
|
|
12
|
+
checkCapability: (params: ApiPathParams<'checkCapabilityPlan'>) => {
|
|
13
|
+
return api.get('checkCapabilityPlan', `/api/v1/public/plan/me/capabilities/${params.capability}`);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
|
|
2
|
+
import { api } from "../api-client";
|
|
3
|
+
import type { ApiRequest, ApiPathParams, Expand } from "../types/openapi";
|
|
4
|
+
|
|
5
|
+
export const review = {
|
|
6
|
+
|
|
7
|
+
fetchAll: () => {
|
|
8
|
+
return api.get('fetchAllReview', "/api/v1/public/review/fetch-all");
|
|
9
|
+
}
|
|
10
|
+
,
|
|
11
|
+
|
|
12
|
+
ratingSummary: () => {
|
|
13
|
+
return api.get('ratingSummaryReview', "/api/v1/public/review/summary");
|
|
14
|
+
}
|
|
15
|
+
,
|
|
16
|
+
|
|
17
|
+
createListing: (payload: ApiRequest<'createListingReview'>) => {
|
|
18
|
+
return api.post('createListingReview', "/api/v1/public/review/create-listing", payload);
|
|
19
|
+
}
|
|
20
|
+
,
|
|
21
|
+
|
|
22
|
+
createUser: (payload: ApiRequest<'createUserReview'>) => {
|
|
23
|
+
return api.post('createUserReview', "/api/v1/public/review/create-user", payload);
|
|
24
|
+
}
|
|
25
|
+
,
|
|
26
|
+
|
|
27
|
+
update: (params: ApiPathParams<'updateReview'>, payload: ApiRequest<'updateReview'>) => {
|
|
28
|
+
return api.post('updateReview', `/api/v1/public/review/update/${params.review_id}`, payload);
|
|
29
|
+
}
|
|
30
|
+
,
|
|
31
|
+
|
|
32
|
+
delete: (params: ApiPathParams<'deleteReview'>) => {
|
|
33
|
+
return api.post('deleteReview', `/api/v1/public/review/delete/${params.review_id}`);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
|
|
2
|
+
import { api } from "../api-client";
|
|
3
|
+
import type { ApiRequest, ApiPathParams, Expand } from "../types/openapi";
|
|
4
|
+
|
|
5
|
+
export const tenancy = {
|
|
6
|
+
|
|
7
|
+
fetchOne: (params: ApiPathParams<'fetchOneTenancy'>) => {
|
|
8
|
+
return api.get('fetchOneTenancy', `/api/v1/public/tenancy/fetch-one/${params.tenancy_uid}`);
|
|
9
|
+
}
|
|
10
|
+
,
|
|
11
|
+
|
|
12
|
+
create: (payload: ApiRequest<'createTenancy'>) => {
|
|
13
|
+
return api.post('createTenancy', "/api/v1/public/tenancy/create-tenancy", payload);
|
|
14
|
+
}
|
|
15
|
+
,
|
|
16
|
+
|
|
17
|
+
transition: (params: ApiPathParams<'transitionTenancy'>, payload: ApiRequest<'transitionTenancy'>) => {
|
|
18
|
+
return api.post('transitionTenancy', `/api/v1/public/tenancy/${params.tenancy_uid}/transition`, payload);
|
|
19
|
+
}
|
|
20
|
+
,
|
|
21
|
+
|
|
22
|
+
complianceStatus: (params: ApiPathParams<'complianceStatusTenancy'>) => {
|
|
23
|
+
return api.get('complianceStatusTenancy', `/api/v1/public/tenancy/${params.tenancy_uid}/compliance-status`);
|
|
24
|
+
}
|
|
25
|
+
,
|
|
26
|
+
|
|
27
|
+
renew: (params: ApiPathParams<'renewTenancy'>) => {
|
|
28
|
+
return api.post('renewTenancy', `/api/v1/public/tenancy/${params.tenancy_uid}/renewal`);
|
|
29
|
+
}
|
|
30
|
+
,
|
|
31
|
+
|
|
32
|
+
convert: (params: ApiPathParams<'convertTenancy'>) => {
|
|
33
|
+
return api.post('convertTenancy', `/api/v1/public/tenancy/${params.tenancy_uid}/convert-to-periodic`);
|
|
34
|
+
}
|
|
35
|
+
,
|
|
36
|
+
|
|
37
|
+
serveNotice: (params: ApiPathParams<'serveNoticeTenancy'>, payload: ApiRequest<'serveNoticeTenancy'>) => {
|
|
38
|
+
return api.post('serveNoticeTenancy', `/api/v1/public/tenancy/${params.tenancy_uid}/serve-notice`, payload);
|
|
39
|
+
}
|
|
40
|
+
,
|
|
41
|
+
|
|
42
|
+
terminate: (params: ApiPathParams<'terminateTenancy'>, payload: ApiRequest<'terminateTenancy'>) => {
|
|
43
|
+
return api.post('terminateTenancy', `/api/v1/public/tenancy/${params.tenancy_uid}/terminate`, payload);
|
|
44
|
+
}
|
|
45
|
+
,
|
|
46
|
+
|
|
47
|
+
fetchTransitions: (params: ApiPathParams<'fetchTransitionsTenancy'>) => {
|
|
48
|
+
return api.get('fetchTransitionsTenancy', `/api/v1/public/tenancy/${params.tenancy_uid}/transitions`);
|
|
49
|
+
}
|
|
50
|
+
,
|
|
51
|
+
|
|
52
|
+
uploadDocument: (params: ApiPathParams<'uploadDocumentTenancy'>) => {
|
|
53
|
+
return api.post('uploadDocumentTenancy', `/api/v1/public/tenancy/${params.tenancy_uid}/documents`);
|
|
54
|
+
}
|
|
55
|
+
,
|
|
56
|
+
|
|
57
|
+
downloadDocument: (params: ApiPathParams<'downloadDocumentTenancy'>) => {
|
|
58
|
+
return api.get('downloadDocumentTenancy', `/api/v1/public/tenancy/${params.tenancy_uid}/documents/${params.document_id}`);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
|
|
2
|
+
import { api } from "../api-client";
|
|
3
|
+
import type { ApiRequest, ApiPathParams, Expand } from "../types/openapi";
|
|
4
|
+
|
|
5
|
+
export const tenant = {
|
|
6
|
+
|
|
7
|
+
getApiV1PortalTenantTest: () => {
|
|
8
|
+
return api.get('getApiV1PortalTenantTest', "/api/v1/portal/tenant/test");
|
|
9
|
+
}
|
|
10
|
+
,
|
|
11
|
+
|
|
12
|
+
postApiV1PortalTenantCreate: (payload: ApiRequest<'postApiV1PortalTenantCreate'>) => {
|
|
13
|
+
return api.post('postApiV1PortalTenantCreate', "/api/v1/portal/tenant/create", payload);
|
|
14
|
+
}
|
|
15
|
+
,
|
|
16
|
+
|
|
17
|
+
postApiV1PortalTenantCreateWithGithub: () => {
|
|
18
|
+
return api.post('postApiV1PortalTenantCreateWithGithub', "/api/v1/portal/tenant/create-with-github");
|
|
19
|
+
}
|
|
20
|
+
,
|
|
21
|
+
|
|
22
|
+
postApiV1PortalTenantSendOtp: () => {
|
|
23
|
+
return api.post('postApiV1PortalTenantSendOtp', "/api/v1/portal/tenant/send-otp");
|
|
24
|
+
}
|
|
25
|
+
,
|
|
26
|
+
|
|
27
|
+
postApiV1PortalTenantVerifyOtp: (payload: ApiRequest<'postApiV1PortalTenantVerifyOtp'>) => {
|
|
28
|
+
return api.post('postApiV1PortalTenantVerifyOtp', "/api/v1/portal/tenant/verify-otp", payload);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
|
|
2
|
+
import { api } from "../api-client";
|
|
3
|
+
import type { ApiRequest, ApiPathParams, Expand } from "../types/openapi";
|
|
4
|
+
|
|
5
|
+
export const userverification = {
|
|
6
|
+
|
|
7
|
+
overview: () => {
|
|
8
|
+
return api.get('overviewUserVerification', "/api/v1/public/userverification/overview");
|
|
9
|
+
}
|
|
10
|
+
,
|
|
11
|
+
|
|
12
|
+
submit: (params: ApiPathParams<'submitUserVerification'>, payload: ApiRequest<'submitUserVerification'>) => {
|
|
13
|
+
return api.post('submitUserVerification', `/api/v1/public/userverification/submit/${params.layerKey}`, payload);
|
|
14
|
+
}
|
|
15
|
+
,
|
|
16
|
+
|
|
17
|
+
fetchFlow: () => {
|
|
18
|
+
return api.get('fetchFlowUserVerification', "/api/v1/public/userverification/fetch-flow");
|
|
19
|
+
}
|
|
20
|
+
,
|
|
21
|
+
|
|
22
|
+
resubmit: (params: ApiPathParams<'resubmitUserVerification'>, payload: ApiRequest<'resubmitUserVerification'>) => {
|
|
23
|
+
return api.post('resubmitUserVerification', `/api/v1/public/userverification/${params.layerKey}/retry`, payload);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
|
|
2
|
+
import { api } from "../api-client";
|
|
3
|
+
import type { ApiRequest, ApiPathParams, Expand } from "../types/openapi";
|
|
4
|
+
|
|
5
|
+
export const wishlist = {
|
|
6
|
+
|
|
7
|
+
create: (payload: ApiRequest<'createWishlist'>) => {
|
|
8
|
+
return api.post('createWishlist', "/api/v1/public/wishlist", payload);
|
|
9
|
+
}
|
|
10
|
+
,
|
|
11
|
+
|
|
12
|
+
remove: (params: ApiPathParams<'removeWishlist'>) => {
|
|
13
|
+
return api.post('removeWishlist', `/api/v1/public/wishlist/remove/${params.listing_uid}`);
|
|
14
|
+
}
|
|
15
|
+
,
|
|
16
|
+
|
|
17
|
+
get: (query?: Expand<ApiRequest<'getWishlist'>>) => {
|
|
18
|
+
return api.get('getWishlist', "/api/v1/public/wishlist/fetch-all", query);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
};
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* Core API utilities
|
|
4
|
+
*/
|
|
5
|
+
export * from './api-client';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* OpenAPI helper types
|
|
9
|
+
*/
|
|
10
|
+
export * from './types/openapi';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Auto-generated domain services
|
|
14
|
+
* (Do not edit manually)
|
|
15
|
+
*/
|
|
16
|
+
export * from './generated/admin';
|
|
17
|
+
export * from './generated/appointment';
|
|
18
|
+
export * from './generated/auth';
|
|
19
|
+
export * from './generated/agent';
|
|
20
|
+
export * from './generated/tenant';
|
|
21
|
+
export * from './generated/customer';
|
|
22
|
+
export * from './generated/google';
|
|
23
|
+
export * from './generated/github';
|
|
24
|
+
export * from './generated/feature';
|
|
25
|
+
export * from './generated/inspection';
|
|
26
|
+
export * from './generated/landlord';
|
|
27
|
+
export * from './generated/listings';
|
|
28
|
+
export * from './generated/maintenance';
|
|
29
|
+
export * from './generated/conversations';
|
|
30
|
+
export * from './generated/notification';
|
|
31
|
+
export * from './generated/plan';
|
|
32
|
+
export * from './generated/review';
|
|
33
|
+
export * from './generated/tenancy';
|
|
34
|
+
export * from './generated/userverification';
|
|
35
|
+
export * from './generated/wishlist';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { authClient, request } from '@justins-home/http-client';
|
|
2
|
+
import { InspectionResource } from '@justins-home/types';
|
|
3
|
+
|
|
4
|
+
export const inspectionService = {
|
|
5
|
+
async getInspections(): Promise<InspectionResource[]> {
|
|
6
|
+
return request(authClient, authClient.get('/inspections'));
|
|
7
|
+
},
|
|
8
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { authClient, request } from '@justins-home/http-client';
|
|
2
|
+
import { ListingResource } from '@justins-home/types';
|
|
3
|
+
|
|
4
|
+
export const listingService = {
|
|
5
|
+
async getListings(): Promise<ListingResource[]> {
|
|
6
|
+
return request(authClient, authClient.get('/listings'));
|
|
7
|
+
},
|
|
8
|
+
|
|
9
|
+
async getListing(uid: string): Promise<ListingResource> {
|
|
10
|
+
return request(authClient, authClient.get(`/listings/${uid}`));
|
|
11
|
+
},
|
|
12
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { authClient, request } from '@justins-home/http-client';
|
|
2
|
+
import { MaintenanceRequestResource } from '@justins-home/types';
|
|
3
|
+
|
|
4
|
+
export const maintenanceService = {
|
|
5
|
+
async getRequests(): Promise<MaintenanceRequestResource[]> {
|
|
6
|
+
return request(authClient, authClient.get('/maintenance'));
|
|
7
|
+
},
|
|
8
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { authClient, request } from '@justins-home/http-client';
|
|
2
|
+
import { NotificationResource } from '@justins-home/types';
|
|
3
|
+
|
|
4
|
+
export const notificationService = {
|
|
5
|
+
async getNotifications(): Promise<NotificationResource[]> {
|
|
6
|
+
return request(authClient, authClient.get('/notifications'));
|
|
7
|
+
},
|
|
8
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { authClient, request } from '@justins-home/http-client';
|
|
2
|
+
import { TenancyResource } from '@justins-home/types';
|
|
3
|
+
|
|
4
|
+
export const tenancyService = {
|
|
5
|
+
async getTenancies(): Promise<TenancyResource[]> {
|
|
6
|
+
return request(authClient, authClient.get('/tenancies'));
|
|
7
|
+
},
|
|
8
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { operations } from '@justins-home/types/generated/api-types';
|
|
2
|
+
|
|
3
|
+
export type OperationId = keyof operations;
|
|
4
|
+
|
|
5
|
+
export type ApiRequest<T extends OperationId> = operations[T] extends {
|
|
6
|
+
requestBody: { content: { 'application/json': infer R } };
|
|
7
|
+
}
|
|
8
|
+
? R
|
|
9
|
+
: operations[T] extends {
|
|
10
|
+
parameters: { query?: infer Q };
|
|
11
|
+
}
|
|
12
|
+
? Q
|
|
13
|
+
: never;
|
|
14
|
+
|
|
15
|
+
export type ApiResponse<T extends OperationId> = operations[T] extends {
|
|
16
|
+
responses: { 200: { content: { 'application/json': infer R } } };
|
|
17
|
+
}
|
|
18
|
+
? R
|
|
19
|
+
: unknown;
|
|
20
|
+
|
|
21
|
+
export type ApiPathParams<T extends OperationId> = operations[T] extends {
|
|
22
|
+
parameters: { path: infer P };
|
|
23
|
+
}
|
|
24
|
+
? P
|
|
25
|
+
: never;
|
|
26
|
+
|
|
27
|
+
export type Expand<T> = {
|
|
28
|
+
[K in keyof T]: T[K];
|
|
29
|
+
};
|