@athos-sdk/api-types 2.0.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -28,6 +28,25 @@ declare enum ExpertRole {
28
28
  interface SuccessResponse {
29
29
  success: true;
30
30
  }
31
+ /** Query params for paginated list endpoints (page, limit) */
32
+ interface PaginationQuery {
33
+ page?: number;
34
+ limit?: number;
35
+ }
36
+ /** Meta object in paginated list responses */
37
+ interface PaginationMeta {
38
+ total: number;
39
+ page: number;
40
+ limit: number;
41
+ totalPages: number;
42
+ hasNext: boolean;
43
+ hasPrev: boolean;
44
+ }
45
+ /** Response shape for paginated list endpoints */
46
+ interface PaginatedResponse<T> {
47
+ data: T[];
48
+ meta: PaginationMeta;
49
+ }
31
50
  /** Media record (e.g. profile image, gym image) */
32
51
  interface Media {
33
52
  id: string;
@@ -172,6 +191,10 @@ interface ChallengeOccurrence {
172
191
  endDate: string;
173
192
  imageId: string | null;
174
193
  }
194
+ /** Challenge with occurrences (e.g. GET /challenges paginated list) */
195
+ interface ChallengeWithOccurrences extends Challenge {
196
+ occurrences: ChallengeOccurrence[];
197
+ }
175
198
  /** Occurrence with challenge and participations (e.g. GET /challenges/me/active) */
176
199
  interface ChallengeOccurrenceWithDetails extends ChallengeOccurrence {
177
200
  challenge: Challenge;
@@ -265,28 +288,6 @@ interface CheckIn {
265
288
  checkedInAt: string;
266
289
  }
267
290
 
268
- /** POST /bookings (member) */
269
- interface CreateBookingDto {
270
- expertId: string;
271
- startAt: string;
272
- endAt: string;
273
- }
274
- /** POST /bookings/status (expert) */
275
- interface UpdateBookingStatusDto {
276
- bookingId: string;
277
- status: BookingStatus;
278
- }
279
- /** Booking entity */
280
- interface Booking {
281
- id: string;
282
- memberId: string;
283
- expertId: string;
284
- startAt: string;
285
- endAt: string;
286
- status: BookingStatus;
287
- createdAt: string;
288
- }
289
-
290
291
  /** Single availability slot (day + time range) */
291
292
  interface AvailabilitySlotDto {
292
293
  dayOfWeek: number;
@@ -338,6 +339,40 @@ interface ExpertAvailabilityResponse {
338
339
  exceptions: ExpertAvailabilityException[];
339
340
  }
340
341
 
342
+ /** POST /bookings (member) */
343
+ interface CreateBookingDto {
344
+ expertId: string;
345
+ startAt: string;
346
+ endAt: string;
347
+ }
348
+ /** POST /bookings/status (expert) */
349
+ interface UpdateBookingStatusDto {
350
+ bookingId: string;
351
+ status: BookingStatus;
352
+ }
353
+ /** Booking entity */
354
+ interface Booking {
355
+ id: string;
356
+ memberId: string;
357
+ expertId: string;
358
+ startAt: string;
359
+ endAt: string;
360
+ status: BookingStatus;
361
+ createdAt: string;
362
+ }
363
+ /** Booking with expert (e.g. GET /bookings/me/member) */
364
+ interface BookingWithExpert extends Booking {
365
+ expert: Expert & {
366
+ user: User;
367
+ };
368
+ }
369
+ /** Booking with member (e.g. GET /bookings/me/expert) */
370
+ interface BookingWithMember extends Booking {
371
+ member: Member & {
372
+ user: User;
373
+ };
374
+ }
375
+
341
376
  /** PATCH /admin/gym */
342
377
  interface UpdateGymDto {
343
378
  name?: string;
@@ -394,6 +429,11 @@ interface StaffWithUser extends Staff {
394
429
  interface ExpertWithUser extends Expert {
395
430
  user: User;
396
431
  }
432
+ /** Booking with member and expert (e.g. GET /admin/bookings) */
433
+ interface BookingWithMemberAndExpert extends Booking {
434
+ member: MemberWithUser;
435
+ expert: ExpertWithUser;
436
+ }
397
437
 
398
438
  /** Notification entity */
399
439
  interface Notification {
@@ -537,246 +577,79 @@ type RouteMethod<R> = R extends RouteDef<infer M, unknown, unknown> ? M : never;
537
577
  type RoutePath<R> = R extends RouteDef<HttpMethod, unknown, unknown> ? R['path'] : never;
538
578
  declare const apiRoutes: {
539
579
  readonly auth: {
540
- readonly register: {
541
- method: "POST";
542
- path: string;
543
- _req: RegisterDto;
544
- _res: RegisterResponse;
545
- };
546
- readonly login: {
547
- method: "POST";
548
- path: string;
549
- _req: LoginDto;
550
- _res: AuthResponse;
551
- };
552
- readonly deleteMe: {
553
- method: "DELETE";
554
- path: string;
555
- };
580
+ readonly register: RouteDef<"POST", RegisterDto, RegisterResponse>;
581
+ readonly login: RouteDef<"POST", LoginDto, AuthResponse>;
582
+ readonly deleteMe: RouteDef<"DELETE", void, SuccessResponse>;
556
583
  };
557
584
  readonly members: {
558
- readonly join: {
559
- method: "POST";
560
- path: string;
561
- _req: JoinGymDto;
562
- _res: MemberWithGym;
563
- };
564
- readonly me: {
565
- method: "GET";
566
- path: string;
567
- };
568
- readonly updateMe: {
569
- method: "PATCH";
570
- path: string;
571
- _req: UpdateMemberProfileDto;
572
- _res: GetMeResponse;
573
- };
574
- readonly meStats: {
575
- method: "GET";
576
- path: string;
577
- };
585
+ readonly join: RouteDef<"POST", JoinGymDto, MemberWithGym>;
586
+ readonly me: RouteDef<"GET", void, GetMeResponse>;
587
+ readonly updateMe: RouteDef<"PATCH", UpdateMemberProfileDto, GetMeResponse>;
588
+ readonly meStats: RouteDef<"GET", void, MemberStatsResponse>;
578
589
  };
579
590
  readonly checkIns: {
580
- readonly create: {
581
- method: "POST";
582
- path: string;
583
- _req: CreateCheckInDto;
584
- _res: CheckIn;
585
- };
591
+ readonly create: RouteDef<"POST", CreateCheckInDto, CheckIn>;
586
592
  };
587
593
  readonly leaderboards: {
588
- readonly list: {
589
- method: "GET";
590
- path: string;
591
- };
592
- readonly create: {
593
- method: "POST";
594
- path: string;
595
- _req: CreateLeaderboardDto;
596
- _res: Leaderboard;
597
- };
598
- readonly submitEntry: {
599
- method: "POST";
600
- path: string;
601
- _req: SubmitEntryDto;
602
- _res: unknown;
603
- };
604
- readonly reviewEntry: {
605
- method: "POST";
606
- path: string;
607
- _req: ReviewEntryDto;
608
- _res: SuccessResponse;
609
- };
594
+ readonly list: RouteDef<"GET", void, PaginatedResponse<LeaderboardWithEntries>>;
595
+ readonly create: RouteDef<"POST", CreateLeaderboardDto, Leaderboard>;
596
+ readonly submitEntry: RouteDef<"POST", SubmitEntryDto, unknown>;
597
+ readonly reviewEntry: RouteDef<"POST", ReviewEntryDto, SuccessResponse>;
610
598
  };
611
599
  readonly challenges: {
612
- readonly create: {
613
- method: "POST";
614
- path: string;
615
- _req: CreateChallengeDto;
616
- _res: Challenge;
617
- };
618
- readonly createOccurrence: {
619
- method: "POST";
620
- path: string;
621
- _req: CreateOccurrenceDto;
622
- _res: ChallengeOccurrence;
623
- };
624
- readonly meActive: {
625
- method: "GET";
626
- path: string;
627
- };
628
- readonly join: {
629
- method: "POST";
630
- path: string;
631
- _req: JoinChallengeDto;
632
- _res: unknown;
633
- };
634
- readonly complete: {
635
- method: "POST";
636
- path: string;
637
- _req: CompleteChallengeDto;
638
- _res: unknown;
639
- };
600
+ readonly list: RouteDef<"GET", void, PaginatedResponse<ChallengeWithOccurrences>>;
601
+ readonly create: RouteDef<"POST", CreateChallengeDto, Challenge>;
602
+ readonly createOccurrence: RouteDef<"POST", CreateOccurrenceDto, ChallengeOccurrence>;
603
+ readonly meActive: RouteDef<"GET", void, ChallengeOccurrenceWithDetails[]>;
604
+ readonly join: RouteDef<"POST", JoinChallengeDto, unknown>;
605
+ readonly complete: RouteDef<"POST", CompleteChallengeDto, unknown>;
640
606
  };
641
607
  readonly bookings: {
642
- readonly create: {
643
- method: "POST";
644
- path: string;
645
- _req: CreateBookingDto;
646
- _res: Booking;
647
- };
648
- readonly updateStatus: {
649
- method: "POST";
650
- path: string;
651
- _req: UpdateBookingStatusDto;
652
- _res: Booking;
653
- };
654
- readonly meMember: {
655
- method: "GET";
656
- path: string;
657
- };
658
- readonly meExpert: {
659
- method: "GET";
660
- path: string;
661
- };
608
+ readonly create: RouteDef<"POST", CreateBookingDto, Booking>;
609
+ readonly updateStatus: RouteDef<"POST", UpdateBookingStatusDto, Booking>;
610
+ readonly meMember: RouteDef<"GET", void, PaginatedResponse<BookingWithExpert>>;
611
+ readonly meExpert: RouteDef<"GET", void, PaginatedResponse<BookingWithMember>>;
662
612
  };
663
613
  readonly rewards: {
664
- readonly list: {
665
- method: "GET";
666
- path: string;
667
- };
668
- readonly me: {
669
- method: "GET";
670
- path: string;
671
- };
614
+ readonly list: RouteDef<"GET", void, PaginatedResponse<Reward>>;
615
+ readonly me: RouteDef<"GET", void, MemberReward[]>;
672
616
  };
673
617
  readonly experts: {
674
- readonly list: {
675
- method: "GET";
676
- path: string;
677
- };
678
- readonly me: {
679
- method: "GET";
680
- path: string;
681
- };
618
+ readonly list: RouteDef<"GET", void, PaginatedResponse<Expert>>;
619
+ readonly me: RouteDef<"GET", void, Expert>;
682
620
  readonly availability: (id: string) => RouteDef<"GET", void, ExpertAvailabilityResponse>;
683
- readonly meAvailability: {
684
- method: "POST";
685
- path: string;
686
- _req: SetAvailabilityDto;
687
- _res: ExpertAvailability[];
688
- };
689
- readonly meAvailabilityExceptions: {
690
- method: "POST";
691
- path: string;
692
- _req: SetAvailabilityExceptionDto;
693
- _res: unknown;
694
- };
621
+ readonly meAvailability: RouteDef<"POST", SetAvailabilityDto, ExpertAvailability[]>;
622
+ readonly meAvailabilityExceptions: RouteDef<"POST", SetAvailabilityExceptionDto, unknown>;
695
623
  };
696
624
  readonly notifications: {
697
- readonly me: {
698
- method: "GET";
699
- path: string;
700
- };
701
- readonly meReadAll: {
702
- method: "POST";
703
- path: string;
704
- };
625
+ readonly me: RouteDef<"GET", void, Notification[]>;
626
+ readonly meReadAll: RouteDef<"POST", void, SuccessResponse>;
705
627
  };
706
628
  readonly activities: {
707
- readonly me: {
708
- method: "GET";
709
- path: string;
710
- };
629
+ readonly me: RouteDef<"GET", void, Activity[]>;
711
630
  };
712
631
  readonly media: {
713
- readonly upload: {
714
- method: "POST";
715
- path: string;
716
- _res: Media;
717
- };
632
+ readonly upload: RouteDef<"POST", unknown, Media>;
718
633
  readonly delete: (id: string) => RouteDef<"DELETE", void, SuccessResponse>;
719
634
  };
720
635
  readonly admin: {
721
- readonly summary: {
722
- method: "GET";
723
- path: string;
724
- };
725
- readonly gym: {
726
- method: "GET";
727
- path: string;
728
- };
729
- readonly updateGym: {
730
- method: "PATCH";
731
- path: string;
732
- _req: UpdateGymDto;
733
- _res: Gym;
734
- };
735
- readonly members: {
736
- method: "GET";
737
- path: string;
738
- };
739
- readonly createMember: {
740
- method: "POST";
741
- path: string;
742
- _req: AddMemberDto;
743
- _res: MemberWithUser;
744
- };
745
- readonly rewards: {
746
- method: "GET";
747
- path: string;
748
- };
749
- readonly createReward: {
750
- method: "POST";
751
- path: string;
752
- _req: CreateRewardDto;
753
- _res: Reward;
754
- };
636
+ readonly summary: RouteDef<"GET", void, AdminSummaryResponse>;
637
+ readonly gym: RouteDef<"GET", void, Gym>;
638
+ readonly updateGym: RouteDef<"PATCH", UpdateGymDto, Gym>;
639
+ readonly members: RouteDef<"GET", void, PaginatedResponse<MemberWithUser>>;
640
+ readonly createMember: RouteDef<"POST", AddMemberDto, MemberWithUser>;
641
+ readonly rewards: RouteDef<"GET", void, PaginatedResponse<Reward>>;
642
+ readonly createReward: RouteDef<"POST", CreateRewardDto, Reward>;
755
643
  readonly updateReward: (id: string) => RouteDef<"PATCH", UpdateRewardDto, Reward>;
756
644
  readonly deleteReward: (id: string) => RouteDef<"DELETE", void, SuccessResponse>;
757
- readonly staff: {
758
- method: "GET";
759
- path: string;
760
- };
761
- readonly createStaff: {
762
- method: "POST";
763
- path: string;
764
- _req: AddStaffDto;
765
- _res: StaffWithUser;
766
- };
645
+ readonly staff: RouteDef<"GET", void, PaginatedResponse<StaffWithUser>>;
646
+ readonly createStaff: RouteDef<"POST", AddStaffDto, StaffWithUser>;
767
647
  readonly deleteStaff: (userId: string) => RouteDef<"DELETE", void, SuccessResponse>;
768
648
  readonly disableStaff: (userId: string) => RouteDef<"PATCH", void, SuccessResponse>;
769
649
  readonly enableStaff: (userId: string) => RouteDef<"PATCH", void, SuccessResponse>;
770
- readonly experts: {
771
- method: "GET";
772
- path: string;
773
- };
774
- readonly createExpert: {
775
- method: "POST";
776
- path: string;
777
- _req: AddExpertDto;
778
- _res: ExpertWithUser;
779
- };
650
+ readonly experts: RouteDef<"GET", void, PaginatedResponse<ExpertWithUser>>;
651
+ readonly bookings: RouteDef<"GET", void, PaginatedResponse<BookingWithMemberAndExpert>>;
652
+ readonly createExpert: RouteDef<"POST", AddExpertDto, ExpertWithUser>;
780
653
  readonly deleteExpert: (userId: string) => RouteDef<"DELETE", void, SuccessResponse>;
781
654
  readonly disableExpert: (userId: string) => RouteDef<"PATCH", void, SuccessResponse>;
782
655
  readonly enableExpert: (userId: string) => RouteDef<"PATCH", void, SuccessResponse>;
@@ -839,4 +712,4 @@ declare function createApi(client: AthosHttpClient, baseUrl?: string): {
839
712
  request<R extends RouteDef<HttpMethod, unknown, unknown>>(route: R, body?: RequestBody<R>): Promise<ResponseBody<R>>;
840
713
  };
841
714
 
842
- export { type Activity, type AddExpertDto, type AddMemberDto, type AddStaffDto, type AdminSummaryResponse, type AthosHttpClient, type AuthResponse, type AvailabilitySlotDto, type Booking, BookingStatus, type Challenge, type ChallengeOccurrence, type ChallengeOccurrenceWithDetails, type ChallengeParticipation, ChallengeVerificationType, type CheckIn, type CompleteChallengeDto, type CreateBookingDto, type CreateChallengeDto, type CreateCheckInDto, type CreateLeaderboardDto, type CreateOccurrenceDto, type CreateRewardDto, type Expert, type ExpertAvailability, type ExpertAvailabilityException, type ExpertAvailabilityResponse, ExpertRole, type ExpertWithUser, type GetMeResponse, type Gym, type HttpMethod, type JoinChallengeDto, type JoinGymDto, type Leaderboard, type LeaderboardEntry, LeaderboardEntryStatus, type LeaderboardWithEntries, type Level, type LoginDto, type Media, type Member, type MemberReward, type MemberStatsResponse, type MemberWithGym, type MemberWithUser, type Notification, ROUTES, type RegisterDto, type RegisterResponse, type RequestBody, type ResponseBody, type ReviewEntryDto, type Reward, type RouteDef, type RouteMethod, type RoutePath, type Routes, type SetAvailabilityDto, type SetAvailabilityExceptionDto, type Staff, type StaffWithUser, type SubmitEntryDto, type SuccessResponse, type UpdateBookingStatusDto, type UpdateGymDto, type UpdateMemberProfileDto, type UpdateRewardDto, type User, type UserWithRoles, apiRoutes, createApi, request };
715
+ export { type Activity, type AddExpertDto, type AddMemberDto, type AddStaffDto, type AdminSummaryResponse, type AthosHttpClient, type AuthResponse, type AvailabilitySlotDto, type Booking, BookingStatus, type BookingWithExpert, type BookingWithMember, type BookingWithMemberAndExpert, type Challenge, type ChallengeOccurrence, type ChallengeOccurrenceWithDetails, type ChallengeParticipation, ChallengeVerificationType, type ChallengeWithOccurrences, type CheckIn, type CompleteChallengeDto, type CreateBookingDto, type CreateChallengeDto, type CreateCheckInDto, type CreateLeaderboardDto, type CreateOccurrenceDto, type CreateRewardDto, type Expert, type ExpertAvailability, type ExpertAvailabilityException, type ExpertAvailabilityResponse, ExpertRole, type ExpertWithUser, type GetMeResponse, type Gym, type HttpMethod, type JoinChallengeDto, type JoinGymDto, type Leaderboard, type LeaderboardEntry, LeaderboardEntryStatus, type LeaderboardWithEntries, type Level, type LoginDto, type Media, type Member, type MemberReward, type MemberStatsResponse, type MemberWithGym, type MemberWithUser, type Notification, type PaginatedResponse, type PaginationMeta, type PaginationQuery, ROUTES, type RegisterDto, type RegisterResponse, type RequestBody, type ResponseBody, type ReviewEntryDto, type Reward, type RouteDef, type RouteMethod, type RoutePath, type Routes, type SetAvailabilityDto, type SetAvailabilityExceptionDto, type Staff, type StaffWithUser, type SubmitEntryDto, type SuccessResponse, type UpdateBookingStatusDto, type UpdateGymDto, type UpdateMemberProfileDto, type UpdateRewardDto, type User, type UserWithRoles, apiRoutes, createApi, request };