swoop-common 2.2.92 → 2.2.97

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 (43) hide show
  1. package/dist/api/generated/core/exports.d.ts +11 -0
  2. package/dist/api/generated/core/index.d.ts +12 -0
  3. package/dist/api/generated/core/index.js +1 -0
  4. package/dist/api/generated/core/models/ComponentBatchRequest.d.ts +4 -0
  5. package/dist/api/generated/core/models/ComponentBatchRequest.js +1 -0
  6. package/dist/api/generated/core/models/ComponentBatchResponse.d.ts +4 -0
  7. package/dist/api/generated/core/models/ComponentBatchResponse.js +1 -0
  8. package/dist/api/generated/core/models/DTOTripComparisonCreate.d.ts +8 -0
  9. package/dist/api/generated/core/models/DTOTripComparisonCreate.js +1 -0
  10. package/dist/api/generated/core/models/DTOTripComparisonEntity.d.ts +8 -0
  11. package/dist/api/generated/core/models/DTOTripComparisonEntity.js +1 -0
  12. package/dist/api/generated/core/models/DTOTripComparisonRead.d.ts +8 -0
  13. package/dist/api/generated/core/models/DTOTripComparisonRead.js +1 -0
  14. package/dist/api/generated/core/models/DTOTripComparisonUpdate.d.ts +8 -0
  15. package/dist/api/generated/core/models/DTOTripComparisonUpdate.js +1 -0
  16. package/dist/api/generated/core/models/Trip.d.ts +8 -0
  17. package/dist/api/generated/core/models/Trip.js +1 -0
  18. package/dist/api/generated/core/models/TripComparisonEnquiryIdQueryParam.d.ts +5 -0
  19. package/dist/api/generated/core/models/TripComparisonEnquiryIdQueryParam.js +1 -0
  20. package/dist/api/generated/core/models/TripComparisonItem.d.ts +8 -0
  21. package/dist/api/generated/core/models/TripComparisonItem.js +1 -0
  22. package/dist/api/generated/core/models/TripComparisonItemId.d.ts +1 -0
  23. package/dist/api/generated/core/models/TripComparisonItemId.js +1 -0
  24. package/dist/api/generated/core/models/TripComparisonItemIdPathParam.d.ts +5 -0
  25. package/dist/api/generated/core/models/TripComparisonItemIdPathParam.js +1 -0
  26. package/dist/api/generated/core/services/ComponentService.d.ts +10 -0
  27. package/dist/api/generated/core/services/ComponentService.js +21 -0
  28. package/dist/api/generated/core/services/CoreService.d.ts +56 -0
  29. package/dist/api/generated/core/services/CoreService.js +134 -0
  30. package/dist/api/generated/core/services/PublicService.d.ts +10 -0
  31. package/dist/api/generated/core/services/PublicService.js +20 -0
  32. package/dist/api/generated/core/services/TripComparisonService.d.ts +50 -0
  33. package/dist/api/generated/core/services/TripComparisonService.js +117 -0
  34. package/dist/api/generated/swoop/exports.d.ts +2 -0
  35. package/dist/api/generated/swoop/index.d.ts +2 -0
  36. package/dist/api/generated/swoop/models/Airport.d.ts +11 -0
  37. package/dist/api/generated/swoop/models/Airport.js +1 -0
  38. package/dist/api/generated/swoop/models/Airport_jsonld.d.ts +11 -0
  39. package/dist/api/generated/swoop/models/Airport_jsonld.js +1 -0
  40. package/dist/api/generated/swoop/services/SwoopService.d.ts +11 -0
  41. package/dist/api/generated/swoop/services/SwoopService.js +20 -0
  42. package/dist/api/specsgen.js +38 -1
  43. package/package.json +2 -1
@@ -11,6 +11,8 @@ export { BookingStatus } from './index';
11
11
  export type { Branches } from './index';
12
12
  export type { BranchId } from './index';
13
13
  export type { BranchTag } from './index';
14
+ export type { ComponentBatchRequest } from './index';
15
+ export type { ComponentBatchResponse } from './index';
14
16
  export type { ComponentDescription } from './index';
15
17
  export type { ComponentFAQ } from './index';
16
18
  export type { ComponentId } from './index';
@@ -51,6 +53,10 @@ export type { DTOTemplateCreate } from './index';
51
53
  export type { DTOTemplateEntity } from './index';
52
54
  export type { DTOTemplateRead } from './index';
53
55
  export type { DTOTemplateUpdate } from './index';
56
+ export type { DTOTripComparisonCreate } from './index';
57
+ export type { DTOTripComparisonEntity } from './index';
58
+ export type { DTOTripComparisonRead } from './index';
59
+ export type { DTOTripComparisonUpdate } from './index';
54
60
  export type { EnquiryId } from './index';
55
61
  export type { EnquiryIdPathParam } from './index';
56
62
  export type { EnquiryIdQueryParam } from './index';
@@ -104,6 +110,11 @@ export type { TemplateId } from './index';
104
110
  export type { TemplateIdPathParam } from './index';
105
111
  export type { TemplateRevisionGroupId } from './index';
106
112
  export type { Title } from './index';
113
+ export type { Trip } from './index';
114
+ export type { TripComparisonEnquiryIdQueryParam } from './index';
115
+ export type { TripComparisonItem } from './index';
116
+ export type { TripComparisonItemId } from './index';
117
+ export type { TripComparisonItemIdPathParam } from './index';
107
118
  export type { TripId } from './index';
108
119
  export { UrgencyCTA } from './index';
109
120
  export type { UserComponentInstanceField } from './index';
@@ -11,6 +11,8 @@ export { BookingStatus } from './models/BookingStatus';
11
11
  export type { Branches } from './models/Branches';
12
12
  export type { BranchId } from './models/BranchId';
13
13
  export type { BranchTag } from './models/BranchTag';
14
+ export type { ComponentBatchRequest } from './models/ComponentBatchRequest';
15
+ export type { ComponentBatchResponse } from './models/ComponentBatchResponse';
14
16
  export type { ComponentDescription } from './models/ComponentDescription';
15
17
  export type { ComponentFAQ } from './models/ComponentFAQ';
16
18
  export type { ComponentId } from './models/ComponentId';
@@ -51,6 +53,10 @@ export type { DTOTemplateCreate } from './models/DTOTemplateCreate';
51
53
  export type { DTOTemplateEntity } from './models/DTOTemplateEntity';
52
54
  export type { DTOTemplateRead } from './models/DTOTemplateRead';
53
55
  export type { DTOTemplateUpdate } from './models/DTOTemplateUpdate';
56
+ export type { DTOTripComparisonCreate } from './models/DTOTripComparisonCreate';
57
+ export type { DTOTripComparisonEntity } from './models/DTOTripComparisonEntity';
58
+ export type { DTOTripComparisonRead } from './models/DTOTripComparisonRead';
59
+ export type { DTOTripComparisonUpdate } from './models/DTOTripComparisonUpdate';
54
60
  export type { EnquiryId } from './models/EnquiryId';
55
61
  export type { EnquiryIdPathParam } from './models/EnquiryIdPathParam';
56
62
  export type { EnquiryIdQueryParam } from './models/EnquiryIdQueryParam';
@@ -104,6 +110,11 @@ export type { TemplateId } from './models/TemplateId';
104
110
  export type { TemplateIdPathParam } from './models/TemplateIdPathParam';
105
111
  export type { TemplateRevisionGroupId } from './models/TemplateRevisionGroupId';
106
112
  export type { Title } from './models/Title';
113
+ export type { Trip } from './models/Trip';
114
+ export type { TripComparisonEnquiryIdQueryParam } from './models/TripComparisonEnquiryIdQueryParam';
115
+ export type { TripComparisonItem } from './models/TripComparisonItem';
116
+ export type { TripComparisonItemId } from './models/TripComparisonItemId';
117
+ export type { TripComparisonItemIdPathParam } from './models/TripComparisonItemIdPathParam';
107
118
  export type { TripId } from './models/TripId';
108
119
  export { UrgencyCTA } from './models/UrgencyCTA';
109
120
  export type { UserComponentInstanceField } from './models/UserComponentInstanceField';
@@ -116,3 +127,4 @@ export { PublicService } from './services/PublicService';
116
127
  export { RegionService } from './services/RegionService';
117
128
  export { SnapshotService } from './services/SnapshotService';
118
129
  export { TemplateService } from './services/TemplateService';
130
+ export { TripComparisonService } from './services/TripComparisonService';
@@ -21,3 +21,4 @@ export { PublicService } from './services/PublicService';
21
21
  export { RegionService } from './services/RegionService';
22
22
  export { SnapshotService } from './services/SnapshotService';
23
23
  export { TemplateService } from './services/TemplateService';
24
+ export { TripComparisonService } from './services/TripComparisonService';
@@ -0,0 +1,4 @@
1
+ import type { ComponentId } from './ComponentId';
2
+ export type ComponentBatchRequest = {
3
+ componentIds: Array<ComponentId>;
4
+ };
@@ -0,0 +1,4 @@
1
+ import type { DTOComponentRead } from './DTOComponentRead';
2
+ export type ComponentBatchResponse = {
3
+ data: Array<DTOComponentRead>;
4
+ };
@@ -0,0 +1,8 @@
1
+ import type { InternalSwoopId } from './InternalSwoopId';
2
+ import type { Trip } from './Trip';
3
+ export type DTOTripComparisonCreate = {
4
+ enquiryId: InternalSwoopId;
5
+ headerContent: string;
6
+ trips: Array<Trip>;
7
+ selectedSalesStaff: Record<string, any>;
8
+ };
@@ -0,0 +1,8 @@
1
+ import type { InternalSwoopId } from './InternalSwoopId';
2
+ import type { Metadata } from './Metadata';
3
+ import type { TripComparisonItem } from './TripComparisonItem';
4
+ export type DTOTripComparisonEntity = {
5
+ enquiryId: InternalSwoopId;
6
+ metadata: Metadata;
7
+ items: Array<TripComparisonItem>;
8
+ };
@@ -0,0 +1,8 @@
1
+ import type { Trip } from './Trip';
2
+ import type { TripComparisonItemId } from './TripComparisonItemId';
3
+ export type DTOTripComparisonRead = {
4
+ uuid: TripComparisonItemId;
5
+ headerContent: string;
6
+ trips: Array<Trip>;
7
+ selectedSalesStaff: Record<string, any>;
8
+ };
@@ -0,0 +1,8 @@
1
+ import type { InternalSwoopId } from './InternalSwoopId';
2
+ import type { Trip } from './Trip';
3
+ export type DTOTripComparisonUpdate = {
4
+ enquiryId: InternalSwoopId;
5
+ headerContent: string;
6
+ trips: Array<Trip>;
7
+ selectedSalesStaff: Record<string, any>;
8
+ };
@@ -0,0 +1,8 @@
1
+ export type Trip = {
2
+ optionName: string;
3
+ whatMakesThisTrip: string;
4
+ selectedComponent?: Record<string, any>;
5
+ selectedDeparture?: Record<string, any>;
6
+ selectedCabin?: Record<string, any>;
7
+ selectedImageUrl?: string;
8
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ import type { InternalSwoopId } from './InternalSwoopId';
2
+ /**
3
+ * Enquiry ID for trip comparison lookup
4
+ */
5
+ export type TripComparisonEnquiryIdQueryParam = InternalSwoopId;
@@ -0,0 +1,8 @@
1
+ import type { Trip } from './Trip';
2
+ import type { TripComparisonItemId } from './TripComparisonItemId';
3
+ export type TripComparisonItem = {
4
+ uuid: TripComparisonItemId;
5
+ headerContent: string;
6
+ trips: Array<Trip>;
7
+ selectedSalesStaff: Record<string, any>;
8
+ };
@@ -0,0 +1 @@
1
+ export type TripComparisonItemId = string;
@@ -0,0 +1,5 @@
1
+ import type { TripComparisonItemId } from './TripComparisonItemId';
2
+ /**
3
+ * UUID of a trip comparison item
4
+ */
5
+ export type TripComparisonItemIdPathParam = TripComparisonItemId;
@@ -1,3 +1,5 @@
1
+ import type { ComponentBatchRequest } from '../models/ComponentBatchRequest';
2
+ import type { ComponentBatchResponse } from '../models/ComponentBatchResponse';
1
3
  import type { ComponentId } from '../models/ComponentId';
2
4
  import type { ComponentState } from '../models/ComponentState';
3
5
  import type { DTOComponentCreate } from '../models/DTOComponentCreate';
@@ -30,6 +32,14 @@ export declare class ComponentService {
30
32
  * @throws ApiError
31
33
  */
32
34
  static componentCreate(requestBody: DTOComponentCreate): CancelablePromise<DTOComponentRead>;
35
+ /**
36
+ * Get Components by IDs
37
+ * Get multiple components by providing an array of component IDs
38
+ * @param requestBody
39
+ * @returns ComponentBatchResponse Successfully retrieved components
40
+ * @throws ApiError
41
+ */
42
+ static componentBatchGet(requestBody: ComponentBatchRequest): CancelablePromise<ComponentBatchResponse>;
33
43
  /**
34
44
  * Get Component
35
45
  * Get Component via ID
@@ -53,6 +53,27 @@ export class ComponentService {
53
53
  },
54
54
  });
55
55
  }
56
+ /**
57
+ * Get Components by IDs
58
+ * Get multiple components by providing an array of component IDs
59
+ * @param requestBody
60
+ * @returns ComponentBatchResponse Successfully retrieved components
61
+ * @throws ApiError
62
+ */
63
+ static componentBatchGet(requestBody) {
64
+ return __request(OpenAPI, {
65
+ method: 'POST',
66
+ url: '/component/batch',
67
+ body: requestBody,
68
+ mediaType: 'application/json',
69
+ errors: {
70
+ 400: `If the payload is malformed`,
71
+ 401: `Unauthorized - Missing or invalid Authorization header`,
72
+ 403: `Forbidden - The client is authenticated but not authorized to access this resource`,
73
+ 500: `Internal Server Error`,
74
+ },
75
+ });
76
+ }
56
77
  /**
57
78
  * Get Component
58
79
  * Get Component via ID
@@ -1,5 +1,7 @@
1
1
  import type { Branches } from '../models/Branches';
2
2
  import type { BranchTag } from '../models/BranchTag';
3
+ import type { ComponentBatchRequest } from '../models/ComponentBatchRequest';
4
+ import type { ComponentBatchResponse } from '../models/ComponentBatchResponse';
3
5
  import type { ComponentId } from '../models/ComponentId';
4
6
  import type { ComponentState } from '../models/ComponentState';
5
7
  import type { DTOComponentCreate } from '../models/DTOComponentCreate';
@@ -16,11 +18,15 @@ import type { DTOSnapshotRead } from '../models/DTOSnapshotRead';
16
18
  import type { DTOTemplateCreate } from '../models/DTOTemplateCreate';
17
19
  import { DTOTemplateRead } from '../models/DTOTemplateRead';
18
20
  import type { DTOTemplateUpdate } from '../models/DTOTemplateUpdate';
21
+ import type { DTOTripComparisonCreate } from '../models/DTOTripComparisonCreate';
22
+ import type { DTOTripComparisonRead } from '../models/DTOTripComparisonRead';
23
+ import type { DTOTripComparisonUpdate } from '../models/DTOTripComparisonUpdate';
19
24
  import type { InternalSwoopId } from '../models/InternalSwoopId';
20
25
  import type { ItineraryCreateResponse } from '../models/ItineraryCreateResponse';
21
26
  import type { Pagination } from '../models/Pagination';
22
27
  import type { SnapshotId } from '../models/SnapshotId';
23
28
  import type { TemplateId } from '../models/TemplateId';
29
+ import type { TripComparisonItemId } from '../models/TripComparisonItemId';
24
30
  import { CancelablePromise } from '../core/CancelablePromise';
25
31
  export declare class CoreService {
26
32
  /**
@@ -249,6 +255,14 @@ export declare class CoreService {
249
255
  * @throws ApiError
250
256
  */
251
257
  componentCreate(requestBody: DTOComponentCreate): CancelablePromise<DTOComponentRead>;
258
+ /**
259
+ * Get Components by IDs
260
+ * Get multiple components by providing an array of component IDs
261
+ * @param requestBody
262
+ * @returns ComponentBatchResponse Successfully retrieved components
263
+ * @throws ApiError
264
+ */
265
+ componentBatchGet(requestBody: ComponentBatchRequest): CancelablePromise<ComponentBatchResponse>;
252
266
  /**
253
267
  * Get Component
254
268
  * Get Component via ID
@@ -292,6 +306,48 @@ export declare class CoreService {
292
306
  * @throws ApiError
293
307
  */
294
308
  componentStateUpdate(componentId: ComponentId, state: ComponentState): CancelablePromise<DTOComponentRead>;
309
+ /**
310
+ * List Trip Comparisons by Enquiry ID
311
+ * Retrieves all trip comparison items for a specific enquiryId.
312
+ * @param enquiryId The enquiry ID to fetch all trip comparisons for
313
+ * @returns DTOTripComparisonRead When trip comparisons are retrieved successfully
314
+ * @throws ApiError
315
+ */
316
+ tripComparisonList(enquiryId: string): CancelablePromise<Array<DTOTripComparisonRead>>;
317
+ /**
318
+ * Create a Trip Comparison
319
+ * Creates a new trip comparison item for an enquiry. If a document for the enquiryId doesn't exist, it will be created. If it exists, the new item will be appended to the items array. A UUID will be generated by the backend.
320
+ * @param requestBody
321
+ * @returns DTOTripComparisonRead When the trip comparison item is created
322
+ * @throws ApiError
323
+ */
324
+ tripComparisonCreate(requestBody: DTOTripComparisonCreate): CancelablePromise<DTOTripComparisonRead>;
325
+ /**
326
+ * Update a Trip Comparison
327
+ * Updates an existing trip comparison item by UUID. Finds the document by enquiryId, locates the item by UUID, and replaces the entire item's data. Updates metadata timestamps.
328
+ * @param uuid UUID of a trip comparison item
329
+ * @param requestBody
330
+ * @returns DTOTripComparisonRead When the trip comparison item is updated successfully
331
+ * @throws ApiError
332
+ */
333
+ tripComparisonUpdate(uuid: TripComparisonItemId, requestBody: DTOTripComparisonUpdate): CancelablePromise<DTOTripComparisonRead>;
334
+ /**
335
+ * Delete a Trip Comparison
336
+ * Deletes a trip comparison item by UUID. Finds the document by enquiryId and removes the item with the matching UUID from the items array. The document will remain even if the items array becomes empty.
337
+ * @param uuid UUID of a trip comparison item
338
+ * @param enquiryId Enquiry ID for trip comparison lookup
339
+ * @returns void
340
+ * @throws ApiError
341
+ */
342
+ tripComparisonDelete(uuid: TripComparisonItemId, enquiryId: InternalSwoopId): CancelablePromise<void>;
343
+ /**
344
+ * Get Trip Comparison (Public)
345
+ * Fetches a single trip comparison item by UUID. This is a public endpoint that doesn't require authentication.
346
+ * @param uuid UUID of a trip comparison item
347
+ * @returns DTOTripComparisonRead The trip comparison item
348
+ * @throws ApiError
349
+ */
350
+ publicTripComparisonGet(uuid: TripComparisonItemId): CancelablePromise<DTOTripComparisonRead>;
295
351
  /**
296
352
  * Resolve template hierarchy
297
353
  * @returns Array<DTOTemplateRead> OK
@@ -552,6 +552,27 @@ export class CoreService {
552
552
  },
553
553
  });
554
554
  }
555
+ /**
556
+ * Get Components by IDs
557
+ * Get multiple components by providing an array of component IDs
558
+ * @param requestBody
559
+ * @returns ComponentBatchResponse Successfully retrieved components
560
+ * @throws ApiError
561
+ */
562
+ componentBatchGet(requestBody) {
563
+ return __request(OpenAPI, {
564
+ method: 'POST',
565
+ url: '/component/batch',
566
+ body: requestBody,
567
+ mediaType: 'application/json',
568
+ errors: {
569
+ 400: `If the payload is malformed`,
570
+ 401: `Unauthorized - Missing or invalid Authorization header`,
571
+ 403: `Forbidden - The client is authenticated but not authorized to access this resource`,
572
+ 500: `Internal Server Error`,
573
+ },
574
+ });
575
+ }
555
576
  /**
556
577
  * Get Component
557
578
  * Get Component via ID
@@ -677,6 +698,119 @@ export class CoreService {
677
698
  },
678
699
  });
679
700
  }
701
+ /**
702
+ * List Trip Comparisons by Enquiry ID
703
+ * Retrieves all trip comparison items for a specific enquiryId.
704
+ * @param enquiryId The enquiry ID to fetch all trip comparisons for
705
+ * @returns DTOTripComparisonRead When trip comparisons are retrieved successfully
706
+ * @throws ApiError
707
+ */
708
+ tripComparisonList(enquiryId) {
709
+ return __request(OpenAPI, {
710
+ method: 'GET',
711
+ url: '/trip-comparison',
712
+ query: {
713
+ 'enquiryId': enquiryId,
714
+ },
715
+ errors: {
716
+ 400: `If the enquiryId parameter is missing`,
717
+ 401: `When the client is not authorised`,
718
+ 404: `If no trip comparisons exist for the enquiryId`,
719
+ 500: `When an unexpected error occurs`,
720
+ },
721
+ });
722
+ }
723
+ /**
724
+ * Create a Trip Comparison
725
+ * Creates a new trip comparison item for an enquiry. If a document for the enquiryId doesn't exist, it will be created. If it exists, the new item will be appended to the items array. A UUID will be generated by the backend.
726
+ * @param requestBody
727
+ * @returns DTOTripComparisonRead When the trip comparison item is created
728
+ * @throws ApiError
729
+ */
730
+ tripComparisonCreate(requestBody) {
731
+ return __request(OpenAPI, {
732
+ method: 'POST',
733
+ url: '/trip-comparison',
734
+ body: requestBody,
735
+ mediaType: 'application/json',
736
+ errors: {
737
+ 400: `If the payload is malformed`,
738
+ 401: `When the client is not authorised`,
739
+ 500: `When an unexpected error occurs`,
740
+ },
741
+ });
742
+ }
743
+ /**
744
+ * Update a Trip Comparison
745
+ * Updates an existing trip comparison item by UUID. Finds the document by enquiryId, locates the item by UUID, and replaces the entire item's data. Updates metadata timestamps.
746
+ * @param uuid UUID of a trip comparison item
747
+ * @param requestBody
748
+ * @returns DTOTripComparisonRead When the trip comparison item is updated successfully
749
+ * @throws ApiError
750
+ */
751
+ tripComparisonUpdate(uuid, requestBody) {
752
+ return __request(OpenAPI, {
753
+ method: 'PUT',
754
+ url: '/trip-comparison/{uuid}',
755
+ path: {
756
+ 'uuid': uuid,
757
+ },
758
+ body: requestBody,
759
+ mediaType: 'application/json',
760
+ errors: {
761
+ 400: `If the payload is malformed`,
762
+ 401: `When the client is not authorised`,
763
+ 404: `If the trip comparison item does not exist`,
764
+ 500: `When an unexpected error occurs`,
765
+ },
766
+ });
767
+ }
768
+ /**
769
+ * Delete a Trip Comparison
770
+ * Deletes a trip comparison item by UUID. Finds the document by enquiryId and removes the item with the matching UUID from the items array. The document will remain even if the items array becomes empty.
771
+ * @param uuid UUID of a trip comparison item
772
+ * @param enquiryId Enquiry ID for trip comparison lookup
773
+ * @returns void
774
+ * @throws ApiError
775
+ */
776
+ tripComparisonDelete(uuid, enquiryId) {
777
+ return __request(OpenAPI, {
778
+ method: 'DELETE',
779
+ url: '/trip-comparison/{uuid}',
780
+ path: {
781
+ 'uuid': uuid,
782
+ },
783
+ query: {
784
+ 'enquiryId': enquiryId,
785
+ },
786
+ errors: {
787
+ 400: `If the payload is malformed`,
788
+ 401: `When the client is not authorised`,
789
+ 404: `If the trip comparison item does not exist`,
790
+ 500: `When an unexpected error occurs`,
791
+ },
792
+ });
793
+ }
794
+ /**
795
+ * Get Trip Comparison (Public)
796
+ * Fetches a single trip comparison item by UUID. This is a public endpoint that doesn't require authentication.
797
+ * @param uuid UUID of a trip comparison item
798
+ * @returns DTOTripComparisonRead The trip comparison item
799
+ * @throws ApiError
800
+ */
801
+ publicTripComparisonGet(uuid) {
802
+ return __request(OpenAPI, {
803
+ method: 'GET',
804
+ url: '/public/trip-comparison/{uuid}',
805
+ path: {
806
+ 'uuid': uuid,
807
+ },
808
+ errors: {
809
+ 404: `If the trip comparison item does not exist`,
810
+ 500: `When an unexpected error occurs`,
811
+ },
812
+ });
813
+ }
680
814
  /**
681
815
  * Resolve template hierarchy
682
816
  * @returns Array<DTOTemplateRead> OK
@@ -1,5 +1,7 @@
1
1
  import type { DTOPublicSnapshotRead } from '../models/DTOPublicSnapshotRead';
2
+ import type { DTOTripComparisonRead } from '../models/DTOTripComparisonRead';
2
3
  import type { SnapshotId } from '../models/SnapshotId';
4
+ import type { TripComparisonItemId } from '../models/TripComparisonItemId';
3
5
  import type { CancelablePromise } from '../core/CancelablePromise';
4
6
  export declare class PublicService {
5
7
  /**
@@ -9,4 +11,12 @@ export declare class PublicService {
9
11
  * @throws ApiError
10
12
  */
11
13
  static publicSnapshotList(snapshotId: SnapshotId): CancelablePromise<DTOPublicSnapshotRead>;
14
+ /**
15
+ * Get Trip Comparison (Public)
16
+ * Fetches a single trip comparison item by UUID. This is a public endpoint that doesn't require authentication.
17
+ * @param uuid UUID of a trip comparison item
18
+ * @returns DTOTripComparisonRead The trip comparison item
19
+ * @throws ApiError
20
+ */
21
+ static publicTripComparisonGet(uuid: TripComparisonItemId): CancelablePromise<DTOTripComparisonRead>;
12
22
  }
@@ -23,4 +23,24 @@ export class PublicService {
23
23
  },
24
24
  });
25
25
  }
26
+ /**
27
+ * Get Trip Comparison (Public)
28
+ * Fetches a single trip comparison item by UUID. This is a public endpoint that doesn't require authentication.
29
+ * @param uuid UUID of a trip comparison item
30
+ * @returns DTOTripComparisonRead The trip comparison item
31
+ * @throws ApiError
32
+ */
33
+ static publicTripComparisonGet(uuid) {
34
+ return __request(OpenAPI, {
35
+ method: 'GET',
36
+ url: '/public/trip-comparison/{uuid}',
37
+ path: {
38
+ 'uuid': uuid,
39
+ },
40
+ errors: {
41
+ 404: `If the trip comparison item does not exist`,
42
+ 500: `When an unexpected error occurs`,
43
+ },
44
+ });
45
+ }
26
46
  }
@@ -0,0 +1,50 @@
1
+ import type { DTOTripComparisonCreate } from '../models/DTOTripComparisonCreate';
2
+ import type { DTOTripComparisonRead } from '../models/DTOTripComparisonRead';
3
+ import type { DTOTripComparisonUpdate } from '../models/DTOTripComparisonUpdate';
4
+ import type { InternalSwoopId } from '../models/InternalSwoopId';
5
+ import type { TripComparisonItemId } from '../models/TripComparisonItemId';
6
+ import type { CancelablePromise } from '../core/CancelablePromise';
7
+ export declare class TripComparisonService {
8
+ /**
9
+ * List Trip Comparisons by Enquiry ID
10
+ * Retrieves all trip comparison items for a specific enquiryId.
11
+ * @param enquiryId The enquiry ID to fetch all trip comparisons for
12
+ * @returns DTOTripComparisonRead When trip comparisons are retrieved successfully
13
+ * @throws ApiError
14
+ */
15
+ static tripComparisonList(enquiryId: string): CancelablePromise<Array<DTOTripComparisonRead>>;
16
+ /**
17
+ * Create a Trip Comparison
18
+ * Creates a new trip comparison item for an enquiry. If a document for the enquiryId doesn't exist, it will be created. If it exists, the new item will be appended to the items array. A UUID will be generated by the backend.
19
+ * @param requestBody
20
+ * @returns DTOTripComparisonRead When the trip comparison item is created
21
+ * @throws ApiError
22
+ */
23
+ static tripComparisonCreate(requestBody: DTOTripComparisonCreate): CancelablePromise<DTOTripComparisonRead>;
24
+ /**
25
+ * Update a Trip Comparison
26
+ * Updates an existing trip comparison item by UUID. Finds the document by enquiryId, locates the item by UUID, and replaces the entire item's data. Updates metadata timestamps.
27
+ * @param uuid UUID of a trip comparison item
28
+ * @param requestBody
29
+ * @returns DTOTripComparisonRead When the trip comparison item is updated successfully
30
+ * @throws ApiError
31
+ */
32
+ static tripComparisonUpdate(uuid: TripComparisonItemId, requestBody: DTOTripComparisonUpdate): CancelablePromise<DTOTripComparisonRead>;
33
+ /**
34
+ * Delete a Trip Comparison
35
+ * Deletes a trip comparison item by UUID. Finds the document by enquiryId and removes the item with the matching UUID from the items array. The document will remain even if the items array becomes empty.
36
+ * @param uuid UUID of a trip comparison item
37
+ * @param enquiryId Enquiry ID for trip comparison lookup
38
+ * @returns void
39
+ * @throws ApiError
40
+ */
41
+ static tripComparisonDelete(uuid: TripComparisonItemId, enquiryId: InternalSwoopId): CancelablePromise<void>;
42
+ /**
43
+ * Get Trip Comparison (Public)
44
+ * Fetches a single trip comparison item by UUID. This is a public endpoint that doesn't require authentication.
45
+ * @param uuid UUID of a trip comparison item
46
+ * @returns DTOTripComparisonRead The trip comparison item
47
+ * @throws ApiError
48
+ */
49
+ static publicTripComparisonGet(uuid: TripComparisonItemId): CancelablePromise<DTOTripComparisonRead>;
50
+ }
@@ -0,0 +1,117 @@
1
+ import { OpenAPI } from '../core/OpenAPI';
2
+ import { request as __request } from '../core/request';
3
+ export class TripComparisonService {
4
+ /**
5
+ * List Trip Comparisons by Enquiry ID
6
+ * Retrieves all trip comparison items for a specific enquiryId.
7
+ * @param enquiryId The enquiry ID to fetch all trip comparisons for
8
+ * @returns DTOTripComparisonRead When trip comparisons are retrieved successfully
9
+ * @throws ApiError
10
+ */
11
+ static tripComparisonList(enquiryId) {
12
+ return __request(OpenAPI, {
13
+ method: 'GET',
14
+ url: '/trip-comparison',
15
+ query: {
16
+ 'enquiryId': enquiryId,
17
+ },
18
+ errors: {
19
+ 400: `If the enquiryId parameter is missing`,
20
+ 401: `When the client is not authorised`,
21
+ 404: `If no trip comparisons exist for the enquiryId`,
22
+ 500: `When an unexpected error occurs`,
23
+ },
24
+ });
25
+ }
26
+ /**
27
+ * Create a Trip Comparison
28
+ * Creates a new trip comparison item for an enquiry. If a document for the enquiryId doesn't exist, it will be created. If it exists, the new item will be appended to the items array. A UUID will be generated by the backend.
29
+ * @param requestBody
30
+ * @returns DTOTripComparisonRead When the trip comparison item is created
31
+ * @throws ApiError
32
+ */
33
+ static tripComparisonCreate(requestBody) {
34
+ return __request(OpenAPI, {
35
+ method: 'POST',
36
+ url: '/trip-comparison',
37
+ body: requestBody,
38
+ mediaType: 'application/json',
39
+ errors: {
40
+ 400: `If the payload is malformed`,
41
+ 401: `When the client is not authorised`,
42
+ 500: `When an unexpected error occurs`,
43
+ },
44
+ });
45
+ }
46
+ /**
47
+ * Update a Trip Comparison
48
+ * Updates an existing trip comparison item by UUID. Finds the document by enquiryId, locates the item by UUID, and replaces the entire item's data. Updates metadata timestamps.
49
+ * @param uuid UUID of a trip comparison item
50
+ * @param requestBody
51
+ * @returns DTOTripComparisonRead When the trip comparison item is updated successfully
52
+ * @throws ApiError
53
+ */
54
+ static tripComparisonUpdate(uuid, requestBody) {
55
+ return __request(OpenAPI, {
56
+ method: 'PUT',
57
+ url: '/trip-comparison/{uuid}',
58
+ path: {
59
+ 'uuid': uuid,
60
+ },
61
+ body: requestBody,
62
+ mediaType: 'application/json',
63
+ errors: {
64
+ 400: `If the payload is malformed`,
65
+ 401: `When the client is not authorised`,
66
+ 404: `If the trip comparison item does not exist`,
67
+ 500: `When an unexpected error occurs`,
68
+ },
69
+ });
70
+ }
71
+ /**
72
+ * Delete a Trip Comparison
73
+ * Deletes a trip comparison item by UUID. Finds the document by enquiryId and removes the item with the matching UUID from the items array. The document will remain even if the items array becomes empty.
74
+ * @param uuid UUID of a trip comparison item
75
+ * @param enquiryId Enquiry ID for trip comparison lookup
76
+ * @returns void
77
+ * @throws ApiError
78
+ */
79
+ static tripComparisonDelete(uuid, enquiryId) {
80
+ return __request(OpenAPI, {
81
+ method: 'DELETE',
82
+ url: '/trip-comparison/{uuid}',
83
+ path: {
84
+ 'uuid': uuid,
85
+ },
86
+ query: {
87
+ 'enquiryId': enquiryId,
88
+ },
89
+ errors: {
90
+ 400: `If the payload is malformed`,
91
+ 401: `When the client is not authorised`,
92
+ 404: `If the trip comparison item does not exist`,
93
+ 500: `When an unexpected error occurs`,
94
+ },
95
+ });
96
+ }
97
+ /**
98
+ * Get Trip Comparison (Public)
99
+ * Fetches a single trip comparison item by UUID. This is a public endpoint that doesn't require authentication.
100
+ * @param uuid UUID of a trip comparison item
101
+ * @returns DTOTripComparisonRead The trip comparison item
102
+ * @throws ApiError
103
+ */
104
+ static publicTripComparisonGet(uuid) {
105
+ return __request(OpenAPI, {
106
+ method: 'GET',
107
+ url: '/public/trip-comparison/{uuid}',
108
+ path: {
109
+ 'uuid': uuid,
110
+ },
111
+ errors: {
112
+ 404: `If the trip comparison item does not exist`,
113
+ 500: `When an unexpected error occurs`,
114
+ },
115
+ });
116
+ }
117
+ }
@@ -1,5 +1,7 @@
1
1
  export type { AddressSwoop } from './index';
2
2
  export type { Address_jsonldSwoop } from './index';
3
+ export type { AirportSwoop } from './index';
4
+ export type { Airport_jsonldSwoop } from './index';
3
5
  export type { BookingGroupSwoop } from './index';
4
6
  export type { BookingGroup_jsonldSwoop } from './index';
5
7
  export type { BookingItemTypeSwoop } from './index';
@@ -4,6 +4,8 @@ export { OpenAPI } from './core/OpenAPI';
4
4
  export type { OpenAPIConfig } from './core/OpenAPI';
5
5
  export type { Address as AddressSwoop } from './models/Address';
6
6
  export type { Address_jsonld as Address_jsonldSwoop } from './models/Address_jsonld';
7
+ export type { Airport as AirportSwoop } from './models/Airport';
8
+ export type { Airport_jsonld as Airport_jsonldSwoop } from './models/Airport_jsonld';
7
9
  export type { BookingGroup as BookingGroupSwoop } from './models/BookingGroup';
8
10
  export type { BookingGroup_jsonld as BookingGroup_jsonldSwoop } from './models/BookingGroup_jsonld';
9
11
  export type { BookingItemType as BookingItemTypeSwoop } from './models/BookingItemType';
@@ -0,0 +1,11 @@
1
+ export type Airport = {
2
+ airportId?: number;
3
+ name?: string;
4
+ city?: string;
5
+ country?: string;
6
+ aitaCode?: string;
7
+ icaoCode?: string;
8
+ latitude?: string;
9
+ longitude?: string;
10
+ timezone?: string;
11
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ export type Airport_jsonld = {
2
+ airportId?: number;
3
+ name?: string;
4
+ city?: string;
5
+ country?: string;
6
+ aitaCode?: string;
7
+ icaoCode?: string;
8
+ latitude?: string;
9
+ longitude?: string;
10
+ timezone?: string;
11
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -1,3 +1,4 @@
1
+ import type { Airport } from '../models/Airport';
1
2
  import type { BookingGroup } from '../models/BookingGroup';
2
3
  import type { BookingItemType } from '../models/BookingItemType';
3
4
  import type { CabinData } from '../models/CabinData';
@@ -23,6 +24,16 @@ import type { Trip } from '../models/Trip';
23
24
  import type { TripVariant } from '../models/TripVariant';
24
25
  import type { CancelablePromise } from '../core/CancelablePromise';
25
26
  export declare class SwoopService {
27
+ /**
28
+ * Retrieves the collection of Airport resources.
29
+ * Retrieves the collection of Airport resources.
30
+ * @param page The collection page number
31
+ * @param itemsPerPage The number of items per page
32
+ * @param q Search filter
33
+ * @returns Airport Airport collection
34
+ * @throws ApiError
35
+ */
36
+ airportsGetCollection(page?: number, itemsPerPage?: number, q?: string): CancelablePromise<Array<Airport>>;
26
37
  /**
27
38
  * Retrieves a BookingGroup resource.
28
39
  * Retrieves a BookingGroup resource.
@@ -1,6 +1,26 @@
1
1
  import { OpenAPI } from '../core/OpenAPI';
2
2
  import { request as __request } from '../core/request';
3
3
  export class SwoopService {
4
+ /**
5
+ * Retrieves the collection of Airport resources.
6
+ * Retrieves the collection of Airport resources.
7
+ * @param page The collection page number
8
+ * @param itemsPerPage The number of items per page
9
+ * @param q Search filter
10
+ * @returns Airport Airport collection
11
+ * @throws ApiError
12
+ */
13
+ airportsGetCollection(page = 1, itemsPerPage = 30, q) {
14
+ return __request(OpenAPI, {
15
+ method: 'GET',
16
+ url: '/api/airports',
17
+ query: {
18
+ 'page': page,
19
+ 'itemsPerPage': itemsPerPage,
20
+ 'q': q,
21
+ },
22
+ });
23
+ }
4
24
  /**
5
25
  * Retrieves a BookingGroup resource.
6
26
  * Retrieves a BookingGroup resource.
@@ -1,7 +1,40 @@
1
1
  import fs from "fs";
2
2
  import yaml from "js-yaml";
3
- fetch("https://data-test.swoop-adventures.com/api/docs.jsonopenapi").then(res => {
3
+ import { config } from "dotenv";
4
+ // Load environment variables from .env file
5
+ if (!process.env.GITHUB_ACTIONS) {
6
+ config(); // only load .env locally
7
+ }
8
+ const bearerToken = process.env.SWOOP_API_TOKEN;
9
+ const swoopApiUrl = process.env.SWOOP_API_URL;
10
+ if (!swoopApiUrl) {
11
+ console.error('Error: SWOOP_API_URL environment variable is not set');
12
+ console.error('Please provide the base URL for the Swoop API');
13
+ process.exit(1);
14
+ }
15
+ if (!bearerToken) {
16
+ console.error('Error: SWOOP_API_TOKEN environment variable is not set');
17
+ console.error('Please provide a bearer token to authenticate with the API');
18
+ process.exit(1);
19
+ }
20
+ console.log('Fetching API specifications with provided bearer token...', bearerToken);
21
+ const headers = {
22
+ 'Authorization': `Bearer ${bearerToken}`
23
+ };
24
+ fetch(`${swoopApiUrl}/api/docs.jsonopenapi`, { headers }).then(res => {
25
+ if (!res.ok) {
26
+ console.error(`Failed to fetch specs: ${res.status} ${res.statusText}`);
27
+ if (res.status === 401 || res.status === 403) {
28
+ console.error('Authentication failed. Please check your SWOOP_API_TOKEN');
29
+ }
30
+ process.exit(1);
31
+ }
4
32
  res.text().then(json => {
33
+ // Check if we got HTML instead of JSON (login page)
34
+ if (json.trim().startsWith('<!DOCTYPE') || json.trim().startsWith('<html')) {
35
+ console.error('Received HTML instead of JSON - authentication may have failed');
36
+ process.exit(1);
37
+ }
5
38
  // I should really use ast or properly parse it, but I have found that its more effort than it is worth
6
39
  // api_api is on each opertaion name. (Makes the generated sdk wordy and annoying to use)
7
40
  const cleaned = json.replace(/api_api/g, "");
@@ -18,5 +51,9 @@ fetch("https://data-test.swoop-adventures.com/api/docs.jsonopenapi").then(res =>
18
51
  });
19
52
  });
20
53
  fs.writeFileSync(`./openapi/swoop_service.yaml`, yaml.dump(parsed));
54
+ console.log('Successfully generated swoop_service.yaml');
21
55
  });
56
+ }).catch(err => {
57
+ console.error('Error fetching API specs:', err.message);
58
+ process.exit(1);
22
59
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "swoop-common",
3
- "version": "2.2.92",
3
+ "version": "2.2.97",
4
4
  "main": "dist/api/index.js",
5
5
  "types": "dist/api/index.d.ts",
6
6
  "exports": {
@@ -60,6 +60,7 @@
60
60
  "@types/lodash.merge": "^4.6.9",
61
61
  "@types/node": "^24.0.14",
62
62
  "@types/react": "^19",
63
+ "dotenv": "^17.3.1",
63
64
  "openapi-typescript-codegen": "^0.29.0",
64
65
  "tsx": "^4.20.3",
65
66
  "typescript": "^5.8.3"