swoop-common 2.2.92 → 2.2.96

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 (37) hide show
  1. package/dist/api/generated/core/exports.d.ts +9 -0
  2. package/dist/api/generated/core/index.d.ts +10 -0
  3. package/dist/api/generated/core/index.js +1 -0
  4. package/dist/api/generated/core/models/DTOTripComparisonCreate.d.ts +8 -0
  5. package/dist/api/generated/core/models/DTOTripComparisonCreate.js +1 -0
  6. package/dist/api/generated/core/models/DTOTripComparisonEntity.d.ts +8 -0
  7. package/dist/api/generated/core/models/DTOTripComparisonEntity.js +1 -0
  8. package/dist/api/generated/core/models/DTOTripComparisonRead.d.ts +8 -0
  9. package/dist/api/generated/core/models/DTOTripComparisonRead.js +1 -0
  10. package/dist/api/generated/core/models/DTOTripComparisonUpdate.d.ts +8 -0
  11. package/dist/api/generated/core/models/DTOTripComparisonUpdate.js +1 -0
  12. package/dist/api/generated/core/models/Trip.d.ts +8 -0
  13. package/dist/api/generated/core/models/Trip.js +1 -0
  14. package/dist/api/generated/core/models/TripComparisonEnquiryIdQueryParam.d.ts +5 -0
  15. package/dist/api/generated/core/models/TripComparisonEnquiryIdQueryParam.js +1 -0
  16. package/dist/api/generated/core/models/TripComparisonItem.d.ts +8 -0
  17. package/dist/api/generated/core/models/TripComparisonItem.js +1 -0
  18. package/dist/api/generated/core/models/TripComparisonItemId.d.ts +1 -0
  19. package/dist/api/generated/core/models/TripComparisonItemId.js +1 -0
  20. package/dist/api/generated/core/models/TripComparisonItemIdPathParam.d.ts +5 -0
  21. package/dist/api/generated/core/models/TripComparisonItemIdPathParam.js +1 -0
  22. package/dist/api/generated/core/services/CoreService.d.ts +46 -0
  23. package/dist/api/generated/core/services/CoreService.js +113 -0
  24. package/dist/api/generated/core/services/PublicService.d.ts +10 -0
  25. package/dist/api/generated/core/services/PublicService.js +20 -0
  26. package/dist/api/generated/core/services/TripComparisonService.d.ts +50 -0
  27. package/dist/api/generated/core/services/TripComparisonService.js +117 -0
  28. package/dist/api/generated/swoop/exports.d.ts +2 -0
  29. package/dist/api/generated/swoop/index.d.ts +2 -0
  30. package/dist/api/generated/swoop/models/Airport.d.ts +11 -0
  31. package/dist/api/generated/swoop/models/Airport.js +1 -0
  32. package/dist/api/generated/swoop/models/Airport_jsonld.d.ts +11 -0
  33. package/dist/api/generated/swoop/models/Airport_jsonld.js +1 -0
  34. package/dist/api/generated/swoop/services/SwoopService.d.ts +11 -0
  35. package/dist/api/generated/swoop/services/SwoopService.js +20 -0
  36. package/dist/api/specsgen.js +38 -1
  37. package/package.json +2 -1
@@ -51,6 +51,10 @@ export type { DTOTemplateCreate } from './index';
51
51
  export type { DTOTemplateEntity } from './index';
52
52
  export type { DTOTemplateRead } from './index';
53
53
  export type { DTOTemplateUpdate } from './index';
54
+ export type { DTOTripComparisonCreate } from './index';
55
+ export type { DTOTripComparisonEntity } from './index';
56
+ export type { DTOTripComparisonRead } from './index';
57
+ export type { DTOTripComparisonUpdate } from './index';
54
58
  export type { EnquiryId } from './index';
55
59
  export type { EnquiryIdPathParam } from './index';
56
60
  export type { EnquiryIdQueryParam } from './index';
@@ -104,6 +108,11 @@ export type { TemplateId } from './index';
104
108
  export type { TemplateIdPathParam } from './index';
105
109
  export type { TemplateRevisionGroupId } from './index';
106
110
  export type { Title } from './index';
111
+ export type { Trip } from './index';
112
+ export type { TripComparisonEnquiryIdQueryParam } from './index';
113
+ export type { TripComparisonItem } from './index';
114
+ export type { TripComparisonItemId } from './index';
115
+ export type { TripComparisonItemIdPathParam } from './index';
107
116
  export type { TripId } from './index';
108
117
  export { UrgencyCTA } from './index';
109
118
  export type { UserComponentInstanceField } from './index';
@@ -51,6 +51,10 @@ export type { DTOTemplateCreate } from './models/DTOTemplateCreate';
51
51
  export type { DTOTemplateEntity } from './models/DTOTemplateEntity';
52
52
  export type { DTOTemplateRead } from './models/DTOTemplateRead';
53
53
  export type { DTOTemplateUpdate } from './models/DTOTemplateUpdate';
54
+ export type { DTOTripComparisonCreate } from './models/DTOTripComparisonCreate';
55
+ export type { DTOTripComparisonEntity } from './models/DTOTripComparisonEntity';
56
+ export type { DTOTripComparisonRead } from './models/DTOTripComparisonRead';
57
+ export type { DTOTripComparisonUpdate } from './models/DTOTripComparisonUpdate';
54
58
  export type { EnquiryId } from './models/EnquiryId';
55
59
  export type { EnquiryIdPathParam } from './models/EnquiryIdPathParam';
56
60
  export type { EnquiryIdQueryParam } from './models/EnquiryIdQueryParam';
@@ -104,6 +108,11 @@ export type { TemplateId } from './models/TemplateId';
104
108
  export type { TemplateIdPathParam } from './models/TemplateIdPathParam';
105
109
  export type { TemplateRevisionGroupId } from './models/TemplateRevisionGroupId';
106
110
  export type { Title } from './models/Title';
111
+ export type { Trip } from './models/Trip';
112
+ export type { TripComparisonEnquiryIdQueryParam } from './models/TripComparisonEnquiryIdQueryParam';
113
+ export type { TripComparisonItem } from './models/TripComparisonItem';
114
+ export type { TripComparisonItemId } from './models/TripComparisonItemId';
115
+ export type { TripComparisonItemIdPathParam } from './models/TripComparisonItemIdPathParam';
107
116
  export type { TripId } from './models/TripId';
108
117
  export { UrgencyCTA } from './models/UrgencyCTA';
109
118
  export type { UserComponentInstanceField } from './models/UserComponentInstanceField';
@@ -116,3 +125,4 @@ export { PublicService } from './services/PublicService';
116
125
  export { RegionService } from './services/RegionService';
117
126
  export { SnapshotService } from './services/SnapshotService';
118
127
  export { TemplateService } from './services/TemplateService';
128
+ 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,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;
@@ -16,11 +16,15 @@ import type { DTOSnapshotRead } from '../models/DTOSnapshotRead';
16
16
  import type { DTOTemplateCreate } from '../models/DTOTemplateCreate';
17
17
  import { DTOTemplateRead } from '../models/DTOTemplateRead';
18
18
  import type { DTOTemplateUpdate } from '../models/DTOTemplateUpdate';
19
+ import type { DTOTripComparisonCreate } from '../models/DTOTripComparisonCreate';
20
+ import type { DTOTripComparisonRead } from '../models/DTOTripComparisonRead';
21
+ import type { DTOTripComparisonUpdate } from '../models/DTOTripComparisonUpdate';
19
22
  import type { InternalSwoopId } from '../models/InternalSwoopId';
20
23
  import type { ItineraryCreateResponse } from '../models/ItineraryCreateResponse';
21
24
  import type { Pagination } from '../models/Pagination';
22
25
  import type { SnapshotId } from '../models/SnapshotId';
23
26
  import type { TemplateId } from '../models/TemplateId';
27
+ import type { TripComparisonItemId } from '../models/TripComparisonItemId';
24
28
  import { CancelablePromise } from '../core/CancelablePromise';
25
29
  export declare class CoreService {
26
30
  /**
@@ -292,6 +296,48 @@ export declare class CoreService {
292
296
  * @throws ApiError
293
297
  */
294
298
  componentStateUpdate(componentId: ComponentId, state: ComponentState): CancelablePromise<DTOComponentRead>;
299
+ /**
300
+ * List Trip Comparisons by Enquiry ID
301
+ * Retrieves all trip comparison items for a specific enquiryId.
302
+ * @param enquiryId The enquiry ID to fetch all trip comparisons for
303
+ * @returns DTOTripComparisonRead When trip comparisons are retrieved successfully
304
+ * @throws ApiError
305
+ */
306
+ tripComparisonList(enquiryId: string): CancelablePromise<Array<DTOTripComparisonRead>>;
307
+ /**
308
+ * Create a Trip Comparison
309
+ * 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.
310
+ * @param requestBody
311
+ * @returns DTOTripComparisonRead When the trip comparison item is created
312
+ * @throws ApiError
313
+ */
314
+ tripComparisonCreate(requestBody: DTOTripComparisonCreate): CancelablePromise<DTOTripComparisonRead>;
315
+ /**
316
+ * Update a Trip Comparison
317
+ * 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.
318
+ * @param uuid UUID of a trip comparison item
319
+ * @param requestBody
320
+ * @returns DTOTripComparisonRead When the trip comparison item is updated successfully
321
+ * @throws ApiError
322
+ */
323
+ tripComparisonUpdate(uuid: TripComparisonItemId, requestBody: DTOTripComparisonUpdate): CancelablePromise<DTOTripComparisonRead>;
324
+ /**
325
+ * Delete a Trip Comparison
326
+ * 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.
327
+ * @param uuid UUID of a trip comparison item
328
+ * @param enquiryId Enquiry ID for trip comparison lookup
329
+ * @returns void
330
+ * @throws ApiError
331
+ */
332
+ tripComparisonDelete(uuid: TripComparisonItemId, enquiryId: InternalSwoopId): CancelablePromise<void>;
333
+ /**
334
+ * Get Trip Comparison (Public)
335
+ * Fetches a single trip comparison item by UUID. This is a public endpoint that doesn't require authentication.
336
+ * @param uuid UUID of a trip comparison item
337
+ * @returns DTOTripComparisonRead The trip comparison item
338
+ * @throws ApiError
339
+ */
340
+ publicTripComparisonGet(uuid: TripComparisonItemId): CancelablePromise<DTOTripComparisonRead>;
295
341
  /**
296
342
  * Resolve template hierarchy
297
343
  * @returns Array<DTOTemplateRead> OK
@@ -677,6 +677,119 @@ export class CoreService {
677
677
  },
678
678
  });
679
679
  }
680
+ /**
681
+ * List Trip Comparisons by Enquiry ID
682
+ * Retrieves all trip comparison items for a specific enquiryId.
683
+ * @param enquiryId The enquiry ID to fetch all trip comparisons for
684
+ * @returns DTOTripComparisonRead When trip comparisons are retrieved successfully
685
+ * @throws ApiError
686
+ */
687
+ tripComparisonList(enquiryId) {
688
+ return __request(OpenAPI, {
689
+ method: 'GET',
690
+ url: '/trip-comparison',
691
+ query: {
692
+ 'enquiryId': enquiryId,
693
+ },
694
+ errors: {
695
+ 400: `If the enquiryId parameter is missing`,
696
+ 401: `When the client is not authorised`,
697
+ 404: `If no trip comparisons exist for the enquiryId`,
698
+ 500: `When an unexpected error occurs`,
699
+ },
700
+ });
701
+ }
702
+ /**
703
+ * Create a Trip Comparison
704
+ * 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.
705
+ * @param requestBody
706
+ * @returns DTOTripComparisonRead When the trip comparison item is created
707
+ * @throws ApiError
708
+ */
709
+ tripComparisonCreate(requestBody) {
710
+ return __request(OpenAPI, {
711
+ method: 'POST',
712
+ url: '/trip-comparison',
713
+ body: requestBody,
714
+ mediaType: 'application/json',
715
+ errors: {
716
+ 400: `If the payload is malformed`,
717
+ 401: `When the client is not authorised`,
718
+ 500: `When an unexpected error occurs`,
719
+ },
720
+ });
721
+ }
722
+ /**
723
+ * Update a Trip Comparison
724
+ * 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.
725
+ * @param uuid UUID of a trip comparison item
726
+ * @param requestBody
727
+ * @returns DTOTripComparisonRead When the trip comparison item is updated successfully
728
+ * @throws ApiError
729
+ */
730
+ tripComparisonUpdate(uuid, requestBody) {
731
+ return __request(OpenAPI, {
732
+ method: 'PUT',
733
+ url: '/trip-comparison/{uuid}',
734
+ path: {
735
+ 'uuid': uuid,
736
+ },
737
+ body: requestBody,
738
+ mediaType: 'application/json',
739
+ errors: {
740
+ 400: `If the payload is malformed`,
741
+ 401: `When the client is not authorised`,
742
+ 404: `If the trip comparison item does not exist`,
743
+ 500: `When an unexpected error occurs`,
744
+ },
745
+ });
746
+ }
747
+ /**
748
+ * Delete a Trip Comparison
749
+ * 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.
750
+ * @param uuid UUID of a trip comparison item
751
+ * @param enquiryId Enquiry ID for trip comparison lookup
752
+ * @returns void
753
+ * @throws ApiError
754
+ */
755
+ tripComparisonDelete(uuid, enquiryId) {
756
+ return __request(OpenAPI, {
757
+ method: 'DELETE',
758
+ url: '/trip-comparison/{uuid}',
759
+ path: {
760
+ 'uuid': uuid,
761
+ },
762
+ query: {
763
+ 'enquiryId': enquiryId,
764
+ },
765
+ errors: {
766
+ 400: `If the payload is malformed`,
767
+ 401: `When the client is not authorised`,
768
+ 404: `If the trip comparison item does not exist`,
769
+ 500: `When an unexpected error occurs`,
770
+ },
771
+ });
772
+ }
773
+ /**
774
+ * Get Trip Comparison (Public)
775
+ * Fetches a single trip comparison item by UUID. This is a public endpoint that doesn't require authentication.
776
+ * @param uuid UUID of a trip comparison item
777
+ * @returns DTOTripComparisonRead The trip comparison item
778
+ * @throws ApiError
779
+ */
780
+ publicTripComparisonGet(uuid) {
781
+ return __request(OpenAPI, {
782
+ method: 'GET',
783
+ url: '/public/trip-comparison/{uuid}',
784
+ path: {
785
+ 'uuid': uuid,
786
+ },
787
+ errors: {
788
+ 404: `If the trip comparison item does not exist`,
789
+ 500: `When an unexpected error occurs`,
790
+ },
791
+ });
792
+ }
680
793
  /**
681
794
  * Resolve template hierarchy
682
795
  * @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.96",
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"