@gymspace/sdk 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.
Files changed (52) hide show
  1. package/README.md +160 -0
  2. package/dist/index.js +1379 -0
  3. package/dist/index.js.map +1 -0
  4. package/dist/index.mjs +1321 -0
  5. package/dist/index.mjs.map +1 -0
  6. package/package.json +76 -0
  7. package/src/client.ts +200 -0
  8. package/src/errors.ts +49 -0
  9. package/src/index.ts +15 -0
  10. package/src/models/assets.ts +24 -0
  11. package/src/models/auth.ts +155 -0
  12. package/src/models/check-ins.ts +75 -0
  13. package/src/models/clients.ts +109 -0
  14. package/src/models/contracts.ts +61 -0
  15. package/src/models/dashboard.ts +32 -0
  16. package/src/models/evaluations.ts +91 -0
  17. package/src/models/files.ts +23 -0
  18. package/src/models/gyms.ts +73 -0
  19. package/src/models/index.ts +24 -0
  20. package/src/models/invitations.ts +29 -0
  21. package/src/models/leads.ts +52 -0
  22. package/src/models/membership-plans.ts +71 -0
  23. package/src/models/onboarding.ts +171 -0
  24. package/src/models/organizations.ts +25 -0
  25. package/src/models/products.ts +99 -0
  26. package/src/models/sales.ts +108 -0
  27. package/src/models/suppliers.ts +57 -0
  28. package/src/models/users.ts +17 -0
  29. package/src/resources/assets.ts +102 -0
  30. package/src/resources/auth.ts +137 -0
  31. package/src/resources/base.ts +50 -0
  32. package/src/resources/check-ins.ts +63 -0
  33. package/src/resources/clients.ts +57 -0
  34. package/src/resources/contracts.ts +59 -0
  35. package/src/resources/dashboard.ts +30 -0
  36. package/src/resources/evaluations.ts +63 -0
  37. package/src/resources/files.ts +95 -0
  38. package/src/resources/gyms.ts +61 -0
  39. package/src/resources/health.ts +28 -0
  40. package/src/resources/index.ts +20 -0
  41. package/src/resources/invitations.ts +38 -0
  42. package/src/resources/leads.ts +48 -0
  43. package/src/resources/membership-plans.ts +54 -0
  44. package/src/resources/onboarding.ts +58 -0
  45. package/src/resources/organizations.ts +23 -0
  46. package/src/resources/products.ts +91 -0
  47. package/src/resources/public-catalog.ts +61 -0
  48. package/src/resources/sales.ts +83 -0
  49. package/src/resources/suppliers.ts +44 -0
  50. package/src/resources/users.ts +27 -0
  51. package/src/sdk.ts +104 -0
  52. package/src/types.ts +41 -0
@@ -0,0 +1,38 @@
1
+ import { BaseResource } from './base';
2
+ import {
3
+ Invitation,
4
+ CreateInvitationDto,
5
+ AcceptInvitationDto,
6
+ GetGymInvitationsParams
7
+ } from '../models/invitations';
8
+ import { RequestOptions } from '../types';
9
+
10
+ export class InvitationsResource extends BaseResource {
11
+ private basePath = 'invitations';
12
+
13
+ async createInvitation(
14
+ data: CreateInvitationDto,
15
+ options?: RequestOptions
16
+ ): Promise<Invitation> {
17
+ return this.client.post<Invitation>(this.basePath, data, options);
18
+ }
19
+
20
+ async getGymInvitations(
21
+ params: GetGymInvitationsParams,
22
+ options?: RequestOptions
23
+ ): Promise<Invitation[]> {
24
+ return this.client.get<Invitation[]>(this.basePath, params, options);
25
+ }
26
+
27
+ async acceptInvitation(
28
+ token: string,
29
+ data: AcceptInvitationDto,
30
+ options?: RequestOptions
31
+ ): Promise<void> {
32
+ return this.client.post<void>(`${this.basePath}/${token}/accept`, data, options);
33
+ }
34
+
35
+ async cancelInvitation(id: string, options?: RequestOptions): Promise<void> {
36
+ return this.client.put<void>(`${this.basePath}/${id}/cancel`, undefined, options);
37
+ }
38
+ }
@@ -0,0 +1,48 @@
1
+ import { BaseResource } from './base';
2
+ import {
3
+ Lead,
4
+ CreateLeadDto,
5
+ UpdateLeadDto,
6
+ SearchLeadsParams,
7
+ LeadStats
8
+ } from '../models/leads';
9
+ import { RequestOptions, PaginatedResponseDto } from '../types';
10
+
11
+ export class LeadsResource extends BaseResource {
12
+ private basePath = 'leads';
13
+
14
+ async createLead(data: CreateLeadDto, options?: RequestOptions): Promise<Lead> {
15
+ return this.client.post<Lead>(this.basePath, data, options);
16
+ }
17
+
18
+ async searchLeads(
19
+ params?: SearchLeadsParams,
20
+ options?: RequestOptions
21
+ ): Promise<PaginatedResponseDto<Lead>> {
22
+ return this.paginate<Lead>(this.basePath, params, options);
23
+ }
24
+
25
+ async getLead(id: string, options?: RequestOptions): Promise<Lead> {
26
+ return this.client.get<Lead>(`${this.basePath}/${id}`, undefined, options);
27
+ }
28
+
29
+ async updateLead(
30
+ id: string,
31
+ data: UpdateLeadDto,
32
+ options?: RequestOptions
33
+ ): Promise<Lead> {
34
+ return this.client.put<Lead>(`${this.basePath}/${id}`, data, options);
35
+ }
36
+
37
+ async getLeadStats(options?: RequestOptions): Promise<LeadStats> {
38
+ return this.client.get<LeadStats>(`${this.basePath}/stats/gym`, undefined, options);
39
+ }
40
+
41
+ async convertLead(id: string, options?: RequestOptions): Promise<{ clientId: string }> {
42
+ return this.client.post<{ clientId: string }>(
43
+ `${this.basePath}/${id}/convert`,
44
+ undefined,
45
+ options
46
+ );
47
+ }
48
+ }
@@ -0,0 +1,54 @@
1
+ import { BaseResource } from './base';
2
+ import {
3
+ MembershipPlan,
4
+ CreateMembershipPlanDto,
5
+ UpdateMembershipPlanDto,
6
+ MembershipPlanStats,
7
+ GetMembershipPlansParams
8
+ } from '../models/membership-plans';
9
+ import { RequestOptions } from '../types';
10
+
11
+ export class MembershipPlansResource extends BaseResource {
12
+ private basePath = 'membership-plans';
13
+
14
+ async createMembershipPlan(
15
+ data: CreateMembershipPlanDto,
16
+ options?: RequestOptions
17
+ ): Promise<MembershipPlan> {
18
+ return this.client.post<MembershipPlan>(this.basePath, data, options);
19
+ }
20
+
21
+ async getGymMembershipPlans(
22
+ params?: GetMembershipPlansParams,
23
+ options?: RequestOptions
24
+ ): Promise<MembershipPlan[]> {
25
+ return this.client.get<MembershipPlan[]>(this.basePath, params, options);
26
+ }
27
+
28
+ async getMembershipPlan(id: string, options?: RequestOptions): Promise<MembershipPlan> {
29
+ return this.client.get<MembershipPlan>(`${this.basePath}/${id}`, undefined, options);
30
+ }
31
+
32
+ async updateMembershipPlan(
33
+ id: string,
34
+ data: UpdateMembershipPlanDto,
35
+ options?: RequestOptions
36
+ ): Promise<MembershipPlan> {
37
+ return this.client.put<MembershipPlan>(`${this.basePath}/${id}`, data, options);
38
+ }
39
+
40
+ async deleteMembershipPlan(id: string, options?: RequestOptions): Promise<void> {
41
+ return this.client.delete<void>(`${this.basePath}/${id}`, options);
42
+ }
43
+
44
+ async getMembershipPlanStats(
45
+ id: string,
46
+ options?: RequestOptions
47
+ ): Promise<MembershipPlanStats> {
48
+ return this.client.get<MembershipPlanStats>(
49
+ `${this.basePath}/${id}/stats`,
50
+ undefined,
51
+ options
52
+ );
53
+ }
54
+ }
@@ -0,0 +1,58 @@
1
+ import { BaseResource } from './base';
2
+ import {
3
+ StartOnboardingData,
4
+ StartOnboardingResponse,
5
+ UpdateGymSettingsData,
6
+ ConfigureFeaturesData,
7
+ CompleteGuidedSetupData,
8
+ OnboardingStatus,
9
+ OnboardingResponse,
10
+ } from '../models/onboarding';
11
+
12
+ export class OnboardingResource extends BaseResource {
13
+ /**
14
+ * Creates owner account, organization, and initial gym
15
+ * Now also sends verification and organization codes via email
16
+ */
17
+ async start(data: StartOnboardingData): Promise<StartOnboardingResponse> {
18
+ const response = await this.client.post<StartOnboardingResponse>('/onboarding/start', data);
19
+
20
+ // Store tokens after successful onboarding start
21
+ if (response.access_token && response.refresh_token) {
22
+ this.client.setTokens(response.access_token, response.refresh_token);
23
+ }
24
+
25
+ return response;
26
+ }
27
+
28
+ /**
29
+ * Updates basic gym settings (step 2 of onboarding)
30
+ * Configure basic gym information like name, address, etc.
31
+ */
32
+ async updateGymSettings(data: UpdateGymSettingsData): Promise<OnboardingResponse> {
33
+ return this.client.put<OnboardingResponse>('/onboarding/gym-settings', data);
34
+ }
35
+
36
+ /**
37
+ * Configure gym features (step 3 of onboarding)
38
+ * Enable/disable various management features
39
+ */
40
+ async configureFeatures(data: ConfigureFeaturesData): Promise<OnboardingResponse> {
41
+ return this.client.put<OnboardingResponse>('/onboarding/configure-features', data);
42
+ }
43
+
44
+ /**
45
+ * Mark onboarding as complete
46
+ */
47
+ async completeSetup(data: CompleteGuidedSetupData): Promise<OnboardingResponse> {
48
+ return this.client.post<OnboardingResponse>('/onboarding/complete', data);
49
+ }
50
+
51
+ /**
52
+ * Get current onboarding status
53
+ * Check progress and next steps
54
+ */
55
+ async getStatus(gymId: string): Promise<OnboardingStatus> {
56
+ return this.client.get<OnboardingStatus>(`/onboarding/status/${gymId}`);
57
+ }
58
+ }
@@ -0,0 +1,23 @@
1
+ import { BaseResource } from './base';
2
+ import { Organization, UpdateOrganizationDto, OrganizationStats } from '../models/organizations';
3
+ import { RequestOptions } from '../types';
4
+
5
+ export class OrganizationsResource extends BaseResource {
6
+ private basePath = 'organizations';
7
+
8
+ async getOrganization(id: string, options?: RequestOptions): Promise<Organization> {
9
+ return this.client.get<Organization>(`${this.basePath}/${id}`, undefined, options);
10
+ }
11
+
12
+ async updateOrganization(
13
+ id: string,
14
+ data: UpdateOrganizationDto,
15
+ options?: RequestOptions
16
+ ): Promise<Organization> {
17
+ return this.client.put<Organization>(`${this.basePath}/${id}`, data, options);
18
+ }
19
+
20
+ async getOrganizationStats(id: string, options?: RequestOptions): Promise<OrganizationStats> {
21
+ return this.client.get<OrganizationStats>(`${this.basePath}/${id}/stats`, undefined, options);
22
+ }
23
+ }
@@ -0,0 +1,91 @@
1
+ import { BaseResource } from './base';
2
+ import {
3
+ Product,
4
+ ProductCategory,
5
+ CreateProductDto,
6
+ UpdateProductDto,
7
+ UpdateStockDto,
8
+ CreateProductCategoryDto,
9
+ UpdateProductCategoryDto,
10
+ SearchProductsParams
11
+ } from '../models/products';
12
+ import { RequestOptions, PaginatedResponseDto } from '../types';
13
+
14
+ export class ProductsResource extends BaseResource {
15
+ private basePath = 'products';
16
+
17
+ // Product Category Methods
18
+ async createCategory(
19
+ data: CreateProductCategoryDto,
20
+ options?: RequestOptions
21
+ ): Promise<ProductCategory> {
22
+ return this.client.post<ProductCategory>(`${this.basePath}/categories`, data, options);
23
+ }
24
+
25
+ async getCategories(options?: RequestOptions): Promise<ProductCategory[]> {
26
+ return this.client.get<ProductCategory[]>(`${this.basePath}/categories`, undefined, options);
27
+ }
28
+
29
+ async updateCategory(
30
+ id: string,
31
+ data: UpdateProductCategoryDto,
32
+ options?: RequestOptions
33
+ ): Promise<ProductCategory> {
34
+ return this.client.put<ProductCategory>(`${this.basePath}/categories/${id}`, data, options);
35
+ }
36
+
37
+ async deleteCategory(id: string, options?: RequestOptions): Promise<void> {
38
+ return this.client.delete<void>(`${this.basePath}/categories/${id}`, options);
39
+ }
40
+
41
+ // Product Methods
42
+ async createProduct(data: CreateProductDto, options?: RequestOptions): Promise<Product> {
43
+ return this.client.post<Product>(this.basePath, data, options);
44
+ }
45
+
46
+ async searchProducts(
47
+ params?: SearchProductsParams,
48
+ options?: RequestOptions
49
+ ): Promise<PaginatedResponseDto<Product>> {
50
+ return this.paginate<Product>(this.basePath, params, options);
51
+ }
52
+
53
+ async getProduct(id: string, options?: RequestOptions): Promise<Product> {
54
+ return this.client.get<Product>(`${this.basePath}/${id}`, undefined, options);
55
+ }
56
+
57
+ async updateProduct(
58
+ id: string,
59
+ data: UpdateProductDto,
60
+ options?: RequestOptions
61
+ ): Promise<Product> {
62
+ return this.client.put<Product>(`${this.basePath}/${id}`, data, options);
63
+ }
64
+
65
+ async deleteProduct(id: string, options?: RequestOptions): Promise<void> {
66
+ return this.client.delete<void>(`${this.basePath}/${id}`, options);
67
+ }
68
+
69
+ async toggleProductStatus(id: string, options?: RequestOptions): Promise<Product> {
70
+ return this.client.patch<Product>(`${this.basePath}/${id}/toggle-status`, undefined, options);
71
+ }
72
+
73
+ async updateStock(
74
+ id: string,
75
+ data: UpdateStockDto,
76
+ options?: RequestOptions
77
+ ): Promise<Product> {
78
+ return this.client.patch<Product>(`${this.basePath}/${id}/stock`, data, options);
79
+ }
80
+
81
+ async getLowStockProducts(
82
+ threshold: number = 10,
83
+ options?: RequestOptions
84
+ ): Promise<Product[]> {
85
+ return this.client.get<Product[]>(
86
+ `${this.basePath}/low-stock`,
87
+ { threshold },
88
+ options
89
+ );
90
+ }
91
+ }
@@ -0,0 +1,61 @@
1
+ import { BaseResource } from './base';
2
+ import { RequestOptions, PaginatedResponseDto } from '../types';
3
+ import { PaginationQueryDto } from '../types';
4
+
5
+ export interface SearchCatalogParams extends PaginationQueryDto {
6
+ search?: string;
7
+ city?: string;
8
+ state?: string;
9
+ latitude?: string;
10
+ longitude?: string;
11
+ radius?: string;
12
+ }
13
+
14
+ export interface GetFeaturedGymsParams {
15
+ limit: string;
16
+ }
17
+
18
+ export interface CatalogGym {
19
+ id: string;
20
+ name: string;
21
+ slug: string;
22
+ address?: string;
23
+ city?: string;
24
+ state?: string;
25
+ phone?: string;
26
+ email?: string;
27
+ amenities?: any;
28
+ settings?: any;
29
+ }
30
+
31
+ export interface CityWithGyms {
32
+ city: string;
33
+ state: string;
34
+ count: number;
35
+ }
36
+
37
+ export class PublicCatalogResource extends BaseResource {
38
+ private basePath = 'catalog';
39
+
40
+ async searchCatalog(
41
+ params?: SearchCatalogParams,
42
+ options?: RequestOptions
43
+ ): Promise<PaginatedResponseDto<CatalogGym>> {
44
+ return this.paginate<CatalogGym>(`${this.basePath}/search`, params, options);
45
+ }
46
+
47
+ async getFeaturedGyms(
48
+ params: GetFeaturedGymsParams,
49
+ options?: RequestOptions
50
+ ): Promise<CatalogGym[]> {
51
+ return this.client.get<CatalogGym[]>(`${this.basePath}/featured`, params, options);
52
+ }
53
+
54
+ async getCitiesWithGyms(options?: RequestOptions): Promise<CityWithGyms[]> {
55
+ return this.client.get<CityWithGyms[]>(`${this.basePath}/cities`, undefined, options);
56
+ }
57
+
58
+ async getGymBySlug(slug: string, options?: RequestOptions): Promise<CatalogGym> {
59
+ return this.client.get<CatalogGym>(`${this.basePath}/${slug}`, undefined, options);
60
+ }
61
+ }
@@ -0,0 +1,83 @@
1
+ import { BaseResource } from './base';
2
+ import {
3
+ Sale,
4
+ CreateSaleDto,
5
+ UpdateSaleDto,
6
+ UpdatePaymentStatusDto,
7
+ SearchSalesParams,
8
+ SalesStats,
9
+ TopSellingProduct
10
+ } from '../models/sales';
11
+ import { RequestOptions, PaginatedResponseDto } from '../types';
12
+
13
+ export class SalesResource extends BaseResource {
14
+ private basePath = 'sales';
15
+
16
+ async createSale(data: CreateSaleDto, options?: RequestOptions): Promise<Sale> {
17
+ return this.client.post<Sale>(this.basePath, data, options);
18
+ }
19
+
20
+ async searchSales(
21
+ params?: SearchSalesParams,
22
+ options?: RequestOptions
23
+ ): Promise<PaginatedResponseDto<Sale>> {
24
+ return this.paginate<Sale>(this.basePath, params, options);
25
+ }
26
+
27
+ async getSale(id: string, options?: RequestOptions): Promise<Sale> {
28
+ return this.client.get<Sale>(`${this.basePath}/${id}`, undefined, options);
29
+ }
30
+
31
+ async updateSale(
32
+ id: string,
33
+ data: UpdateSaleDto,
34
+ options?: RequestOptions
35
+ ): Promise<Sale> {
36
+ return this.client.put<Sale>(`${this.basePath}/${id}`, data, options);
37
+ }
38
+
39
+ async updatePaymentStatus(
40
+ id: string,
41
+ data: UpdatePaymentStatusDto,
42
+ options?: RequestOptions
43
+ ): Promise<Sale> {
44
+ return this.client.put<Sale>(`${this.basePath}/${id}/payment-status`, data, options);
45
+ }
46
+
47
+ async deleteSale(id: string, options?: RequestOptions): Promise<void> {
48
+ return this.client.delete<void>(`${this.basePath}/${id}`, options);
49
+ }
50
+
51
+ async getSalesStats(
52
+ startDate?: string,
53
+ endDate?: string,
54
+ options?: RequestOptions
55
+ ): Promise<SalesStats> {
56
+ const params: Record<string, string> = {};
57
+ if (startDate) params.startDate = startDate;
58
+ if (endDate) params.endDate = endDate;
59
+
60
+ return this.client.get<SalesStats>(
61
+ `${this.basePath}/stats`,
62
+ Object.keys(params).length > 0 ? params : undefined,
63
+ options
64
+ );
65
+ }
66
+
67
+ async getTopSellingProducts(
68
+ limit: number = 10,
69
+ startDate?: string,
70
+ endDate?: string,
71
+ options?: RequestOptions
72
+ ): Promise<TopSellingProduct[]> {
73
+ const params: Record<string, string | number> = { limit };
74
+ if (startDate) params.startDate = startDate;
75
+ if (endDate) params.endDate = endDate;
76
+
77
+ return this.client.get<TopSellingProduct[]>(
78
+ `${this.basePath}/top-products`,
79
+ params,
80
+ options
81
+ );
82
+ }
83
+ }
@@ -0,0 +1,44 @@
1
+ import { BaseResource } from './base';
2
+ import {
3
+ Supplier,
4
+ CreateSupplierDto,
5
+ UpdateSupplierDto,
6
+ SearchSuppliersParams,
7
+ SuppliersStats
8
+ } from '../models/suppliers';
9
+ import { RequestOptions, PaginatedResponseDto } from '../types';
10
+
11
+ export class SuppliersResource extends BaseResource {
12
+ private basePath = 'suppliers';
13
+
14
+ async createSupplier(data: CreateSupplierDto, options?: RequestOptions): Promise<Supplier> {
15
+ return this.client.post<Supplier>(this.basePath, data, options);
16
+ }
17
+
18
+ async searchSuppliers(
19
+ params?: SearchSuppliersParams,
20
+ options?: RequestOptions
21
+ ): Promise<PaginatedResponseDto<Supplier>> {
22
+ return this.paginate<Supplier>(this.basePath, params, options);
23
+ }
24
+
25
+ async getSupplier(id: string, options?: RequestOptions): Promise<Supplier> {
26
+ return this.client.get<Supplier>(`${this.basePath}/${id}`, undefined, options);
27
+ }
28
+
29
+ async updateSupplier(
30
+ id: string,
31
+ data: UpdateSupplierDto,
32
+ options?: RequestOptions
33
+ ): Promise<Supplier> {
34
+ return this.client.put<Supplier>(`${this.basePath}/${id}`, data, options);
35
+ }
36
+
37
+ async deleteSupplier(id: string, options?: RequestOptions): Promise<void> {
38
+ return this.client.delete<void>(`${this.basePath}/${id}`, options);
39
+ }
40
+
41
+ async getSuppliersStats(options?: RequestOptions): Promise<SuppliersStats> {
42
+ return this.client.get<SuppliersStats>(`${this.basePath}/stats`, undefined, options);
43
+ }
44
+ }
@@ -0,0 +1,27 @@
1
+ import { BaseResource } from './base';
2
+ import { UserProfileDto, UpdateProfileDto } from '../models/users';
3
+ import { RequestOptions } from '../types';
4
+
5
+ export class UsersResource extends BaseResource {
6
+ /**
7
+ * Get the current user's profile
8
+ * @param options - Request options
9
+ * @returns User profile data
10
+ */
11
+ async getProfile(options?: RequestOptions): Promise<UserProfileDto> {
12
+ return this.client.get<UserProfileDto>('/users/profile', undefined, options);
13
+ }
14
+
15
+ /**
16
+ * Update the current user's profile
17
+ * @param data - Profile update data
18
+ * @param options - Request options
19
+ * @returns Updated user profile
20
+ */
21
+ async updateProfile(
22
+ data: UpdateProfileDto,
23
+ options?: RequestOptions
24
+ ): Promise<UserProfileDto> {
25
+ return this.client.put<UserProfileDto>('/users/profile', data, options);
26
+ }
27
+ }
package/src/sdk.ts ADDED
@@ -0,0 +1,104 @@
1
+ import { ApiClient } from './client';
2
+ import { GymSpaceConfig } from './types';
3
+ import {
4
+ AuthResource,
5
+ OrganizationsResource,
6
+ GymsResource,
7
+ ClientsResource,
8
+ MembershipPlansResource,
9
+ ContractsResource,
10
+ DashboardResource,
11
+ EvaluationsResource,
12
+ CheckInsResource,
13
+ InvitationsResource,
14
+ LeadsResource,
15
+ AssetsResource,
16
+ FilesResource,
17
+ PublicCatalogResource,
18
+ HealthResource,
19
+ OnboardingResource,
20
+ ProductsResource,
21
+ SalesResource,
22
+ SuppliersResource,
23
+ UsersResource,
24
+ } from './resources';
25
+
26
+ export class GymSpaceSdk {
27
+ private client: ApiClient;
28
+
29
+ // Resources
30
+ public auth: AuthResource;
31
+ public organizations: OrganizationsResource;
32
+ public gyms: GymsResource;
33
+ public clients: ClientsResource;
34
+ public membershipPlans: MembershipPlansResource;
35
+ public contracts: ContractsResource;
36
+ public dashboard: DashboardResource;
37
+ public evaluations: EvaluationsResource;
38
+ public checkIns: CheckInsResource;
39
+ public invitations: InvitationsResource;
40
+ public leads: LeadsResource;
41
+ public assets: AssetsResource;
42
+ public files: FilesResource;
43
+ public publicCatalog: PublicCatalogResource;
44
+ public health: HealthResource;
45
+ public onboarding: OnboardingResource;
46
+ public products: ProductsResource;
47
+ public sales: SalesResource;
48
+ public suppliers: SuppliersResource;
49
+ public users: UsersResource;
50
+
51
+ constructor(config: GymSpaceConfig) {
52
+ this.client = new ApiClient(config);
53
+
54
+ // Initialize resources
55
+ this.auth = new AuthResource(this.client);
56
+ this.organizations = new OrganizationsResource(this.client);
57
+ this.gyms = new GymsResource(this.client);
58
+ this.clients = new ClientsResource(this.client);
59
+ this.membershipPlans = new MembershipPlansResource(this.client);
60
+ this.contracts = new ContractsResource(this.client);
61
+ this.dashboard = new DashboardResource(this.client);
62
+ this.evaluations = new EvaluationsResource(this.client);
63
+ this.checkIns = new CheckInsResource(this.client);
64
+ this.invitations = new InvitationsResource(this.client);
65
+ this.leads = new LeadsResource(this.client);
66
+ this.assets = new AssetsResource(this.client);
67
+ this.files = new FilesResource(this.client);
68
+ this.publicCatalog = new PublicCatalogResource(this.client);
69
+ this.health = new HealthResource(this.client);
70
+ this.onboarding = new OnboardingResource(this.client);
71
+ this.products = new ProductsResource(this.client);
72
+ this.sales = new SalesResource(this.client);
73
+ this.suppliers = new SuppliersResource(this.client);
74
+ this.users = new UsersResource(this.client);
75
+ }
76
+
77
+ /**
78
+ * Set the authentication token
79
+ */
80
+ setAuthToken(token: string): void {
81
+ this.client.setAuthToken(token);
82
+ }
83
+
84
+ /**
85
+ * Set the current gym context
86
+ */
87
+ setGymId(gymId: string): void {
88
+ this.client.setGymId(gymId);
89
+ }
90
+
91
+ /**
92
+ * Clear authentication
93
+ */
94
+ clearAuth(): void {
95
+ this.client.clearAuth();
96
+ }
97
+
98
+ /**
99
+ * Get the underlying API client
100
+ */
101
+ getClient(): ApiClient {
102
+ return this.client;
103
+ }
104
+ }
package/src/types.ts ADDED
@@ -0,0 +1,41 @@
1
+ export interface GymSpaceConfig {
2
+ baseURL: string;
3
+ apiKey?: string;
4
+ refreshToken?: string;
5
+ timeout?: number;
6
+ headers?: Record<string, string>;
7
+ }
8
+
9
+ export interface RequestOptions {
10
+ gymId?: string;
11
+ headers?: Record<string, string>;
12
+ }
13
+
14
+ export interface PaginationParams {
15
+ limit?: number;
16
+ offset?: number;
17
+ }
18
+
19
+ export interface PaginatedResponse<T> {
20
+ data: T[];
21
+ meta: {
22
+ total: number;
23
+ page: number;
24
+ limit: number;
25
+ totalPages: number;
26
+ hasNext: boolean;
27
+ hasPrevious: boolean;
28
+ };
29
+ }
30
+
31
+ // Legacy alias for compatibility
32
+ export type PaginatedResponseDto<T> = PaginatedResponse<T>;
33
+
34
+ // Import specific types we need from shared
35
+ import type { PaginationParams as SharedPaginationParams } from '@gymspace/shared';
36
+
37
+ // Re-export as PaginationQueryDto for backward compatibility
38
+ export type PaginationQueryDto = SharedPaginationParams;
39
+
40
+ // Re-export shared types
41
+ export * from '@gymspace/shared';