tau-marketplace-sdk 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 ADDED
@@ -0,0 +1,124 @@
1
+ # TAU JavaScript SDK
2
+
3
+ The official JavaScript/TypeScript client for the TAU Service Marketplace API.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install tau-marketplace-sdk
9
+ # or
10
+ yarn add tau-marketplace-sdk
11
+ ```
12
+
13
+ ## Getting Started
14
+
15
+ Initialize the client with your API key. You can get an API key from the [Developer Portal](https://developers.tau.app).
16
+
17
+ ```typescript
18
+ import { TauClient } from 'tau-marketplace-sdk';
19
+
20
+ const client = new TauClient({
21
+ apiKey: 'tau_live_xxxxxxxxxxxxxxxxxxxxxxxx',
22
+ // Optional: Override base URL for testing or enterprise instances
23
+ // baseUrl: 'https://api.tau.app/api/v1'
24
+ });
25
+ ```
26
+
27
+ ## Usage
28
+
29
+ ### Services
30
+
31
+ List available services, search by category, or find nearest providers.
32
+
33
+ ```typescript
34
+ // List all services
35
+ const { data: services } = await client.services.list();
36
+
37
+ // Search services
38
+ const { data: results } = await client.services.list({
39
+ search: 'Plumbing',
40
+ categoryId: 'cat_123'
41
+ });
42
+
43
+ // Get service details
44
+ const { data: service } = await client.services.get('service_123');
45
+ ```
46
+
47
+ ### Providers
48
+
49
+ Find and view service providers.
50
+
51
+ ```typescript
52
+ // Find providers near a location
53
+ const { data: providers } = await client.providers.list({
54
+ latitude: 37.7749,
55
+ longitude: -122.4194,
56
+ radius: 5000 // 5km radius
57
+ });
58
+
59
+ // Get provider schedule/availability
60
+ const { data: slots } = await client.providers.availability('provider_123');
61
+ ```
62
+
63
+ ### Bookings
64
+
65
+ Manage bookings (create, list, cancel).
66
+
67
+ ```typescript
68
+ // Create a new booking
69
+ const { data: booking } = await client.bookings.create({
70
+ serviceId: 'service_123',
71
+ providerId: 'provider_123',
72
+ scheduledAt: '2024-03-20T10:00:00Z',
73
+ notes: 'Gate code is 1234'
74
+ });
75
+
76
+ // List my bookings (Consumer)
77
+ const { data: myBookings } = await client.bookings.list({ status: 'CONFIRMED' });
78
+
79
+ // Cancel a booking
80
+ await client.bookings.cancel('booking_123', 'Changed my mind');
81
+ ```
82
+
83
+ ### Authentication
84
+
85
+ If building a client-side app (like a mobile app), you can handle user auth directly.
86
+
87
+ ```typescript
88
+ // Login
89
+ const { data: session } = await client.auth.login('user@example.com', 'password123');
90
+ console.log(session.accessToken);
91
+
92
+ // Register
93
+ await client.auth.register({
94
+ firstName: 'John',
95
+ lastName: 'Doe',
96
+ email: 'john@example.com',
97
+ password: 'securePassword123'
98
+ });
99
+ ```
100
+
101
+ ## Error Handling
102
+
103
+ The SDK throws `TauApiError` for API errors.
104
+
105
+ ```typescript
106
+ import { TauClient, TauApiError } from '@tau/sdk';
107
+
108
+ try {
109
+ await client.bookings.create({ ... });
110
+ } catch (error) {
111
+ if (error instanceof TauApiError) {
112
+ console.error('API Error:', error.code, error.message);
113
+ if (error.details) {
114
+ console.error('Validation errors:', error.details);
115
+ }
116
+ } else {
117
+ console.error('Unknown error:', error);
118
+ }
119
+ }
120
+ ```
121
+
122
+ ## License
123
+
124
+ MIT
@@ -0,0 +1,178 @@
1
+ import { AxiosInstance } from 'axios';
2
+
3
+ interface TauClientConfig {
4
+ apiKey: string;
5
+ baseUrl?: string;
6
+ timeout?: number;
7
+ withCredentials?: boolean;
8
+ }
9
+ interface ApiResponse<T> {
10
+ success: boolean;
11
+ data?: T;
12
+ error?: {
13
+ code: string;
14
+ message: string;
15
+ details?: Record<string, unknown>;
16
+ };
17
+ meta?: {
18
+ page: number;
19
+ limit: number;
20
+ total: number;
21
+ totalPages: number;
22
+ };
23
+ }
24
+ interface PaginationParams {
25
+ skip?: number;
26
+ take?: number;
27
+ }
28
+ interface ServiceCategory {
29
+ id: string;
30
+ name: string;
31
+ slug: string;
32
+ description?: string;
33
+ icon?: string;
34
+ image?: string;
35
+ }
36
+ interface Service {
37
+ id: string;
38
+ providerId: string;
39
+ categoryId: string;
40
+ name: string;
41
+ description?: string;
42
+ basePrice: number;
43
+ currency: string;
44
+ duration: number;
45
+ images: string[];
46
+ isActive: boolean;
47
+ provider?: Provider;
48
+ }
49
+ interface Provider {
50
+ id: string;
51
+ businessName?: string;
52
+ bio?: string;
53
+ skills: string[];
54
+ rating: number;
55
+ totalReviews: number;
56
+ isVerified: boolean;
57
+ user: {
58
+ firstName: string;
59
+ lastName: string;
60
+ avatar?: string;
61
+ };
62
+ }
63
+ interface CreateBookingParams {
64
+ serviceId: string;
65
+ providerId: string;
66
+ scheduledAt: string;
67
+ addressId?: string;
68
+ notes?: string;
69
+ }
70
+ interface Booking {
71
+ id: string;
72
+ bookingNumber: string;
73
+ status: string;
74
+ scheduledAt: string;
75
+ totalAmount: number;
76
+ currency: string;
77
+ service: Service;
78
+ provider: Provider;
79
+ }
80
+ declare class ServicesResource {
81
+ private client;
82
+ constructor(client: AxiosInstance);
83
+ list(params?: PaginationParams & {
84
+ categoryId?: string;
85
+ providerId?: string;
86
+ search?: string;
87
+ minPrice?: number;
88
+ maxPrice?: number;
89
+ }): Promise<ApiResponse<Service[]>>;
90
+ get(id: string): Promise<ApiResponse<Service>>;
91
+ categories(): Promise<ApiResponse<ServiceCategory[]>>;
92
+ categoryBySlug(slug: string): Promise<ApiResponse<ServiceCategory & {
93
+ services: Service[];
94
+ }>>;
95
+ }
96
+ declare class ProvidersResource {
97
+ private client;
98
+ constructor(client: AxiosInstance);
99
+ list(params?: PaginationParams & {
100
+ categoryId?: string;
101
+ latitude?: number;
102
+ longitude?: number;
103
+ radius?: number;
104
+ minRating?: number;
105
+ isVerified?: boolean;
106
+ }): Promise<ApiResponse<Provider[]>>;
107
+ get(id: string): Promise<ApiResponse<Provider>>;
108
+ availability(id: string): Promise<ApiResponse<any[]>>;
109
+ }
110
+ declare class BookingsResource {
111
+ private client;
112
+ constructor(client: AxiosInstance);
113
+ create(params: CreateBookingParams): Promise<ApiResponse<Booking>>;
114
+ get(id: string): Promise<ApiResponse<Booking>>;
115
+ list(params?: PaginationParams & {
116
+ status?: string;
117
+ }): Promise<ApiResponse<Booking[]>>;
118
+ cancel(id: string, reason?: string): Promise<ApiResponse<Booking>>;
119
+ listAssigned(params?: PaginationParams & {
120
+ status?: string;
121
+ }): Promise<ApiResponse<Booking[]>>;
122
+ updateStatus(id: string, status: string): Promise<ApiResponse<Booking>>;
123
+ listAll(params?: PaginationParams & {
124
+ status?: string;
125
+ }): Promise<ApiResponse<Booking[]>>;
126
+ }
127
+ declare class UsersResource {
128
+ private client;
129
+ constructor(client: AxiosInstance);
130
+ list(params?: PaginationParams & {
131
+ role?: string;
132
+ search?: string;
133
+ }): Promise<ApiResponse<any[]>>;
134
+ updateStatus(id: string, status: string): Promise<ApiResponse<any>>;
135
+ }
136
+ declare class AuthResource {
137
+ private client;
138
+ constructor(client: AxiosInstance);
139
+ login(email: string, password: string): Promise<ApiResponse<{
140
+ accessToken: string;
141
+ refreshToken: string;
142
+ user: any;
143
+ }>>;
144
+ register(data: {
145
+ email: string;
146
+ password: string;
147
+ firstName: string;
148
+ lastName: string;
149
+ phone?: string;
150
+ }): Promise<ApiResponse<{
151
+ accessToken: string;
152
+ refreshToken: string;
153
+ user: any;
154
+ }>>;
155
+ logout(refreshToken: string): Promise<ApiResponse<void>>;
156
+ refresh(refreshToken: string): Promise<ApiResponse<{
157
+ accessToken: string;
158
+ refreshToken: string;
159
+ }>>;
160
+ getProfile(): Promise<ApiResponse<any>>;
161
+ }
162
+ declare class TauClient {
163
+ client: AxiosInstance;
164
+ services: ServicesResource;
165
+ providers: ProvidersResource;
166
+ bookings: BookingsResource;
167
+ auth: AuthResource;
168
+ users: UsersResource;
169
+ constructor(config: TauClientConfig);
170
+ }
171
+ declare class TauApiError extends Error {
172
+ code: string;
173
+ statusCode: number;
174
+ details?: Record<string, unknown> | undefined;
175
+ constructor(message: string, code: string, statusCode: number, details?: Record<string, unknown> | undefined);
176
+ }
177
+
178
+ export { type ApiResponse, type Booking, type CreateBookingParams, type PaginationParams, type Provider, type Service, type ServiceCategory, TauApiError, TauClient, type TauClientConfig, TauClient as default };
@@ -0,0 +1,178 @@
1
+ import { AxiosInstance } from 'axios';
2
+
3
+ interface TauClientConfig {
4
+ apiKey: string;
5
+ baseUrl?: string;
6
+ timeout?: number;
7
+ withCredentials?: boolean;
8
+ }
9
+ interface ApiResponse<T> {
10
+ success: boolean;
11
+ data?: T;
12
+ error?: {
13
+ code: string;
14
+ message: string;
15
+ details?: Record<string, unknown>;
16
+ };
17
+ meta?: {
18
+ page: number;
19
+ limit: number;
20
+ total: number;
21
+ totalPages: number;
22
+ };
23
+ }
24
+ interface PaginationParams {
25
+ skip?: number;
26
+ take?: number;
27
+ }
28
+ interface ServiceCategory {
29
+ id: string;
30
+ name: string;
31
+ slug: string;
32
+ description?: string;
33
+ icon?: string;
34
+ image?: string;
35
+ }
36
+ interface Service {
37
+ id: string;
38
+ providerId: string;
39
+ categoryId: string;
40
+ name: string;
41
+ description?: string;
42
+ basePrice: number;
43
+ currency: string;
44
+ duration: number;
45
+ images: string[];
46
+ isActive: boolean;
47
+ provider?: Provider;
48
+ }
49
+ interface Provider {
50
+ id: string;
51
+ businessName?: string;
52
+ bio?: string;
53
+ skills: string[];
54
+ rating: number;
55
+ totalReviews: number;
56
+ isVerified: boolean;
57
+ user: {
58
+ firstName: string;
59
+ lastName: string;
60
+ avatar?: string;
61
+ };
62
+ }
63
+ interface CreateBookingParams {
64
+ serviceId: string;
65
+ providerId: string;
66
+ scheduledAt: string;
67
+ addressId?: string;
68
+ notes?: string;
69
+ }
70
+ interface Booking {
71
+ id: string;
72
+ bookingNumber: string;
73
+ status: string;
74
+ scheduledAt: string;
75
+ totalAmount: number;
76
+ currency: string;
77
+ service: Service;
78
+ provider: Provider;
79
+ }
80
+ declare class ServicesResource {
81
+ private client;
82
+ constructor(client: AxiosInstance);
83
+ list(params?: PaginationParams & {
84
+ categoryId?: string;
85
+ providerId?: string;
86
+ search?: string;
87
+ minPrice?: number;
88
+ maxPrice?: number;
89
+ }): Promise<ApiResponse<Service[]>>;
90
+ get(id: string): Promise<ApiResponse<Service>>;
91
+ categories(): Promise<ApiResponse<ServiceCategory[]>>;
92
+ categoryBySlug(slug: string): Promise<ApiResponse<ServiceCategory & {
93
+ services: Service[];
94
+ }>>;
95
+ }
96
+ declare class ProvidersResource {
97
+ private client;
98
+ constructor(client: AxiosInstance);
99
+ list(params?: PaginationParams & {
100
+ categoryId?: string;
101
+ latitude?: number;
102
+ longitude?: number;
103
+ radius?: number;
104
+ minRating?: number;
105
+ isVerified?: boolean;
106
+ }): Promise<ApiResponse<Provider[]>>;
107
+ get(id: string): Promise<ApiResponse<Provider>>;
108
+ availability(id: string): Promise<ApiResponse<any[]>>;
109
+ }
110
+ declare class BookingsResource {
111
+ private client;
112
+ constructor(client: AxiosInstance);
113
+ create(params: CreateBookingParams): Promise<ApiResponse<Booking>>;
114
+ get(id: string): Promise<ApiResponse<Booking>>;
115
+ list(params?: PaginationParams & {
116
+ status?: string;
117
+ }): Promise<ApiResponse<Booking[]>>;
118
+ cancel(id: string, reason?: string): Promise<ApiResponse<Booking>>;
119
+ listAssigned(params?: PaginationParams & {
120
+ status?: string;
121
+ }): Promise<ApiResponse<Booking[]>>;
122
+ updateStatus(id: string, status: string): Promise<ApiResponse<Booking>>;
123
+ listAll(params?: PaginationParams & {
124
+ status?: string;
125
+ }): Promise<ApiResponse<Booking[]>>;
126
+ }
127
+ declare class UsersResource {
128
+ private client;
129
+ constructor(client: AxiosInstance);
130
+ list(params?: PaginationParams & {
131
+ role?: string;
132
+ search?: string;
133
+ }): Promise<ApiResponse<any[]>>;
134
+ updateStatus(id: string, status: string): Promise<ApiResponse<any>>;
135
+ }
136
+ declare class AuthResource {
137
+ private client;
138
+ constructor(client: AxiosInstance);
139
+ login(email: string, password: string): Promise<ApiResponse<{
140
+ accessToken: string;
141
+ refreshToken: string;
142
+ user: any;
143
+ }>>;
144
+ register(data: {
145
+ email: string;
146
+ password: string;
147
+ firstName: string;
148
+ lastName: string;
149
+ phone?: string;
150
+ }): Promise<ApiResponse<{
151
+ accessToken: string;
152
+ refreshToken: string;
153
+ user: any;
154
+ }>>;
155
+ logout(refreshToken: string): Promise<ApiResponse<void>>;
156
+ refresh(refreshToken: string): Promise<ApiResponse<{
157
+ accessToken: string;
158
+ refreshToken: string;
159
+ }>>;
160
+ getProfile(): Promise<ApiResponse<any>>;
161
+ }
162
+ declare class TauClient {
163
+ client: AxiosInstance;
164
+ services: ServicesResource;
165
+ providers: ProvidersResource;
166
+ bookings: BookingsResource;
167
+ auth: AuthResource;
168
+ users: UsersResource;
169
+ constructor(config: TauClientConfig);
170
+ }
171
+ declare class TauApiError extends Error {
172
+ code: string;
173
+ statusCode: number;
174
+ details?: Record<string, unknown> | undefined;
175
+ constructor(message: string, code: string, statusCode: number, details?: Record<string, unknown> | undefined);
176
+ }
177
+
178
+ export { type ApiResponse, type Booking, type CreateBookingParams, type PaginationParams, type Provider, type Service, type ServiceCategory, TauApiError, TauClient, type TauClientConfig, TauClient as default };
package/dist/index.js ADDED
@@ -0,0 +1,205 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.ts
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ TauApiError: () => TauApiError,
34
+ TauClient: () => TauClient,
35
+ default: () => index_default
36
+ });
37
+ module.exports = __toCommonJS(index_exports);
38
+ var import_axios = __toESM(require("axios"));
39
+ var ServicesResource = class {
40
+ constructor(client) {
41
+ this.client = client;
42
+ }
43
+ async list(params) {
44
+ const { data } = await this.client.get("/services", { params });
45
+ return data;
46
+ }
47
+ async get(id) {
48
+ const { data } = await this.client.get(`/services/${id}`);
49
+ return data;
50
+ }
51
+ async categories() {
52
+ const { data } = await this.client.get("/services/categories");
53
+ return data;
54
+ }
55
+ async categoryBySlug(slug) {
56
+ const { data } = await this.client.get(`/services/categories/${slug}`);
57
+ return data;
58
+ }
59
+ };
60
+ var ProvidersResource = class {
61
+ constructor(client) {
62
+ this.client = client;
63
+ }
64
+ async list(params) {
65
+ const { data } = await this.client.get("/providers", { params });
66
+ return data;
67
+ }
68
+ async get(id) {
69
+ const { data } = await this.client.get(`/providers/${id}`);
70
+ return data;
71
+ }
72
+ async availability(id) {
73
+ const { data } = await this.client.get(`/providers/${id}/availability`);
74
+ return data;
75
+ }
76
+ };
77
+ var BookingsResource = class {
78
+ constructor(client) {
79
+ this.client = client;
80
+ }
81
+ async create(params) {
82
+ const { data } = await this.client.post("/bookings", params);
83
+ return data;
84
+ }
85
+ async get(id) {
86
+ const { data } = await this.client.get(`/bookings/${id}`);
87
+ return data;
88
+ }
89
+ async list(params) {
90
+ const { data } = await this.client.get("/bookings/consumer", { params });
91
+ return data;
92
+ }
93
+ async cancel(id, reason) {
94
+ const { data } = await this.client.patch(`/bookings/${id}/status`, {
95
+ status: "CANCELLED",
96
+ cancellationReason: reason
97
+ });
98
+ return data;
99
+ }
100
+ async listAssigned(params) {
101
+ const { data } = await this.client.get("/bookings/provider", { params });
102
+ return data;
103
+ }
104
+ async updateStatus(id, status) {
105
+ const { data } = await this.client.patch(`/bookings/${id}/status`, { status });
106
+ return data;
107
+ }
108
+ async listAll(params) {
109
+ const { data } = await this.client.get("/bookings/admin", { params });
110
+ return data;
111
+ }
112
+ };
113
+ var UsersResource = class {
114
+ constructor(client) {
115
+ this.client = client;
116
+ }
117
+ async list(params) {
118
+ const { data } = await this.client.get("/users", { params });
119
+ return data;
120
+ }
121
+ async updateStatus(id, status) {
122
+ const { data } = await this.client.patch(`/users/${id}/status`, { status });
123
+ return data;
124
+ }
125
+ };
126
+ var AuthResource = class {
127
+ constructor(client) {
128
+ this.client = client;
129
+ }
130
+ async login(email, password) {
131
+ const { data } = await this.client.post("/auth/login", { email, password });
132
+ return data;
133
+ }
134
+ async register(data) {
135
+ const { data: response } = await this.client.post("/auth/register", data);
136
+ return response;
137
+ }
138
+ async logout(refreshToken) {
139
+ const { data } = await this.client.post("/auth/logout", { refreshToken });
140
+ return data;
141
+ }
142
+ async refresh(refreshToken) {
143
+ const { data } = await this.client.post("/auth/refresh", { refreshToken });
144
+ return data;
145
+ }
146
+ async getProfile() {
147
+ const { data } = await this.client.get("/auth/profile");
148
+ return data;
149
+ }
150
+ };
151
+ var TauClient = class {
152
+ client;
153
+ services;
154
+ providers;
155
+ bookings;
156
+ auth;
157
+ users;
158
+ constructor(config) {
159
+ this.client = import_axios.default.create({
160
+ baseURL: config.baseUrl || "https://api.tau.app/api/v1",
161
+ timeout: config.timeout || 3e4,
162
+ withCredentials: config.withCredentials,
163
+ headers: {
164
+ "Content-Type": "application/json",
165
+ "X-API-Key": config.apiKey
166
+ }
167
+ });
168
+ this.client.interceptors.response.use(
169
+ (response) => response,
170
+ (error) => {
171
+ if (error.response) {
172
+ const apiError = error.response.data;
173
+ throw new TauApiError(
174
+ apiError.error?.message || error.message,
175
+ apiError.error?.code || "UNKNOWN_ERROR",
176
+ error.response.status,
177
+ apiError.error?.details
178
+ );
179
+ }
180
+ throw new TauApiError(error.message, "NETWORK_ERROR", 0);
181
+ }
182
+ );
183
+ this.services = new ServicesResource(this.client);
184
+ this.providers = new ProvidersResource(this.client);
185
+ this.bookings = new BookingsResource(this.client);
186
+ this.auth = new AuthResource(this.client);
187
+ this.users = new UsersResource(this.client);
188
+ }
189
+ };
190
+ var TauApiError = class extends Error {
191
+ constructor(message, code, statusCode, details) {
192
+ super(message);
193
+ this.code = code;
194
+ this.statusCode = statusCode;
195
+ this.details = details;
196
+ this.name = "TauApiError";
197
+ }
198
+ };
199
+ var index_default = TauClient;
200
+ // Annotate the CommonJS export names for ESM import in node:
201
+ 0 && (module.exports = {
202
+ TauApiError,
203
+ TauClient
204
+ });
205
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import axios, { AxiosInstance, AxiosError, AxiosRequestConfig } from 'axios';\n\nexport interface TauClientConfig {\n apiKey: string;\n baseUrl?: string;\n timeout?: number;\n withCredentials?: boolean;\n}\n\nexport interface ApiResponse<T> {\n success: boolean;\n data?: T;\n error?: {\n code: string;\n message: string;\n details?: Record<string, unknown>;\n };\n meta?: {\n page: number;\n limit: number;\n total: number;\n totalPages: number;\n };\n}\n\nexport interface PaginationParams {\n skip?: number;\n take?: number;\n}\n\n// Service Types\nexport interface ServiceCategory {\n id: string;\n name: string;\n slug: string;\n description?: string;\n icon?: string;\n image?: string;\n}\n\nexport interface Service {\n id: string;\n providerId: string;\n categoryId: string;\n name: string;\n description?: string;\n basePrice: number;\n currency: string;\n duration: number;\n images: string[];\n isActive: boolean;\n provider?: Provider;\n}\n\nexport interface Provider {\n id: string;\n businessName?: string;\n bio?: string;\n skills: string[];\n rating: number;\n totalReviews: number;\n isVerified: boolean;\n user: {\n firstName: string;\n lastName: string;\n avatar?: string;\n };\n}\n\n// Booking Types\nexport interface CreateBookingParams {\n serviceId: string;\n providerId: string;\n scheduledAt: string;\n addressId?: string;\n notes?: string;\n}\n\nexport interface Booking {\n id: string;\n bookingNumber: string;\n status: string;\n scheduledAt: string;\n totalAmount: number;\n currency: string;\n service: Service;\n provider: Provider;\n}\n\n// Resources\nclass ServicesResource {\n constructor(private client: AxiosInstance) { }\n\n async list(params?: PaginationParams & {\n categoryId?: string;\n providerId?: string;\n search?: string;\n minPrice?: number;\n maxPrice?: number;\n }): Promise<ApiResponse<Service[]>> {\n const { data } = await this.client.get('/services', { params });\n return data;\n }\n\n async get(id: string): Promise<ApiResponse<Service>> {\n const { data } = await this.client.get(`/services/${id}`);\n return data;\n }\n\n async categories(): Promise<ApiResponse<ServiceCategory[]>> {\n const { data } = await this.client.get('/services/categories');\n return data;\n }\n\n async categoryBySlug(slug: string): Promise<ApiResponse<ServiceCategory & { services: Service[] }>> {\n const { data } = await this.client.get(`/services/categories/${slug}`);\n return data;\n }\n}\n\nclass ProvidersResource {\n constructor(private client: AxiosInstance) { }\n\n async list(params?: PaginationParams & {\n categoryId?: string;\n latitude?: number;\n longitude?: number;\n radius?: number;\n minRating?: number;\n isVerified?: boolean;\n }): Promise<ApiResponse<Provider[]>> {\n const { data } = await this.client.get('/providers', { params });\n return data;\n }\n\n async get(id: string): Promise<ApiResponse<Provider>> {\n const { data } = await this.client.get(`/providers/${id}`);\n return data;\n }\n\n async availability(id: string): Promise<ApiResponse<any[]>> {\n const { data } = await this.client.get(`/providers/${id}/availability`);\n return data;\n }\n}\n\nclass BookingsResource {\n constructor(private client: AxiosInstance) { }\n\n async create(params: CreateBookingParams): Promise<ApiResponse<Booking>> {\n const { data } = await this.client.post('/bookings', params);\n return data;\n }\n\n async get(id: string): Promise<ApiResponse<Booking>> {\n const { data } = await this.client.get(`/bookings/${id}`);\n return data;\n }\n\n async list(params?: PaginationParams & { status?: string }): Promise<ApiResponse<Booking[]>> {\n const { data } = await this.client.get('/bookings/consumer', { params });\n return data;\n }\n\n async cancel(id: string, reason?: string): Promise<ApiResponse<Booking>> {\n const { data } = await this.client.patch(`/bookings/${id}/status`, {\n status: 'CANCELLED',\n cancellationReason: reason,\n });\n return data;\n }\n\n async listAssigned(params?: PaginationParams & { status?: string }): Promise<ApiResponse<Booking[]>> {\n const { data } = await this.client.get('/bookings/provider', { params });\n return data;\n }\n\n async updateStatus(id: string, status: string): Promise<ApiResponse<Booking>> {\n const { data } = await this.client.patch(`/bookings/${id}/status`, { status });\n return data;\n }\n\n async listAll(params?: PaginationParams & { status?: string }): Promise<ApiResponse<Booking[]>> {\n const { data } = await this.client.get('/bookings/admin', { params });\n return data;\n }\n}\n\nclass UsersResource {\n constructor(private client: AxiosInstance) { }\n\n async list(params?: PaginationParams & { role?: string; search?: string }): Promise<ApiResponse<any[]>> {\n const { data } = await this.client.get('/users', { params });\n return data;\n }\n\n async updateStatus(id: string, status: string): Promise<ApiResponse<any>> {\n const { data } = await this.client.patch(`/users/${id}/status`, { status });\n return data;\n }\n}\n\nclass AuthResource {\n constructor(private client: AxiosInstance) { }\n\n async login(email: string, password: string): Promise<ApiResponse<{ accessToken: string; refreshToken: string; user: any }>> {\n const { data } = await this.client.post('/auth/login', { email, password });\n return data;\n }\n\n async register(data: { email: string; password: string; firstName: string; lastName: string; phone?: string }): Promise<ApiResponse<{ accessToken: string; refreshToken: string; user: any }>> {\n const { data: response } = await this.client.post('/auth/register', data);\n return response;\n }\n\n async logout(refreshToken: string): Promise<ApiResponse<void>> {\n const { data } = await this.client.post('/auth/logout', { refreshToken });\n return data;\n }\n\n async refresh(refreshToken: string): Promise<ApiResponse<{ accessToken: string; refreshToken: string }>> {\n const { data } = await this.client.post('/auth/refresh', { refreshToken });\n return data;\n }\n\n async getProfile(): Promise<ApiResponse<any>> {\n const { data } = await this.client.get('/auth/profile');\n return data;\n }\n}\n\n// Main Client\nexport class TauClient {\n public client: AxiosInstance;\n\n public services: ServicesResource;\n public providers: ProvidersResource;\n public bookings: BookingsResource;\n public auth: AuthResource;\n public users: UsersResource;\n\n constructor(config: TauClientConfig) {\n this.client = axios.create({\n baseURL: config.baseUrl || 'https://api.tau.app/api/v1',\n timeout: config.timeout || 30000,\n withCredentials: config.withCredentials,\n headers: {\n 'Content-Type': 'application/json',\n 'X-API-Key': config.apiKey,\n },\n });\n\n // Add response interceptor for error handling\n this.client.interceptors.response.use(\n (response) => response,\n (error: AxiosError) => {\n if (error.response) {\n const apiError = error.response.data as any;\n throw new TauApiError(\n apiError.error?.message || error.message,\n apiError.error?.code || 'UNKNOWN_ERROR',\n error.response.status,\n apiError.error?.details,\n );\n }\n throw new TauApiError(error.message, 'NETWORK_ERROR', 0);\n },\n );\n\n // Initialize resources\n this.services = new ServicesResource(this.client);\n this.providers = new ProvidersResource(this.client);\n this.bookings = new BookingsResource(this.client);\n this.auth = new AuthResource(this.client);\n this.users = new UsersResource(this.client);\n }\n}\n\n// Error class\nexport class TauApiError extends Error {\n constructor(\n message: string,\n public code: string,\n public statusCode: number,\n public details?: Record<string, unknown>,\n ) {\n super(message);\n this.name = 'TauApiError';\n }\n}\n\n// Default export\nexport default TauClient;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAqE;AA0FrE,IAAM,mBAAN,MAAuB;AAAA,EACnB,YAAoB,QAAuB;AAAvB;AAAA,EAAyB;AAAA,EAE7C,MAAM,KAAK,QAMyB;AAChC,UAAM,EAAE,KAAK,IAAI,MAAM,KAAK,OAAO,IAAI,aAAa,EAAE,OAAO,CAAC;AAC9D,WAAO;AAAA,EACX;AAAA,EAEA,MAAM,IAAI,IAA2C;AACjD,UAAM,EAAE,KAAK,IAAI,MAAM,KAAK,OAAO,IAAI,aAAa,EAAE,EAAE;AACxD,WAAO;A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,SAAK,WAAW,IAAI,iBAAiB,KAAK,MAAM;AAChD,SAAK,OAAO,IAAI,aAAa,KAAK,MAAM;AACxC,SAAK,QAAQ,IAAI,cAAc,KAAK,MAAM;AAAA,EAC9C;AACJ;AAGO,IAAM,cAAN,cAA0B,MAAM;AAAA,EACnC,YACI,SACO,MACA,YACA,SACT;AACE,UAAM,OAAO;AAJN;AACA;AACA;AAGP,SAAK,OAAO;AAAA,EAChB;AACJ;AAGA,IAAO,gBAAQ;","names":["axios"]}
package/dist/index.mjs ADDED
@@ -0,0 +1,169 @@
1
+ // src/index.ts
2
+ import axios from "axios";
3
+ var ServicesResource = class {
4
+ constructor(client) {
5
+ this.client = client;
6
+ }
7
+ async list(params) {
8
+ const { data } = await this.client.get("/services", { params });
9
+ return data;
10
+ }
11
+ async get(id) {
12
+ const { data } = await this.client.get(`/services/${id}`);
13
+ return data;
14
+ }
15
+ async categories() {
16
+ const { data } = await this.client.get("/services/categories");
17
+ return data;
18
+ }
19
+ async categoryBySlug(slug) {
20
+ const { data } = await this.client.get(`/services/categories/${slug}`);
21
+ return data;
22
+ }
23
+ };
24
+ var ProvidersResource = class {
25
+ constructor(client) {
26
+ this.client = client;
27
+ }
28
+ async list(params) {
29
+ const { data } = await this.client.get("/providers", { params });
30
+ return data;
31
+ }
32
+ async get(id) {
33
+ const { data } = await this.client.get(`/providers/${id}`);
34
+ return data;
35
+ }
36
+ async availability(id) {
37
+ const { data } = await this.client.get(`/providers/${id}/availability`);
38
+ return data;
39
+ }
40
+ };
41
+ var BookingsResource = class {
42
+ constructor(client) {
43
+ this.client = client;
44
+ }
45
+ async create(params) {
46
+ const { data } = await this.client.post("/bookings", params);
47
+ return data;
48
+ }
49
+ async get(id) {
50
+ const { data } = await this.client.get(`/bookings/${id}`);
51
+ return data;
52
+ }
53
+ async list(params) {
54
+ const { data } = await this.client.get("/bookings/consumer", { params });
55
+ return data;
56
+ }
57
+ async cancel(id, reason) {
58
+ const { data } = await this.client.patch(`/bookings/${id}/status`, {
59
+ status: "CANCELLED",
60
+ cancellationReason: reason
61
+ });
62
+ return data;
63
+ }
64
+ async listAssigned(params) {
65
+ const { data } = await this.client.get("/bookings/provider", { params });
66
+ return data;
67
+ }
68
+ async updateStatus(id, status) {
69
+ const { data } = await this.client.patch(`/bookings/${id}/status`, { status });
70
+ return data;
71
+ }
72
+ async listAll(params) {
73
+ const { data } = await this.client.get("/bookings/admin", { params });
74
+ return data;
75
+ }
76
+ };
77
+ var UsersResource = class {
78
+ constructor(client) {
79
+ this.client = client;
80
+ }
81
+ async list(params) {
82
+ const { data } = await this.client.get("/users", { params });
83
+ return data;
84
+ }
85
+ async updateStatus(id, status) {
86
+ const { data } = await this.client.patch(`/users/${id}/status`, { status });
87
+ return data;
88
+ }
89
+ };
90
+ var AuthResource = class {
91
+ constructor(client) {
92
+ this.client = client;
93
+ }
94
+ async login(email, password) {
95
+ const { data } = await this.client.post("/auth/login", { email, password });
96
+ return data;
97
+ }
98
+ async register(data) {
99
+ const { data: response } = await this.client.post("/auth/register", data);
100
+ return response;
101
+ }
102
+ async logout(refreshToken) {
103
+ const { data } = await this.client.post("/auth/logout", { refreshToken });
104
+ return data;
105
+ }
106
+ async refresh(refreshToken) {
107
+ const { data } = await this.client.post("/auth/refresh", { refreshToken });
108
+ return data;
109
+ }
110
+ async getProfile() {
111
+ const { data } = await this.client.get("/auth/profile");
112
+ return data;
113
+ }
114
+ };
115
+ var TauClient = class {
116
+ client;
117
+ services;
118
+ providers;
119
+ bookings;
120
+ auth;
121
+ users;
122
+ constructor(config) {
123
+ this.client = axios.create({
124
+ baseURL: config.baseUrl || "https://api.tau.app/api/v1",
125
+ timeout: config.timeout || 3e4,
126
+ withCredentials: config.withCredentials,
127
+ headers: {
128
+ "Content-Type": "application/json",
129
+ "X-API-Key": config.apiKey
130
+ }
131
+ });
132
+ this.client.interceptors.response.use(
133
+ (response) => response,
134
+ (error) => {
135
+ if (error.response) {
136
+ const apiError = error.response.data;
137
+ throw new TauApiError(
138
+ apiError.error?.message || error.message,
139
+ apiError.error?.code || "UNKNOWN_ERROR",
140
+ error.response.status,
141
+ apiError.error?.details
142
+ );
143
+ }
144
+ throw new TauApiError(error.message, "NETWORK_ERROR", 0);
145
+ }
146
+ );
147
+ this.services = new ServicesResource(this.client);
148
+ this.providers = new ProvidersResource(this.client);
149
+ this.bookings = new BookingsResource(this.client);
150
+ this.auth = new AuthResource(this.client);
151
+ this.users = new UsersResource(this.client);
152
+ }
153
+ };
154
+ var TauApiError = class extends Error {
155
+ constructor(message, code, statusCode, details) {
156
+ super(message);
157
+ this.code = code;
158
+ this.statusCode = statusCode;
159
+ this.details = details;
160
+ this.name = "TauApiError";
161
+ }
162
+ };
163
+ var index_default = TauClient;
164
+ export {
165
+ TauApiError,
166
+ TauClient,
167
+ index_default as default
168
+ };
169
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import axios, { AxiosInstance, AxiosError, AxiosRequestConfig } from 'axios';\n\nexport interface TauClientConfig {\n apiKey: string;\n baseUrl?: string;\n timeout?: number;\n withCredentials?: boolean;\n}\n\nexport interface ApiResponse<T> {\n success: boolean;\n data?: T;\n error?: {\n code: string;\n message: string;\n details?: Record<string, unknown>;\n };\n meta?: {\n page: number;\n limit: number;\n total: number;\n totalPages: number;\n };\n}\n\nexport interface PaginationParams {\n skip?: number;\n take?: number;\n}\n\n// Service Types\nexport interface ServiceCategory {\n id: string;\n name: string;\n slug: string;\n description?: string;\n icon?: string;\n image?: string;\n}\n\nexport interface Service {\n id: string;\n providerId: string;\n categoryId: string;\n name: string;\n description?: string;\n basePrice: number;\n currency: string;\n duration: number;\n images: string[];\n isActive: boolean;\n provider?: Provider;\n}\n\nexport interface Provider {\n id: string;\n businessName?: string;\n bio?: string;\n skills: string[];\n rating: number;\n totalReviews: number;\n isVerified: boolean;\n user: {\n firstName: string;\n lastName: string;\n avatar?: string;\n };\n}\n\n// Booking Types\nexport interface CreateBookingParams {\n serviceId: string;\n providerId: string;\n scheduledAt: string;\n addressId?: string;\n notes?: string;\n}\n\nexport interface Booking {\n id: string;\n bookingNumber: string;\n status: string;\n scheduledAt: string;\n totalAmount: number;\n currency: string;\n service: Service;\n provider: Provider;\n}\n\n// Resources\nclass ServicesResource {\n constructor(private client: AxiosInstance) { }\n\n async list(params?: PaginationParams & {\n categoryId?: string;\n providerId?: string;\n search?: string;\n minPrice?: number;\n maxPrice?: number;\n }): Promise<ApiResponse<Service[]>> {\n const { data } = await this.client.get('/services', { params });\n return data;\n }\n\n async get(id: string): Promise<ApiResponse<Service>> {\n const { data } = await this.client.get(`/services/${id}`);\n return data;\n }\n\n async categories(): Promise<ApiResponse<ServiceCategory[]>> {\n const { data } = await this.client.get('/services/categories');\n return data;\n }\n\n async categoryBySlug(slug: string): Promise<ApiResponse<ServiceCategory & { services: Service[] }>> {\n const { data } = await this.client.get(`/services/categories/${slug}`);\n return data;\n }\n}\n\nclass ProvidersResource {\n constructor(private client: AxiosInstance) { }\n\n async list(params?: PaginationParams & {\n categoryId?: string;\n latitude?: number;\n longitude?: number;\n radius?: number;\n minRating?: number;\n isVerified?: boolean;\n }): Promise<ApiResponse<Provider[]>> {\n const { data } = await this.client.get('/providers', { params });\n return data;\n }\n\n async get(id: string): Promise<ApiResponse<Provider>> {\n const { data } = await this.client.get(`/providers/${id}`);\n return data;\n }\n\n async availability(id: string): Promise<ApiResponse<any[]>> {\n const { data } = await this.client.get(`/providers/${id}/availability`);\n return data;\n }\n}\n\nclass BookingsResource {\n constructor(private client: AxiosInstance) { }\n\n async create(params: CreateBookingParams): Promise<ApiResponse<Booking>> {\n const { data } = await this.client.post('/bookings', params);\n return data;\n }\n\n async get(id: string): Promise<ApiResponse<Booking>> {\n const { data } = await this.client.get(`/bookings/${id}`);\n return data;\n }\n\n async list(params?: PaginationParams & { status?: string }): Promise<ApiResponse<Booking[]>> {\n const { data } = await this.client.get('/bookings/consumer', { params });\n return data;\n }\n\n async cancel(id: string, reason?: string): Promise<ApiResponse<Booking>> {\n const { data } = await this.client.patch(`/bookings/${id}/status`, {\n status: 'CANCELLED',\n cancellationReason: reason,\n });\n return data;\n }\n\n async listAssigned(params?: PaginationParams & { status?: string }): Promise<ApiResponse<Booking[]>> {\n const { data } = await this.client.get('/bookings/provider', { params });\n return data;\n }\n\n async updateStatus(id: string, status: string): Promise<ApiResponse<Booking>> {\n const { data } = await this.client.patch(`/bookings/${id}/status`, { status });\n return data;\n }\n\n async listAll(params?: PaginationParams & { status?: string }): Promise<ApiResponse<Booking[]>> {\n const { data } = await this.client.get('/bookings/admin', { params });\n return data;\n }\n}\n\nclass UsersResource {\n constructor(private client: AxiosInstance) { }\n\n async list(params?: PaginationParams & { role?: string; search?: string }): Promise<ApiResponse<any[]>> {\n const { data } = await this.client.get('/users', { params });\n return data;\n }\n\n async updateStatus(id: string, status: string): Promise<ApiResponse<any>> {\n const { data } = await this.client.patch(`/users/${id}/status`, { status });\n return data;\n }\n}\n\nclass AuthResource {\n constructor(private client: AxiosInstance) { }\n\n async login(email: string, password: string): Promise<ApiResponse<{ accessToken: string; refreshToken: string; user: any }>> {\n const { data } = await this.client.post('/auth/login', { email, password });\n return data;\n }\n\n async register(data: { email: string; password: string; firstName: string; lastName: string; phone?: string }): Promise<ApiResponse<{ accessToken: string; refreshToken: string; user: any }>> {\n const { data: response } = await this.client.post('/auth/register', data);\n return response;\n }\n\n async logout(refreshToken: string): Promise<ApiResponse<void>> {\n const { data } = await this.client.post('/auth/logout', { refreshToken });\n return data;\n }\n\n async refresh(refreshToken: string): Promise<ApiResponse<{ accessToken: string; refreshToken: string }>> {\n const { data } = await this.client.post('/auth/refresh', { refreshToken });\n return data;\n }\n\n async getProfile(): Promise<ApiResponse<any>> {\n const { data } = await this.client.get('/auth/profile');\n return data;\n }\n}\n\n// Main Client\nexport class TauClient {\n public client: AxiosInstance;\n\n public services: ServicesResource;\n public providers: ProvidersResource;\n public bookings: BookingsResource;\n public auth: AuthResource;\n public users: UsersResource;\n\n constructor(config: TauClientConfig) {\n this.client = axios.create({\n baseURL: config.baseUrl || 'https://api.tau.app/api/v1',\n timeout: config.timeout || 30000,\n withCredentials: config.withCredentials,\n headers: {\n 'Content-Type': 'application/json',\n 'X-API-Key': config.apiKey,\n },\n });\n\n // Add response interceptor for error handling\n this.client.interceptors.response.use(\n (response) => response,\n (error: AxiosError) => {\n if (error.response) {\n const apiError = error.response.data as any;\n throw new TauApiError(\n apiError.error?.message || error.message,\n apiError.error?.code || 'UNKNOWN_ERROR',\n error.response.status,\n apiError.error?.details,\n );\n }\n throw new TauApiError(error.message, 'NETWORK_ERROR', 0);\n },\n );\n\n // Initialize resources\n this.services = new ServicesResource(this.client);\n this.providers = new ProvidersResource(this.client);\n this.bookings = new BookingsResource(this.client);\n this.auth = new AuthResource(this.client);\n this.users = new UsersResource(this.client);\n }\n}\n\n// Error class\nexport class TauApiError extends Error {\n constructor(\n message: string,\n public code: string,\n public statusCode: number,\n public details?: Record<string, unknown>,\n ) {\n super(message);\n this.name = 'TauApiError';\n }\n}\n\n// Default export\nexport default TauClient;\n"],"mappings":";AAAA,OAAO,WAA8D;AA0FrE,IAAM,mBAAN,MAAuB;AAAA,EACnB,YAAoB,QAAuB;AAAvB;AAAA,EAAyB;AAAA,EAE7C,MAAM,KAAK,QAMyB;AAChC,UAAM,EAAE,KAAK,IAAI,MAAM,KAAK,OAAO,IAAI,aAAa,EAAE,OAAO,CAAC;AAC9D,WAAO;AAAA,EACX;AAAA,EAEA,MAAM,IAAI,IAA2C;AACjD,UAAM,EAAE,KAAK,IAAI,MAAM,KAAK,OAAO,IAAI,aAAa,EAAE,EAAE;AACxD,WAAO;AAAA,EACX;AAAA,EAEA,MAAM,aAAsD;AACxD,UAAM,EAAE,KAAK,IAAI,MAAM,KAAK,OAAO,IAAI,sBAAsB;AAC7D,WAAO;AAAA,EACX;AAAA,EAEA,MAAM,eAAe,MAA+E;AAChG,UAAM,EAAE,KAAK,IAAI,MAAM,KAAK,OA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A,SACT;AACE,UAAM,OAAO;AAJN;AACA;AACA;AAGP,SAAK,OAAO;AAAA,EAChB;AACJ;AAGA,IAAO,gBAAQ;","names":[]}
package/jest.config.js ADDED
@@ -0,0 +1,5 @@
1
+ /** @type {import('ts-jest').JestConfigWithTsJest} */
2
+ module.exports = {
3
+ preset: 'ts-jest',
4
+ testEnvironment: 'node',
5
+ };
package/package.json ADDED
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "tau-marketplace-sdk",
3
+ "version": "0.0.1",
4
+ "description": "TAU Service Marketplace JavaScript/TypeScript SDK",
5
+ "main": "./dist/index.js",
6
+ "module": "./dist/index.mjs",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.mjs",
12
+ "require": "./dist/index.js"
13
+ }
14
+ },
15
+ "scripts": {
16
+ "build": "tsup",
17
+ "dev": "tsup --watch",
18
+ "test": "jest",
19
+ "lint": "eslint src"
20
+ },
21
+ "dependencies": {
22
+ "axios": "^1.7.0"
23
+ },
24
+ "devDependencies": {
25
+ "@types/jest": "^30.0.0",
26
+ "@types/node": "^22.0.0",
27
+ "jest": "^30.2.0",
28
+ "ts-jest": "^29.4.6",
29
+ "tsup": "^8.0.0",
30
+ "typescript": "^5.9.2"
31
+ },
32
+ "peerDependencies": {
33
+ "typescript": ">=4.7.0"
34
+ },
35
+ "keywords": [
36
+ "tau",
37
+ "api",
38
+ "sdk",
39
+ "marketplace",
40
+ "services"
41
+ ],
42
+ "author": "",
43
+ "license": "MIT"
44
+ }
package/src/index.ts ADDED
@@ -0,0 +1,293 @@
1
+ import axios, { AxiosInstance, AxiosError, AxiosRequestConfig } from 'axios';
2
+
3
+ export interface TauClientConfig {
4
+ apiKey: string;
5
+ baseUrl?: string;
6
+ timeout?: number;
7
+ withCredentials?: boolean;
8
+ }
9
+
10
+ export interface ApiResponse<T> {
11
+ success: boolean;
12
+ data?: T;
13
+ error?: {
14
+ code: string;
15
+ message: string;
16
+ details?: Record<string, unknown>;
17
+ };
18
+ meta?: {
19
+ page: number;
20
+ limit: number;
21
+ total: number;
22
+ totalPages: number;
23
+ };
24
+ }
25
+
26
+ export interface PaginationParams {
27
+ skip?: number;
28
+ take?: number;
29
+ }
30
+
31
+ // Service Types
32
+ export interface ServiceCategory {
33
+ id: string;
34
+ name: string;
35
+ slug: string;
36
+ description?: string;
37
+ icon?: string;
38
+ image?: string;
39
+ }
40
+
41
+ export interface Service {
42
+ id: string;
43
+ providerId: string;
44
+ categoryId: string;
45
+ name: string;
46
+ description?: string;
47
+ basePrice: number;
48
+ currency: string;
49
+ duration: number;
50
+ images: string[];
51
+ isActive: boolean;
52
+ provider?: Provider;
53
+ }
54
+
55
+ export interface Provider {
56
+ id: string;
57
+ businessName?: string;
58
+ bio?: string;
59
+ skills: string[];
60
+ rating: number;
61
+ totalReviews: number;
62
+ isVerified: boolean;
63
+ user: {
64
+ firstName: string;
65
+ lastName: string;
66
+ avatar?: string;
67
+ };
68
+ }
69
+
70
+ // Booking Types
71
+ export interface CreateBookingParams {
72
+ serviceId: string;
73
+ providerId: string;
74
+ scheduledAt: string;
75
+ addressId?: string;
76
+ notes?: string;
77
+ }
78
+
79
+ export interface Booking {
80
+ id: string;
81
+ bookingNumber: string;
82
+ status: string;
83
+ scheduledAt: string;
84
+ totalAmount: number;
85
+ currency: string;
86
+ service: Service;
87
+ provider: Provider;
88
+ }
89
+
90
+ // Resources
91
+ class ServicesResource {
92
+ constructor(private client: AxiosInstance) { }
93
+
94
+ async list(params?: PaginationParams & {
95
+ categoryId?: string;
96
+ providerId?: string;
97
+ search?: string;
98
+ minPrice?: number;
99
+ maxPrice?: number;
100
+ }): Promise<ApiResponse<Service[]>> {
101
+ const { data } = await this.client.get('/services', { params });
102
+ return data;
103
+ }
104
+
105
+ async get(id: string): Promise<ApiResponse<Service>> {
106
+ const { data } = await this.client.get(`/services/${id}`);
107
+ return data;
108
+ }
109
+
110
+ async categories(): Promise<ApiResponse<ServiceCategory[]>> {
111
+ const { data } = await this.client.get('/services/categories');
112
+ return data;
113
+ }
114
+
115
+ async categoryBySlug(slug: string): Promise<ApiResponse<ServiceCategory & { services: Service[] }>> {
116
+ const { data } = await this.client.get(`/services/categories/${slug}`);
117
+ return data;
118
+ }
119
+ }
120
+
121
+ class ProvidersResource {
122
+ constructor(private client: AxiosInstance) { }
123
+
124
+ async list(params?: PaginationParams & {
125
+ categoryId?: string;
126
+ latitude?: number;
127
+ longitude?: number;
128
+ radius?: number;
129
+ minRating?: number;
130
+ isVerified?: boolean;
131
+ }): Promise<ApiResponse<Provider[]>> {
132
+ const { data } = await this.client.get('/providers', { params });
133
+ return data;
134
+ }
135
+
136
+ async get(id: string): Promise<ApiResponse<Provider>> {
137
+ const { data } = await this.client.get(`/providers/${id}`);
138
+ return data;
139
+ }
140
+
141
+ async availability(id: string): Promise<ApiResponse<any[]>> {
142
+ const { data } = await this.client.get(`/providers/${id}/availability`);
143
+ return data;
144
+ }
145
+ }
146
+
147
+ class BookingsResource {
148
+ constructor(private client: AxiosInstance) { }
149
+
150
+ async create(params: CreateBookingParams): Promise<ApiResponse<Booking>> {
151
+ const { data } = await this.client.post('/bookings', params);
152
+ return data;
153
+ }
154
+
155
+ async get(id: string): Promise<ApiResponse<Booking>> {
156
+ const { data } = await this.client.get(`/bookings/${id}`);
157
+ return data;
158
+ }
159
+
160
+ async list(params?: PaginationParams & { status?: string }): Promise<ApiResponse<Booking[]>> {
161
+ const { data } = await this.client.get('/bookings/consumer', { params });
162
+ return data;
163
+ }
164
+
165
+ async cancel(id: string, reason?: string): Promise<ApiResponse<Booking>> {
166
+ const { data } = await this.client.patch(`/bookings/${id}/status`, {
167
+ status: 'CANCELLED',
168
+ cancellationReason: reason,
169
+ });
170
+ return data;
171
+ }
172
+
173
+ async listAssigned(params?: PaginationParams & { status?: string }): Promise<ApiResponse<Booking[]>> {
174
+ const { data } = await this.client.get('/bookings/provider', { params });
175
+ return data;
176
+ }
177
+
178
+ async updateStatus(id: string, status: string): Promise<ApiResponse<Booking>> {
179
+ const { data } = await this.client.patch(`/bookings/${id}/status`, { status });
180
+ return data;
181
+ }
182
+
183
+ async listAll(params?: PaginationParams & { status?: string }): Promise<ApiResponse<Booking[]>> {
184
+ const { data } = await this.client.get('/bookings/admin', { params });
185
+ return data;
186
+ }
187
+ }
188
+
189
+ class UsersResource {
190
+ constructor(private client: AxiosInstance) { }
191
+
192
+ async list(params?: PaginationParams & { role?: string; search?: string }): Promise<ApiResponse<any[]>> {
193
+ const { data } = await this.client.get('/users', { params });
194
+ return data;
195
+ }
196
+
197
+ async updateStatus(id: string, status: string): Promise<ApiResponse<any>> {
198
+ const { data } = await this.client.patch(`/users/${id}/status`, { status });
199
+ return data;
200
+ }
201
+ }
202
+
203
+ class AuthResource {
204
+ constructor(private client: AxiosInstance) { }
205
+
206
+ async login(email: string, password: string): Promise<ApiResponse<{ accessToken: string; refreshToken: string; user: any }>> {
207
+ const { data } = await this.client.post('/auth/login', { email, password });
208
+ return data;
209
+ }
210
+
211
+ async register(data: { email: string; password: string; firstName: string; lastName: string; phone?: string }): Promise<ApiResponse<{ accessToken: string; refreshToken: string; user: any }>> {
212
+ const { data: response } = await this.client.post('/auth/register', data);
213
+ return response;
214
+ }
215
+
216
+ async logout(refreshToken: string): Promise<ApiResponse<void>> {
217
+ const { data } = await this.client.post('/auth/logout', { refreshToken });
218
+ return data;
219
+ }
220
+
221
+ async refresh(refreshToken: string): Promise<ApiResponse<{ accessToken: string; refreshToken: string }>> {
222
+ const { data } = await this.client.post('/auth/refresh', { refreshToken });
223
+ return data;
224
+ }
225
+
226
+ async getProfile(): Promise<ApiResponse<any>> {
227
+ const { data } = await this.client.get('/auth/profile');
228
+ return data;
229
+ }
230
+ }
231
+
232
+ // Main Client
233
+ export class TauClient {
234
+ public client: AxiosInstance;
235
+
236
+ public services: ServicesResource;
237
+ public providers: ProvidersResource;
238
+ public bookings: BookingsResource;
239
+ public auth: AuthResource;
240
+ public users: UsersResource;
241
+
242
+ constructor(config: TauClientConfig) {
243
+ this.client = axios.create({
244
+ baseURL: config.baseUrl || 'https://api.tau.app/api/v1',
245
+ timeout: config.timeout || 30000,
246
+ withCredentials: config.withCredentials,
247
+ headers: {
248
+ 'Content-Type': 'application/json',
249
+ 'X-API-Key': config.apiKey,
250
+ },
251
+ });
252
+
253
+ // Add response interceptor for error handling
254
+ this.client.interceptors.response.use(
255
+ (response) => response,
256
+ (error: AxiosError) => {
257
+ if (error.response) {
258
+ const apiError = error.response.data as any;
259
+ throw new TauApiError(
260
+ apiError.error?.message || error.message,
261
+ apiError.error?.code || 'UNKNOWN_ERROR',
262
+ error.response.status,
263
+ apiError.error?.details,
264
+ );
265
+ }
266
+ throw new TauApiError(error.message, 'NETWORK_ERROR', 0);
267
+ },
268
+ );
269
+
270
+ // Initialize resources
271
+ this.services = new ServicesResource(this.client);
272
+ this.providers = new ProvidersResource(this.client);
273
+ this.bookings = new BookingsResource(this.client);
274
+ this.auth = new AuthResource(this.client);
275
+ this.users = new UsersResource(this.client);
276
+ }
277
+ }
278
+
279
+ // Error class
280
+ export class TauApiError extends Error {
281
+ constructor(
282
+ message: string,
283
+ public code: string,
284
+ public statusCode: number,
285
+ public details?: Record<string, unknown>,
286
+ ) {
287
+ super(message);
288
+ this.name = 'TauApiError';
289
+ }
290
+ }
291
+
292
+ // Default export
293
+ export default TauClient;
package/tsconfig.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "ESNext",
5
+ "lib": [
6
+ "ES2022"
7
+ ],
8
+ "declaration": true,
9
+ "declarationMap": true,
10
+ "sourceMap": true,
11
+ "outDir": "./dist",
12
+ "rootDir": "./src",
13
+ "strict": true,
14
+ "esModuleInterop": true,
15
+ "skipLibCheck": true,
16
+ "forceConsistentCasingInFileNames": true,
17
+ "moduleResolution": "bundler"
18
+ },
19
+ "include": [
20
+ "src/**/*"
21
+ ],
22
+ "exclude": [
23
+ "node_modules",
24
+ "dist"
25
+ ]
26
+ }
package/tsup.config.ts ADDED
@@ -0,0 +1,10 @@
1
+ import { defineConfig } from 'tsup';
2
+
3
+ export default defineConfig({
4
+ entry: ['src/index.ts'],
5
+ format: ['cjs', 'esm'],
6
+ dts: true,
7
+ clean: true,
8
+ sourcemap: true,
9
+ splitting: false,
10
+ });