@osise/api-client 0.0.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/README.md +474 -0
- package/dist/cjs/api/admin.js +277 -0
- package/dist/cjs/api/admin.js.map +1 -0
- package/dist/cjs/api/artisans.js +277 -0
- package/dist/cjs/api/artisans.js.map +1 -0
- package/dist/cjs/api/auth.js +83 -0
- package/dist/cjs/api/auth.js.map +1 -0
- package/dist/cjs/api/consumers.js +170 -0
- package/dist/cjs/api/consumers.js.map +1 -0
- package/dist/cjs/api/index.js +22 -0
- package/dist/cjs/api/index.js.map +1 -0
- package/dist/cjs/api/jobs.js +202 -0
- package/dist/cjs/api/jobs.js.map +1 -0
- package/dist/cjs/hooks/index.js +435 -0
- package/dist/cjs/hooks/index.js.map +1 -0
- package/dist/cjs/index.js +189 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/types/admin.js +6 -0
- package/dist/cjs/types/admin.js.map +1 -0
- package/dist/cjs/types/artisan.js +6 -0
- package/dist/cjs/types/artisan.js.map +1 -0
- package/dist/cjs/types/auth.js +6 -0
- package/dist/cjs/types/auth.js.map +1 -0
- package/dist/cjs/types/common.js +6 -0
- package/dist/cjs/types/common.js.map +1 -0
- package/dist/cjs/types/consumer.js +6 -0
- package/dist/cjs/types/consumer.js.map +1 -0
- package/dist/cjs/types/enums.js +226 -0
- package/dist/cjs/types/enums.js.map +1 -0
- package/dist/cjs/types/index.js +35 -0
- package/dist/cjs/types/index.js.map +1 -0
- package/dist/cjs/types/job.js +6 -0
- package/dist/cjs/types/job.js.map +1 -0
- package/dist/cjs/utils/http-client.js +214 -0
- package/dist/cjs/utils/http-client.js.map +1 -0
- package/dist/cjs/utils/index.js +19 -0
- package/dist/cjs/utils/index.js.map +1 -0
- package/dist/cjs/utils/storage.js +105 -0
- package/dist/cjs/utils/storage.js.map +1 -0
- package/dist/esm/api/admin.js +269 -0
- package/dist/esm/api/admin.js.map +1 -0
- package/dist/esm/api/artisans.js +270 -0
- package/dist/esm/api/artisans.js.map +1 -0
- package/dist/esm/api/auth.js +79 -0
- package/dist/esm/api/auth.js.map +1 -0
- package/dist/esm/api/consumers.js +165 -0
- package/dist/esm/api/consumers.js.map +1 -0
- package/dist/esm/api/index.js +6 -0
- package/dist/esm/api/index.js.map +1 -0
- package/dist/esm/api/jobs.js +197 -0
- package/dist/esm/api/jobs.js.map +1 -0
- package/dist/esm/hooks/index.js +408 -0
- package/dist/esm/hooks/index.js.map +1 -0
- package/dist/esm/index.js +165 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/types/admin.js +5 -0
- package/dist/esm/types/admin.js.map +1 -0
- package/dist/esm/types/artisan.js +5 -0
- package/dist/esm/types/artisan.js.map +1 -0
- package/dist/esm/types/auth.js +5 -0
- package/dist/esm/types/auth.js.map +1 -0
- package/dist/esm/types/common.js +5 -0
- package/dist/esm/types/common.js.map +1 -0
- package/dist/esm/types/consumer.js +5 -0
- package/dist/esm/types/consumer.js.map +1 -0
- package/dist/esm/types/enums.js +223 -0
- package/dist/esm/types/enums.js.map +1 -0
- package/dist/esm/types/index.js +19 -0
- package/dist/esm/types/index.js.map +1 -0
- package/dist/esm/types/job.js +5 -0
- package/dist/esm/types/job.js.map +1 -0
- package/dist/esm/utils/http-client.js +208 -0
- package/dist/esm/utils/http-client.js.map +1 -0
- package/dist/esm/utils/index.js +3 -0
- package/dist/esm/utils/index.js.map +1 -0
- package/dist/esm/utils/storage.js +99 -0
- package/dist/esm/utils/storage.js.map +1 -0
- package/dist/types/api/admin.d.ts +188 -0
- package/dist/types/api/admin.d.ts.map +1 -0
- package/dist/types/api/artisans.d.ts +183 -0
- package/dist/types/api/artisans.d.ts.map +1 -0
- package/dist/types/api/auth.d.ts +58 -0
- package/dist/types/api/auth.d.ts.map +1 -0
- package/dist/types/api/consumers.d.ts +113 -0
- package/dist/types/api/consumers.d.ts.map +1 -0
- package/dist/types/api/index.d.ts +6 -0
- package/dist/types/api/index.d.ts.map +1 -0
- package/dist/types/api/jobs.d.ts +136 -0
- package/dist/types/api/jobs.d.ts.map +1 -0
- package/dist/types/hooks/index.d.ts +225 -0
- package/dist/types/hooks/index.d.ts.map +1 -0
- package/dist/types/index.d.ts +127 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/types/admin.d.ts +226 -0
- package/dist/types/types/admin.d.ts.map +1 -0
- package/dist/types/types/artisan.d.ts +438 -0
- package/dist/types/types/artisan.d.ts.map +1 -0
- package/dist/types/types/auth.d.ts +92 -0
- package/dist/types/types/auth.d.ts.map +1 -0
- package/dist/types/types/common.d.ts +105 -0
- package/dist/types/types/common.d.ts.map +1 -0
- package/dist/types/types/consumer.d.ts +144 -0
- package/dist/types/types/consumer.d.ts.map +1 -0
- package/dist/types/types/enums.d.ts +199 -0
- package/dist/types/types/enums.d.ts.map +1 -0
- package/dist/types/types/index.d.ts +12 -0
- package/dist/types/types/index.d.ts.map +1 -0
- package/dist/types/types/job.d.ts +226 -0
- package/dist/types/types/job.d.ts.map +1 -0
- package/dist/types/utils/http-client.d.ts +65 -0
- package/dist/types/utils/http-client.d.ts.map +1 -0
- package/dist/types/utils/index.d.ts +3 -0
- package/dist/types/utils/index.d.ts.map +1 -0
- package/dist/types/utils/storage.d.ts +48 -0
- package/dist/types/utils/storage.d.ts.map +1 -0
- package/package.json +78 -0
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Jobs API
|
|
3
|
+
* Handles job requests, quotes, payments, ratings, and disputes
|
|
4
|
+
*/
|
|
5
|
+
import { HttpClient } from '../utils/http-client';
|
|
6
|
+
import { StandardResponse, PagedResult, CreateJobRequestDto, UpdateJobRequestDto, JobRequestDto, JobListItemDto, JobFilterDto, CancelJobDto, JobTimelineEventDto, SubmitQuoteDto, QuoteDecisionDto, JobQuoteDto, InitiatePaymentDto, PaymentResponseDto, JobPaymentDto, SubmitRatingDto, JobRatingDto, CreateDisputeDto, JobDisputeDto, ArtisanJobDto, ArtisanJobFilterDto, UpdateJobStatusDto, ArtisanLocationUpdateDto } from '../types';
|
|
7
|
+
export declare class JobsApi {
|
|
8
|
+
private readonly http;
|
|
9
|
+
private readonly basePath;
|
|
10
|
+
constructor(http: HttpClient);
|
|
11
|
+
/**
|
|
12
|
+
* Create a new job request
|
|
13
|
+
*/
|
|
14
|
+
create(data: CreateJobRequestDto): Promise<StandardResponse<JobRequestDto>>;
|
|
15
|
+
/**
|
|
16
|
+
* Get a specific job by ID
|
|
17
|
+
*/
|
|
18
|
+
get(jobId: string): Promise<StandardResponse<JobRequestDto>>;
|
|
19
|
+
/**
|
|
20
|
+
* Update a pending job request
|
|
21
|
+
*/
|
|
22
|
+
update(jobId: string, data: UpdateJobRequestDto): Promise<StandardResponse<JobRequestDto>>;
|
|
23
|
+
/**
|
|
24
|
+
* Get consumer's jobs (paginated with filters)
|
|
25
|
+
*/
|
|
26
|
+
list(params?: JobFilterDto): Promise<StandardResponse<PagedResult<JobListItemDto>>>;
|
|
27
|
+
/**
|
|
28
|
+
* Cancel a job
|
|
29
|
+
*/
|
|
30
|
+
cancel(jobId: string, data: CancelJobDto): Promise<StandardResponse<JobRequestDto>>;
|
|
31
|
+
/**
|
|
32
|
+
* Get job timeline/history
|
|
33
|
+
*/
|
|
34
|
+
getTimeline(jobId: string): Promise<StandardResponse<JobTimelineEventDto[]>>;
|
|
35
|
+
/**
|
|
36
|
+
* Get the current quote for a job
|
|
37
|
+
*/
|
|
38
|
+
getQuote(jobId: string): Promise<StandardResponse<JobQuoteDto>>;
|
|
39
|
+
/**
|
|
40
|
+
* Approve or reject a quote
|
|
41
|
+
*/
|
|
42
|
+
respondToQuote(jobId: string, data: QuoteDecisionDto): Promise<StandardResponse<JobQuoteDto>>;
|
|
43
|
+
/**
|
|
44
|
+
* Get payment details for a job
|
|
45
|
+
*/
|
|
46
|
+
getPayment(jobId: string): Promise<StandardResponse<JobPaymentDto>>;
|
|
47
|
+
/**
|
|
48
|
+
* Initiate payment for a job
|
|
49
|
+
*/
|
|
50
|
+
initiatePayment(jobId: string, data: InitiatePaymentDto): Promise<StandardResponse<PaymentResponseDto>>;
|
|
51
|
+
/**
|
|
52
|
+
* Verify payment (callback from payment gateway)
|
|
53
|
+
*/
|
|
54
|
+
verifyPayment(jobId: string, reference: string): Promise<StandardResponse<JobPaymentDto>>;
|
|
55
|
+
/**
|
|
56
|
+
* Mark payment as cash (for cash payments)
|
|
57
|
+
*/
|
|
58
|
+
markCashPayment(jobId: string): Promise<StandardResponse<JobPaymentDto>>;
|
|
59
|
+
/**
|
|
60
|
+
* Get rating for a completed job
|
|
61
|
+
*/
|
|
62
|
+
getRating(jobId: string): Promise<StandardResponse<JobRatingDto>>;
|
|
63
|
+
/**
|
|
64
|
+
* Submit rating for a completed job
|
|
65
|
+
*/
|
|
66
|
+
submitRating(jobId: string, data: SubmitRatingDto): Promise<StandardResponse<JobRatingDto>>;
|
|
67
|
+
/**
|
|
68
|
+
* Get dispute for a job
|
|
69
|
+
*/
|
|
70
|
+
getDispute(jobId: string): Promise<StandardResponse<JobDisputeDto>>;
|
|
71
|
+
/**
|
|
72
|
+
* Create a dispute for a job
|
|
73
|
+
*/
|
|
74
|
+
createDispute(jobId: string, data: CreateDisputeDto): Promise<StandardResponse<JobDisputeDto>>;
|
|
75
|
+
}
|
|
76
|
+
export declare class ArtisanJobsApi {
|
|
77
|
+
private readonly http;
|
|
78
|
+
private readonly basePath;
|
|
79
|
+
constructor(http: HttpClient);
|
|
80
|
+
/**
|
|
81
|
+
* Get assigned jobs for artisan (paginated with filters)
|
|
82
|
+
*/
|
|
83
|
+
list(params?: ArtisanJobFilterDto): Promise<StandardResponse<PagedResult<ArtisanJobDto>>>;
|
|
84
|
+
/**
|
|
85
|
+
* Get a specific assigned job
|
|
86
|
+
*/
|
|
87
|
+
get(jobId: string): Promise<StandardResponse<ArtisanJobDto>>;
|
|
88
|
+
/**
|
|
89
|
+
* Accept an assigned job
|
|
90
|
+
*/
|
|
91
|
+
accept(jobId: string): Promise<StandardResponse<ArtisanJobDto>>;
|
|
92
|
+
/**
|
|
93
|
+
* Decline an assigned job
|
|
94
|
+
*/
|
|
95
|
+
decline(jobId: string, reason: string): Promise<StandardResponse<null>>;
|
|
96
|
+
/**
|
|
97
|
+
* Update job status (en_route, arrived, in_progress, completed)
|
|
98
|
+
*/
|
|
99
|
+
updateStatus(jobId: string, data: UpdateJobStatusDto): Promise<StandardResponse<ArtisanJobDto>>;
|
|
100
|
+
/**
|
|
101
|
+
* Start traveling to job location
|
|
102
|
+
*/
|
|
103
|
+
startEnRoute(jobId: string): Promise<StandardResponse<ArtisanJobDto>>;
|
|
104
|
+
/**
|
|
105
|
+
* Mark arrival at job location (GPS verified)
|
|
106
|
+
*/
|
|
107
|
+
markArrived(jobId: string, location: {
|
|
108
|
+
latitude: number;
|
|
109
|
+
longitude: number;
|
|
110
|
+
}): Promise<StandardResponse<ArtisanJobDto>>;
|
|
111
|
+
/**
|
|
112
|
+
* Start work on the job
|
|
113
|
+
*/
|
|
114
|
+
startWork(jobId: string): Promise<StandardResponse<ArtisanJobDto>>;
|
|
115
|
+
/**
|
|
116
|
+
* Mark job as completed
|
|
117
|
+
*/
|
|
118
|
+
complete(jobId: string, notes?: string): Promise<StandardResponse<ArtisanJobDto>>;
|
|
119
|
+
/**
|
|
120
|
+
* Submit a quote for the job
|
|
121
|
+
*/
|
|
122
|
+
submitQuote(jobId: string, data: SubmitQuoteDto): Promise<StandardResponse<JobQuoteDto>>;
|
|
123
|
+
/**
|
|
124
|
+
* Revise a rejected quote
|
|
125
|
+
*/
|
|
126
|
+
reviseQuote(jobId: string, data: SubmitQuoteDto): Promise<StandardResponse<JobQuoteDto>>;
|
|
127
|
+
/**
|
|
128
|
+
* Update location while en route
|
|
129
|
+
*/
|
|
130
|
+
updateLocation(jobId: string, data: ArtisanLocationUpdateDto): Promise<StandardResponse<null>>;
|
|
131
|
+
/**
|
|
132
|
+
* Respond to a consumer review
|
|
133
|
+
*/
|
|
134
|
+
respondToReview(jobId: string, response: string): Promise<StandardResponse<null>>;
|
|
135
|
+
}
|
|
136
|
+
//# sourceMappingURL=jobs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jobs.d.ts","sourceRoot":"","sources":["../../../src/api/jobs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EACL,gBAAgB,EAChB,WAAW,EACX,mBAAmB,EACnB,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,mBAAmB,EACnB,cAAc,EACd,gBAAgB,EAChB,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACb,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,mBAAmB,EACnB,kBAAkB,EAClB,wBAAwB,EAEzB,MAAM,UAAU,CAAC;AAElB,qBAAa,OAAO;IAGN,OAAO,CAAC,QAAQ,CAAC,IAAI;IAFjC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAkB;gBAEd,IAAI,EAAE,UAAU;IAI7C;;OAEG;IACG,MAAM,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,gBAAgB,CAAC,aAAa,CAAC,CAAC;IAIjF;;OAEG;IACG,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,aAAa,CAAC,CAAC;IAIlE;;OAEG;IACG,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,gBAAgB,CAAC,aAAa,CAAC,CAAC;IAIhG;;OAEG;IACG,IAAI,CAAC,MAAM,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,gBAAgB,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC,CAAC;IAIzF;;OAEG;IACG,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,Y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E,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,aAAa,CAAC,CAAC;IAIvF;;OAEG;IACG,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;IAI9F;;OAEG;IACG,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;IAI9F;;OAEG;IACG,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,wBAAwB,GAAG,OAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;IAIpG;;OAEG;IACG,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;CAGxF"}
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* React Hooks for Osise API Client
|
|
3
|
+
*
|
|
4
|
+
* These hooks provide a convenient way to use the Osise API in React applications
|
|
5
|
+
* with built-in state management for loading, error, and data states.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
import type { ReactNode } from 'react';
|
|
10
|
+
import { OsiseClient, OsiseClientConfig, OsiseApiError, StandardResponse } from '../index';
|
|
11
|
+
/**
|
|
12
|
+
* Provider component for Osise client
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* import { OsiseProvider, BrowserTokenStorage } from '@osise/api-client/react';
|
|
17
|
+
*
|
|
18
|
+
* function App() {
|
|
19
|
+
* return (
|
|
20
|
+
* <OsiseProvider
|
|
21
|
+
* config={{
|
|
22
|
+
* baseUrl: 'https://api.osise.com',
|
|
23
|
+
* storage: new BrowserTokenStorage(),
|
|
24
|
+
* }}
|
|
25
|
+
* >
|
|
26
|
+
* <MyApp />
|
|
27
|
+
* </OsiseProvider>
|
|
28
|
+
* );
|
|
29
|
+
* }
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export interface OsiseProviderProps {
|
|
33
|
+
config: OsiseClientConfig;
|
|
34
|
+
children: ReactNode;
|
|
35
|
+
}
|
|
36
|
+
export declare function OsiseProvider({ config, children }: OsiseProviderProps): ReactNode;
|
|
37
|
+
/**
|
|
38
|
+
* Hook to access the Osise client
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```tsx
|
|
42
|
+
* function MyComponent() {
|
|
43
|
+
* const client = useOsiseClient();
|
|
44
|
+
*
|
|
45
|
+
* const handleLogin = async () => {
|
|
46
|
+
* await client.auth.requestOtp({ phoneNumber: '+234...' });
|
|
47
|
+
* };
|
|
48
|
+
* }
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
export declare function useOsiseClient(): OsiseClient;
|
|
52
|
+
/**
|
|
53
|
+
* Hook to check authentication status
|
|
54
|
+
*/
|
|
55
|
+
export declare function useIsAuthenticated(): boolean;
|
|
56
|
+
interface QueryState<T> {
|
|
57
|
+
data: T | null;
|
|
58
|
+
error: OsiseApiError | null;
|
|
59
|
+
isLoading: boolean;
|
|
60
|
+
isError: boolean;
|
|
61
|
+
isSuccess: boolean;
|
|
62
|
+
}
|
|
63
|
+
interface QueryOptions {
|
|
64
|
+
enabled?: boolean;
|
|
65
|
+
refetchOnMount?: boolean;
|
|
66
|
+
}
|
|
67
|
+
interface QueryResult<T> extends QueryState<T> {
|
|
68
|
+
refetch: () => Promise<void>;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Generic query hook for API calls
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```tsx
|
|
75
|
+
* function Profile() {
|
|
76
|
+
* const { data, isLoading, error } = useQuery(
|
|
77
|
+
* () => client.consumers.getProfile(),
|
|
78
|
+
* { enabled: isAuthenticated }
|
|
79
|
+
* );
|
|
80
|
+
*
|
|
81
|
+
* if (isLoading) return <Loading />;
|
|
82
|
+
* if (error) return <Error message={error.message} />;
|
|
83
|
+
* return <div>{data?.firstName}</div>;
|
|
84
|
+
* }
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
export declare function useQuery<T>(queryFn: () => Promise<StandardResponse<T>>, options?: QueryOptions): QueryResult<T>;
|
|
88
|
+
interface MutationState<T> {
|
|
89
|
+
data: T | null;
|
|
90
|
+
error: OsiseApiError | null;
|
|
91
|
+
isLoading: boolean;
|
|
92
|
+
isError: boolean;
|
|
93
|
+
isSuccess: boolean;
|
|
94
|
+
}
|
|
95
|
+
interface MutationOptions<T> {
|
|
96
|
+
onSuccess?: (data: T) => void;
|
|
97
|
+
onError?: (error: OsiseApiError) => void;
|
|
98
|
+
onSettled?: () => void;
|
|
99
|
+
}
|
|
100
|
+
interface MutationResult<TData, TVariables> extends MutationState<TData> {
|
|
101
|
+
mutate: (variables: TVariables) => Promise<TData | null>;
|
|
102
|
+
mutateAsync: (variables: TVariables) => Promise<TData>;
|
|
103
|
+
reset: () => void;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Generic mutation hook for API calls
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* ```tsx
|
|
110
|
+
* function RequestOtp() {
|
|
111
|
+
* const { mutate, isLoading } = useMutation(
|
|
112
|
+
* (phone: string) => client.auth.requestOtp({ phoneNumber: phone, purpose: 'Login' }),
|
|
113
|
+
* {
|
|
114
|
+
* onSuccess: () => navigate('/verify-otp'),
|
|
115
|
+
* onError: (error) => toast.error(error.message),
|
|
116
|
+
* }
|
|
117
|
+
* );
|
|
118
|
+
*
|
|
119
|
+
* return (
|
|
120
|
+
* <button onClick={() => mutate('+234...')} disabled={isLoading}>
|
|
121
|
+
* Request OTP
|
|
122
|
+
* </button>
|
|
123
|
+
* );
|
|
124
|
+
* }
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
127
|
+
export declare function useMutation<TData, TVariables>(mutationFn: (variables: TVariables) => Promise<StandardResponse<TData>>, options?: MutationOptions<TData>): MutationResult<TData, TVariables>;
|
|
128
|
+
import type { OtpPurpose, DeviceType } from '../types';
|
|
129
|
+
interface RequestOtpInput {
|
|
130
|
+
phoneNumber: string;
|
|
131
|
+
purpose: OtpPurpose;
|
|
132
|
+
deviceId?: string;
|
|
133
|
+
}
|
|
134
|
+
interface VerifyOtpInput {
|
|
135
|
+
phoneNumber: string;
|
|
136
|
+
code: string;
|
|
137
|
+
deviceId: string;
|
|
138
|
+
deviceName?: string;
|
|
139
|
+
deviceType?: DeviceType;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Hook for OTP request
|
|
143
|
+
*/
|
|
144
|
+
export declare function useRequestOtp(): MutationResult<import("../index").OtpResponseDto, RequestOtpInput>;
|
|
145
|
+
/**
|
|
146
|
+
* Hook for OTP verification
|
|
147
|
+
*/
|
|
148
|
+
export declare function useVerifyOtp(): MutationResult<import("../index").AuthResponseDto, VerifyOtpInput>;
|
|
149
|
+
/**
|
|
150
|
+
* Hook for logout
|
|
151
|
+
*/
|
|
152
|
+
export declare function useLogout(): MutationResult<null, unknown>;
|
|
153
|
+
/**
|
|
154
|
+
* Hook for getting current user
|
|
155
|
+
*/
|
|
156
|
+
export declare function useCurrentUser(): QueryResult<import("../index").UserProfileDto>;
|
|
157
|
+
import type { PaginationParams } from '../types';
|
|
158
|
+
/**
|
|
159
|
+
* Hook for consumer profile
|
|
160
|
+
*/
|
|
161
|
+
export declare function useConsumerProfile(): QueryResult<import("../index").ConsumerProfileDto>;
|
|
162
|
+
/**
|
|
163
|
+
* Hook for consumer addresses
|
|
164
|
+
*/
|
|
165
|
+
export declare function useConsumerAddresses(): QueryResult<import("../index").AddressDto[]>;
|
|
166
|
+
/**
|
|
167
|
+
* Hook for favorite artisans
|
|
168
|
+
*/
|
|
169
|
+
export declare function useFavoriteArtisans(params?: PaginationParams): QueryResult<import("../index").PagedResult<import("../index").FavoriteArtisanDto>>;
|
|
170
|
+
/**
|
|
171
|
+
* Hook for artisan profile
|
|
172
|
+
*/
|
|
173
|
+
export declare function useArtisanProfile(): QueryResult<import("../index").ArtisanProfileDto>;
|
|
174
|
+
/**
|
|
175
|
+
* Hook for artisan application status
|
|
176
|
+
*/
|
|
177
|
+
export declare function useApplicationStatus(): QueryResult<import("../index").ApplicationStatusDto>;
|
|
178
|
+
/**
|
|
179
|
+
* Hook for artisan documents
|
|
180
|
+
*/
|
|
181
|
+
export declare function useArtisanDocuments(): QueryResult<import("../index").DocumentsOverviewDto>;
|
|
182
|
+
/**
|
|
183
|
+
* Hook for artisan availability
|
|
184
|
+
*/
|
|
185
|
+
export declare function useArtisanAvailability(): QueryResult<import("../index").AvailabilityDto>;
|
|
186
|
+
/**
|
|
187
|
+
* Hook for artisan earnings
|
|
188
|
+
*/
|
|
189
|
+
export declare function useArtisanEarnings(): QueryResult<import("../index").EarningsSummaryDto>;
|
|
190
|
+
/**
|
|
191
|
+
* Hook for artisan performance
|
|
192
|
+
*/
|
|
193
|
+
export declare function useArtisanPerformance(): QueryResult<import("../index").PerformanceRatingDto>;
|
|
194
|
+
import type { JobFilterDto, ArtisanJobFilterDto } from '../types';
|
|
195
|
+
/**
|
|
196
|
+
* Hook for consumer jobs
|
|
197
|
+
*/
|
|
198
|
+
export declare function useConsumerJobs(params?: JobFilterDto): QueryResult<import("../index").PagedResult<import("../index").JobListItemDto>>;
|
|
199
|
+
/**
|
|
200
|
+
* Hook for artisan jobs
|
|
201
|
+
*/
|
|
202
|
+
export declare function useArtisanJobs(params?: ArtisanJobFilterDto): QueryResult<import("../index").PagedResult<import("../index").ArtisanJobDto>>;
|
|
203
|
+
/**
|
|
204
|
+
* Hook for a specific job
|
|
205
|
+
*/
|
|
206
|
+
export declare function useJob(jobId: string): QueryResult<import("../index").JobRequestDto>;
|
|
207
|
+
import type { ArtisanFilterDto, ConsumerFilterDto, ApplicationFilterDto } from '../types';
|
|
208
|
+
/**
|
|
209
|
+
* Hook for admin dashboard stats
|
|
210
|
+
*/
|
|
211
|
+
export declare function useDashboardStats(): QueryResult<import("../index").DashboardStatsDto>;
|
|
212
|
+
/**
|
|
213
|
+
* Hook for admin artisan list
|
|
214
|
+
*/
|
|
215
|
+
export declare function useAdminArtisans(params?: ArtisanFilterDto): QueryResult<import("../index").PagedResult<import("../index").AdminArtisanListItemDto>>;
|
|
216
|
+
/**
|
|
217
|
+
* Hook for admin consumer list
|
|
218
|
+
*/
|
|
219
|
+
export declare function useAdminConsumers(params?: ConsumerFilterDto): QueryResult<import("../index").PagedResult<import("../index").AdminConsumerListItemDto>>;
|
|
220
|
+
/**
|
|
221
|
+
* Hook for pending applications
|
|
222
|
+
*/
|
|
223
|
+
export declare function usePendingApplications(params?: ApplicationFilterDto): QueryResult<import("../index").PagedResult<import("../index").AdminArtisanListItemDto>>;
|
|
224
|
+
export {};
|
|
225
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAW,SAAS,EAA4B,MAAM,OAAO,CAAC;AAE1E,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAY3F;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,iBAAiB,CAAC;IAC1B,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,wBAAgB,aAAa,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,kBAAkB,GAAG,SAAS,CAiCjF;AAUD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,IAAI,WAAW,CAE5C;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,OAAO,CAE5C;AAID,UAAU,UAAU,CAAC,CAAC;IACp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wBAAgB,sBAAsB,oDAOrC;AAED;;GAEG;AACH,wBAAgB,kBAAkB,uDAOjC;AAED;;GAEG;AACH,wBAAgB,qBAAqB,yDAOpC;AAID,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAElE;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,CAAC,EAAE,YAAY,kFAOpD;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,MAAM,CAAC,EAAE,mBAAmB,iFAO1D;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,iDAOnC;AAID,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAE1F;;GAEG;AACH,wBAAgB,iBAAiB,sDAOhC;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,CAAC,EAAE,gBAAgB,2FAOzD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,CAAC,EAAE,iBAAiB,4FAO3D;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,CAAC,EAAE,oBAAoB,2FAOnE"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Osise API Client SDK
|
|
3
|
+
* Official TypeScript SDK for the Osise API
|
|
4
|
+
*
|
|
5
|
+
* @packageDocumentation
|
|
6
|
+
*/
|
|
7
|
+
import { HttpClient, OsiseApiError } from './utils/http-client';
|
|
8
|
+
import { TokenStorage } from './utils/storage';
|
|
9
|
+
import { AuthApi } from './api/auth';
|
|
10
|
+
import { ConsumersApi, ConsumerAddressesApi } from './api/consumers';
|
|
11
|
+
import { ArtisansApi, ArtisanAvailabilityApi, ArtisanEarningsApi, ArtisanPerformanceApi } from './api/artisans';
|
|
12
|
+
import { JobsApi, ArtisanJobsApi } from './api/jobs';
|
|
13
|
+
import { AdminArtisansApi, AdminApplicationsApi, AdminConsumersApi, AdminDashboardApi, AdminJobsApi } from './api/admin';
|
|
14
|
+
export * from './types';
|
|
15
|
+
export { OsiseApiError } from './utils/http-client';
|
|
16
|
+
export type { HttpClientConfig } from './utils/http-client';
|
|
17
|
+
export { HttpClient } from './utils/http-client';
|
|
18
|
+
export type { TokenStorage } from './utils/storage';
|
|
19
|
+
export { MemoryTokenStorage, BrowserTokenStorage, SecureTokenStorage } from './utils/storage';
|
|
20
|
+
export * from './api';
|
|
21
|
+
/**
|
|
22
|
+
* Configuration options for the Osise SDK
|
|
23
|
+
*/
|
|
24
|
+
export interface OsiseClientConfig {
|
|
25
|
+
/** Base URL for the API (e.g., 'https://api.osise.com') */
|
|
26
|
+
baseUrl: string;
|
|
27
|
+
/** Request timeout in milliseconds (default: 30000) */
|
|
28
|
+
timeout?: number;
|
|
29
|
+
/** Token storage implementation */
|
|
30
|
+
storage?: TokenStorage;
|
|
31
|
+
/** Custom headers to include with every request */
|
|
32
|
+
headers?: Record<string, string>;
|
|
33
|
+
/** Callback when an error occurs */
|
|
34
|
+
onError?: (error: OsiseApiError) => void;
|
|
35
|
+
/** Callback when tokens are refreshed */
|
|
36
|
+
onTokenRefresh?: (accessToken: string, refreshToken: string) => void;
|
|
37
|
+
/** Callback when auth is required (e.g., redirect to login) */
|
|
38
|
+
onAuthRequired?: () => void;
|
|
39
|
+
/** Enable automatic token refresh (default: true) */
|
|
40
|
+
autoRefresh?: boolean;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Main Osise API Client
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```typescript
|
|
47
|
+
* import { OsiseClient } from '@osise/api-client';
|
|
48
|
+
*
|
|
49
|
+
* const client = new OsiseClient({
|
|
50
|
+
* baseUrl: 'https://api.osise.com',
|
|
51
|
+
* });
|
|
52
|
+
*
|
|
53
|
+
* // Request OTP
|
|
54
|
+
* const response = await client.auth.requestOtp({
|
|
55
|
+
* phoneNumber: '+2348012345678',
|
|
56
|
+
* purpose: 'Login',
|
|
57
|
+
* });
|
|
58
|
+
*
|
|
59
|
+
* // Verify OTP and get tokens
|
|
60
|
+
* const authResponse = await client.auth.verifyOtp({
|
|
61
|
+
* phoneNumber: '+2348012345678',
|
|
62
|
+
* code: '123456',
|
|
63
|
+
* deviceId: 'unique-device-id',
|
|
64
|
+
* });
|
|
65
|
+
*
|
|
66
|
+
* // Access consumer features
|
|
67
|
+
* const profile = await client.consumers.getProfile();
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
export declare class OsiseClient {
|
|
71
|
+
private readonly http;
|
|
72
|
+
private readonly storage;
|
|
73
|
+
readonly auth: AuthApi;
|
|
74
|
+
readonly consumers: ConsumersApi;
|
|
75
|
+
readonly consumerAddresses: ConsumerAddressesApi;
|
|
76
|
+
readonly artisans: ArtisansApi;
|
|
77
|
+
readonly artisanAvailability: ArtisanAvailabilityApi;
|
|
78
|
+
readonly artisanEarnings: ArtisanEarningsApi;
|
|
79
|
+
readonly artisanPerformance: ArtisanPerformanceApi;
|
|
80
|
+
readonly jobs: JobsApi;
|
|
81
|
+
readonly artisanJobs: ArtisanJobsApi;
|
|
82
|
+
readonly adminArtisans: AdminArtisansApi;
|
|
83
|
+
readonly adminApplications: AdminApplicationsApi;
|
|
84
|
+
readonly adminConsumers: AdminConsumersApi;
|
|
85
|
+
readonly adminDashboard: AdminDashboardApi;
|
|
86
|
+
readonly adminJobs: AdminJobsApi;
|
|
87
|
+
constructor(config: OsiseClientConfig);
|
|
88
|
+
/**
|
|
89
|
+
* Set authentication tokens manually
|
|
90
|
+
*/
|
|
91
|
+
setTokens(accessToken: string, refreshToken: string): void;
|
|
92
|
+
/**
|
|
93
|
+
* Clear authentication tokens (logout)
|
|
94
|
+
*/
|
|
95
|
+
clearTokens(): void;
|
|
96
|
+
/**
|
|
97
|
+
* Check if user is authenticated
|
|
98
|
+
*/
|
|
99
|
+
isAuthenticated(): boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Get the current access token
|
|
102
|
+
*/
|
|
103
|
+
getAccessToken(): string | null;
|
|
104
|
+
/**
|
|
105
|
+
* Get the underlying HTTP client for advanced usage
|
|
106
|
+
*/
|
|
107
|
+
getHttpClient(): HttpClient;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Create an Osise client instance
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* ```typescript
|
|
114
|
+
* import { createOsiseClient, BrowserTokenStorage } from '@osise/api-client';
|
|
115
|
+
*
|
|
116
|
+
* const client = createOsiseClient({
|
|
117
|
+
* baseUrl: 'https://api.osise.com',
|
|
118
|
+
* storage: new BrowserTokenStorage(),
|
|
119
|
+
* onAuthRequired: () => {
|
|
120
|
+
* window.location.href = '/login';
|
|
121
|
+
* },
|
|
122
|
+
* });
|
|
123
|
+
* ```
|
|
124
|
+
*/
|
|
125
|
+
export declare function createOsiseClient(config: OsiseClientConfig): OsiseClient;
|
|
126
|
+
export default OsiseClient;
|
|
127
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAoB,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAClF,OAAO,EAAE,YAAY,EAAsB,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACrE,OAAO,EACL,WAAW,EACX,sBAAsB,EACtB,kBAAkB,EAClB,qBAAqB,EACtB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,EACjB,YAAY,EACb,MAAM,aAAa,CAAC;AAI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