@gymspace/sdk 1.0.2 → 1.0.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gymspace/sdk",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "GymSpace TypeScript SDK for API integration",
5
5
  "author": "GymSpace Team",
6
6
  "license": "MIT",
package/src/client.ts CHANGED
@@ -3,6 +3,7 @@ import axios, {
3
3
  AxiosRequestConfig,
4
4
  AxiosError,
5
5
  InternalAxiosRequestConfig,
6
+ AxiosRequestHeaders,
6
7
  } from 'axios';
7
8
  import { GymSpaceConfig, RequestOptions } from './types';
8
9
  import {
@@ -92,9 +93,11 @@ export class ApiClient {
92
93
 
93
94
  if (newTokens) {
94
95
  // Update the original request with new token
95
- originalRequest.headers = originalRequest.headers || {};
96
+ if (!originalRequest.headers) {
97
+ originalRequest.headers = {} as AxiosRequestHeaders;
98
+ }
96
99
  originalRequest.headers['Authorization'] = `Bearer ${newTokens.access_token}`;
97
-
100
+
98
101
  // Retry the original request
99
102
  return this.axiosInstance(originalRequest);
100
103
  }
@@ -1,3 +1,5 @@
1
+ import { SubscriptionPlan } from './subscriptions';
2
+
1
3
  export interface RegisterOwnerDto {
2
4
  name: string;
3
5
  email: string;
@@ -79,7 +81,6 @@ export interface ResendResetCodeResponseDto {
79
81
  message: string;
80
82
  }
81
83
 
82
-
83
84
  export interface RegisterCollaboratorDto {
84
85
  invitationToken: string;
85
86
  name: string;
@@ -87,19 +88,6 @@ export interface RegisterCollaboratorDto {
87
88
  password: string;
88
89
  }
89
90
 
90
- export interface SubscriptionPlan {
91
- id: string;
92
- name: string;
93
- price: number;
94
- billingFrequency: string;
95
- maxGyms: number;
96
- maxClientsPerGym: number;
97
- maxUsersPerGym: number;
98
- features: any;
99
- description?: string;
100
- }
101
-
102
-
103
91
  export interface InvitationValidationResponse {
104
92
  valid: boolean;
105
93
  invitation: {
@@ -19,4 +19,20 @@ export interface OrganizationStats {
19
19
  totalContracts: number;
20
20
  activeContracts: number;
21
21
  totalRevenue: number;
22
+ }
23
+
24
+ export interface OrganizationWithDetails {
25
+ id: string;
26
+ name: string;
27
+ owner: {
28
+ id: string;
29
+ email: string;
30
+ fullName: string;
31
+ };
32
+ gyms: Array<{
33
+ id: string;
34
+ name: string;
35
+ address: string;
36
+ }>;
37
+ createdAt: Date;
22
38
  }
@@ -6,7 +6,6 @@ import {
6
6
  RegisterCollaboratorDto,
7
7
  RegisterOwnerDto,
8
8
  ResendVerificationDto,
9
- SubscriptionPlan,
10
9
  VerifyEmailDto,
11
10
  ChangePasswordDto,
12
11
  ChangePasswordResponseDto,
@@ -19,6 +18,7 @@ import {
19
18
  ResendResetCodeDto,
20
19
  ResendResetCodeResponseDto,
21
20
  } from '../models/auth';
21
+ import { SubscriptionPlan } from '../models/subscriptions';
22
22
  import { RequestOptions } from '../types';
23
23
  import { BaseResource } from './base';
24
24
 
@@ -1,5 +1,5 @@
1
1
  import { BaseResource } from './base';
2
- import { Organization, UpdateOrganizationDto, OrganizationStats } from '../models/organizations';
2
+ import { Organization, UpdateOrganizationDto, OrganizationStats, OrganizationWithDetails } from '../models/organizations';
3
3
  import { RequestOptions } from '../types';
4
4
 
5
5
  export class OrganizationsResource extends BaseResource {
@@ -20,4 +20,8 @@ export class OrganizationsResource extends BaseResource {
20
20
  async getOrganizationStats(id: string, options?: RequestOptions): Promise<OrganizationStats> {
21
21
  return this.client.get<OrganizationStats>(`${this.basePath}/${id}/stats`, undefined, options);
22
22
  }
23
+
24
+ async listOrganizations(options?: RequestOptions): Promise<OrganizationWithDetails[]> {
25
+ return this.client.get<OrganizationWithDetails[]>(`${this.basePath}/list`, undefined, options);
26
+ }
23
27
  }