@cascateer/sterio 1.0.1

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 (58) hide show
  1. package/.env +0 -0
  2. package/.github/workflows/publish.yml +11 -0
  3. package/.vscode/settings.json +4 -0
  4. package/build/routes.ts +413 -0
  5. package/build/swagger.json +775 -0
  6. package/openapitools.json +14 -0
  7. package/package.json +56 -0
  8. package/src/Spotify.service.ts +202 -0
  9. package/src/Sterio.service.ts +208 -0
  10. package/src/Youtube.service.ts +112 -0
  11. package/src/YoutubeMusic.service.ts +52 -0
  12. package/src/api/.openapi-generator/FILES +29 -0
  13. package/src/api/.openapi-generator/VERSION +1 -0
  14. package/src/api/.openapi-generator-ignore +23 -0
  15. package/src/api/apis/DefaultApi.ts +154 -0
  16. package/src/api/apis/index.ts +1 -0
  17. package/src/api/index.ts +4 -0
  18. package/src/api/models/GetYoutubeMusicAlbums200ResponseInner.ts +29 -0
  19. package/src/api/models/PartialSterioAlbumResourcesFull.ts +39 -0
  20. package/src/api/models/SpotifyApiAlbumObjectSimplified.ts +152 -0
  21. package/src/api/models/SpotifyApiArtistObjectSimplified.ts +68 -0
  22. package/src/api/models/SpotifyApiExternalUrlObject.ts +25 -0
  23. package/src/api/models/SpotifyApiImageObject.ts +38 -0
  24. package/src/api/models/SpotifyApiRestrictionsObject.ts +24 -0
  25. package/src/api/models/SterioAlbum.ts +39 -0
  26. package/src/api/models/SterioAlbumResource.ts +29 -0
  27. package/src/api/models/SterioAlbumResourcesTable.ts +34 -0
  28. package/src/api/models/SterioAlbumSongs.ts +38 -0
  29. package/src/api/models/SterioAlbumSongsVideoIdsInner.ts +34 -0
  30. package/src/api/models/YoutubePlaylist.ts +38 -0
  31. package/src/api/models/YoutubeV3Schema36PlaylistItem.ts +59 -0
  32. package/src/api/models/YoutubeV3Schema36PlaylistItemContentDetails.ts +49 -0
  33. package/src/api/models/YoutubeV3Schema36PlaylistItemSnippet.ts +89 -0
  34. package/src/api/models/YoutubeV3Schema36PlaylistItemStatus.ts +26 -0
  35. package/src/api/models/YoutubeV3Schema36ResourceId.ts +44 -0
  36. package/src/api/models/YoutubeV3Schema36Thumbnail.ts +38 -0
  37. package/src/api/models/YoutubeV3Schema36ThumbnailDetails.ts +49 -0
  38. package/src/api/models/index.ts +20 -0
  39. package/src/api/runtime.ts +193 -0
  40. package/src/api/servers.ts +45 -0
  41. package/src/api/tsconfig.json +22 -0
  42. package/src/app.ts +58 -0
  43. package/src/config.ts +6 -0
  44. package/src/controller.ts +148 -0
  45. package/src/lib.ts +112 -0
  46. package/src/main.ts +225 -0
  47. package/src/tables.ts +178 -0
  48. package/src/types.ts +113 -0
  49. package/src/views/spotify/auth-callback.ejs +22 -0
  50. package/tables/document-files/82745273-7eda-4169-8b4a-998d2de00ac2.json +5208 -0
  51. package/tables/spotify-albums/5bff8eba-bd2b-4485-8136-1f89da5db6d7.json +1 -0
  52. package/tables/sterio-albums/81d5b327-68b1-4fef-8e40-491c792e8951.json +1 -0
  53. package/tables/stream-files/f6697f37-7320-41df-aa50-b70264fa1bbf.json +3788 -0
  54. package/tables/youtube-music-albums/55fd9bb8-46ba-4d0e-9376-f2f2cbb1aa38.json +1 -0
  55. package/tables/youtube-playlists/e3153ab8-8e1f-491e-995e-3142d07f4ecc.json +1 -0
  56. package/tables/youtube-videos/9067172e-4803-48f1-8b8e-4b942f3ca228.json +1 -0
  57. package/tsconfig.json +16 -0
  58. package/tsoa.json +14 -0
@@ -0,0 +1,38 @@
1
+ // tslint:disable
2
+ /**
3
+ * @cascateer/sterio
4
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+ *
6
+ * The version of the OpenAPI document: 1.0.0
7
+ *
8
+ *
9
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
10
+ * https://openapi-generator.tech
11
+ * Do not edit the class manually.
12
+ */
13
+
14
+ import type {
15
+ SterioAlbumSongsVideoIdsInner,
16
+ } from './';
17
+
18
+ /**
19
+ * @export
20
+ * @interface SterioAlbumSongs
21
+ */
22
+ export interface SterioAlbumSongs {
23
+ /**
24
+ * @type {Array<number>}
25
+ * @memberof SterioAlbumSongs
26
+ */
27
+ exclude?: Array<number>;
28
+ /**
29
+ * @type {Array<number>}
30
+ * @memberof SterioAlbumSongs
31
+ */
32
+ include?: Array<number>;
33
+ /**
34
+ * @type {Array<SterioAlbumSongsVideoIdsInner>}
35
+ * @memberof SterioAlbumSongs
36
+ */
37
+ videoIds?: Array<SterioAlbumSongsVideoIdsInner>;
38
+ }
@@ -0,0 +1,34 @@
1
+ // tslint:disable
2
+ /**
3
+ * @cascateer/sterio
4
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+ *
6
+ * The version of the OpenAPI document: 1.0.0
7
+ *
8
+ *
9
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
10
+ * https://openapi-generator.tech
11
+ * Do not edit the class manually.
12
+ */
13
+
14
+ /**
15
+ * @export
16
+ * @interface SterioAlbumSongsVideoIdsInner
17
+ */
18
+ export interface SterioAlbumSongsVideoIdsInner {
19
+ /**
20
+ * @type {string}
21
+ * @memberof SterioAlbumSongsVideoIdsInner
22
+ */
23
+ newValue: string;
24
+ /**
25
+ * @type {string}
26
+ * @memberof SterioAlbumSongsVideoIdsInner
27
+ */
28
+ expectedValue: string;
29
+ /**
30
+ * @type {number}
31
+ * @memberof SterioAlbumSongsVideoIdsInner
32
+ */
33
+ index: number;
34
+ }
@@ -0,0 +1,38 @@
1
+ // tslint:disable
2
+ /**
3
+ * @cascateer/sterio
4
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+ *
6
+ * The version of the OpenAPI document: 1.0.0
7
+ *
8
+ *
9
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
10
+ * https://openapi-generator.tech
11
+ * Do not edit the class manually.
12
+ */
13
+
14
+ import type {
15
+ YoutubeV3Schema36PlaylistItem,
16
+ } from './';
17
+
18
+ /**
19
+ * @export
20
+ * @interface YoutubePlaylist
21
+ */
22
+ export interface YoutubePlaylist {
23
+ /**
24
+ * @type {string}
25
+ * @memberof YoutubePlaylist
26
+ */
27
+ id: string;
28
+ /**
29
+ * @type {string}
30
+ * @memberof YoutubePlaylist
31
+ */
32
+ title?: string;
33
+ /**
34
+ * @type {Array<YoutubeV3Schema36PlaylistItem>}
35
+ * @memberof YoutubePlaylist
36
+ */
37
+ items: Array<YoutubeV3Schema36PlaylistItem>;
38
+ }
@@ -0,0 +1,59 @@
1
+ // tslint:disable
2
+ /**
3
+ * @cascateer/sterio
4
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+ *
6
+ * The version of the OpenAPI document: 1.0.0
7
+ *
8
+ *
9
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
10
+ * https://openapi-generator.tech
11
+ * Do not edit the class manually.
12
+ */
13
+
14
+ import type {
15
+ YoutubeV3Schema36PlaylistItemContentDetails,
16
+ YoutubeV3Schema36PlaylistItemSnippet,
17
+ YoutubeV3Schema36PlaylistItemStatus,
18
+ } from './';
19
+
20
+ /**
21
+ * A *playlistItem* resource identifies another resource, such as a video, that is included in a playlist. In addition, the playlistItem resource contains details about the included resource that pertain specifically to how that resource is used in that playlist. YouTube uses playlists to identify special collections of videos for a channel, such as: - uploaded videos - favorite videos - positively rated (liked) videos - watch history - watch later To be more specific, these lists are associated with a channel, which is a collection of a person, group, or company\'s videos, playlists, and other YouTube information. You can retrieve the playlist IDs for each of these lists from the channel resource for a given channel. You can then use the playlistItems.list method to retrieve any of those lists. You can also add or remove items from those lists by calling the playlistItems.insert and playlistItems.delete methods. For example, if a user gives a positive rating to a video, you would insert that video into the liked videos playlist for that user\'s channel.
22
+ * @export
23
+ * @interface YoutubeV3Schema36PlaylistItem
24
+ */
25
+ export interface YoutubeV3Schema36PlaylistItem {
26
+ /**
27
+ * @type {YoutubeV3Schema36PlaylistItemContentDetails}
28
+ * @memberof YoutubeV3Schema36PlaylistItem
29
+ */
30
+ contentDetails?: YoutubeV3Schema36PlaylistItemContentDetails;
31
+ /**
32
+ * Etag of this resource.
33
+ * @type {string}
34
+ * @memberof YoutubeV3Schema36PlaylistItem
35
+ */
36
+ etag?: string | null;
37
+ /**
38
+ * The ID that YouTube uses to uniquely identify the playlist item.
39
+ * @type {string}
40
+ * @memberof YoutubeV3Schema36PlaylistItem
41
+ */
42
+ id?: string | null;
43
+ /**
44
+ * Identifies what kind of resource this is. Value: the fixed string \"youtube#playlistItem\".
45
+ * @type {string}
46
+ * @memberof YoutubeV3Schema36PlaylistItem
47
+ */
48
+ kind?: string | null;
49
+ /**
50
+ * @type {YoutubeV3Schema36PlaylistItemSnippet}
51
+ * @memberof YoutubeV3Schema36PlaylistItem
52
+ */
53
+ snippet?: YoutubeV3Schema36PlaylistItemSnippet;
54
+ /**
55
+ * @type {YoutubeV3Schema36PlaylistItemStatus}
56
+ * @memberof YoutubeV3Schema36PlaylistItem
57
+ */
58
+ status?: YoutubeV3Schema36PlaylistItemStatus;
59
+ }
@@ -0,0 +1,49 @@
1
+ // tslint:disable
2
+ /**
3
+ * @cascateer/sterio
4
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+ *
6
+ * The version of the OpenAPI document: 1.0.0
7
+ *
8
+ *
9
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
10
+ * https://openapi-generator.tech
11
+ * Do not edit the class manually.
12
+ */
13
+
14
+ /**
15
+ * @export
16
+ * @interface YoutubeV3Schema36PlaylistItemContentDetails
17
+ */
18
+ export interface YoutubeV3Schema36PlaylistItemContentDetails {
19
+ /**
20
+ * The time, measured in seconds from the start of the video, when the video should stop playing. (The playlist owner can specify the times when the video should start and stop playing when the video is played in the context of the playlist.) By default, assume that the video.endTime is the end of the video.
21
+ * @type {string}
22
+ * @memberof YoutubeV3Schema36PlaylistItemContentDetails
23
+ */
24
+ endAt?: string | null;
25
+ /**
26
+ * A user-generated note for this item.
27
+ * @type {string}
28
+ * @memberof YoutubeV3Schema36PlaylistItemContentDetails
29
+ */
30
+ note?: string | null;
31
+ /**
32
+ * The time, measured in seconds from the start of the video, when the video should start playing. (The playlist owner can specify the times when the video should start and stop playing when the video is played in the context of the playlist.) The default value is 0.
33
+ * @type {string}
34
+ * @memberof YoutubeV3Schema36PlaylistItemContentDetails
35
+ */
36
+ startAt?: string | null;
37
+ /**
38
+ * The ID that YouTube uses to uniquely identify a video. To retrieve the video resource, set the id query parameter to this value in your API request.
39
+ * @type {string}
40
+ * @memberof YoutubeV3Schema36PlaylistItemContentDetails
41
+ */
42
+ videoId?: string | null;
43
+ /**
44
+ * The date and time that the video was published to YouTube.
45
+ * @type {string}
46
+ * @memberof YoutubeV3Schema36PlaylistItemContentDetails
47
+ */
48
+ videoPublishedAt?: string | null;
49
+ }
@@ -0,0 +1,89 @@
1
+ // tslint:disable
2
+ /**
3
+ * @cascateer/sterio
4
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+ *
6
+ * The version of the OpenAPI document: 1.0.0
7
+ *
8
+ *
9
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
10
+ * https://openapi-generator.tech
11
+ * Do not edit the class manually.
12
+ */
13
+
14
+ import type {
15
+ YoutubeV3Schema36ResourceId,
16
+ YoutubeV3Schema36ThumbnailDetails,
17
+ } from './';
18
+
19
+ /**
20
+ * Basic details about a playlist, including title, description and thumbnails. Basic details of a YouTube Playlist item provided by the author. Next ID: 15
21
+ * @export
22
+ * @interface YoutubeV3Schema36PlaylistItemSnippet
23
+ */
24
+ export interface YoutubeV3Schema36PlaylistItemSnippet {
25
+ /**
26
+ * The ID that YouTube uses to uniquely identify the user that added the item to the playlist.
27
+ * @type {string}
28
+ * @memberof YoutubeV3Schema36PlaylistItemSnippet
29
+ */
30
+ channelId?: string | null;
31
+ /**
32
+ * Channel title for the channel that the playlist item belongs to.
33
+ * @type {string}
34
+ * @memberof YoutubeV3Schema36PlaylistItemSnippet
35
+ */
36
+ channelTitle?: string | null;
37
+ /**
38
+ * The item\'s description.
39
+ * @type {string}
40
+ * @memberof YoutubeV3Schema36PlaylistItemSnippet
41
+ */
42
+ description?: string | null;
43
+ /**
44
+ * The ID that YouTube uses to uniquely identify thGe playlist that the playlist item is in.
45
+ * @type {string}
46
+ * @memberof YoutubeV3Schema36PlaylistItemSnippet
47
+ */
48
+ playlistId?: string | null;
49
+ /**
50
+ * The order in which the item appears in the playlist. The value uses a zero-based index, so the first item has a position of 0, the second item has a position of 1, and so forth.
51
+ * @type {number}
52
+ * @memberof YoutubeV3Schema36PlaylistItemSnippet
53
+ */
54
+ position?: number | null;
55
+ /**
56
+ * The date and time that the item was added to the playlist.
57
+ * @type {string}
58
+ * @memberof YoutubeV3Schema36PlaylistItemSnippet
59
+ */
60
+ publishedAt?: string | null;
61
+ /**
62
+ * @type {YoutubeV3Schema36ResourceId}
63
+ * @memberof YoutubeV3Schema36PlaylistItemSnippet
64
+ */
65
+ resourceId?: YoutubeV3Schema36ResourceId;
66
+ /**
67
+ * @type {YoutubeV3Schema36ThumbnailDetails}
68
+ * @memberof YoutubeV3Schema36PlaylistItemSnippet
69
+ */
70
+ thumbnails?: YoutubeV3Schema36ThumbnailDetails;
71
+ /**
72
+ * The item\'s title.
73
+ * @type {string}
74
+ * @memberof YoutubeV3Schema36PlaylistItemSnippet
75
+ */
76
+ title?: string | null;
77
+ /**
78
+ * Channel id for the channel this video belongs to.
79
+ * @type {string}
80
+ * @memberof YoutubeV3Schema36PlaylistItemSnippet
81
+ */
82
+ videoOwnerChannelId?: string | null;
83
+ /**
84
+ * Channel title for the channel this video belongs to.
85
+ * @type {string}
86
+ * @memberof YoutubeV3Schema36PlaylistItemSnippet
87
+ */
88
+ videoOwnerChannelTitle?: string | null;
89
+ }
@@ -0,0 +1,26 @@
1
+ // tslint:disable
2
+ /**
3
+ * @cascateer/sterio
4
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+ *
6
+ * The version of the OpenAPI document: 1.0.0
7
+ *
8
+ *
9
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
10
+ * https://openapi-generator.tech
11
+ * Do not edit the class manually.
12
+ */
13
+
14
+ /**
15
+ * Information about the playlist item\'s privacy status.
16
+ * @export
17
+ * @interface YoutubeV3Schema36PlaylistItemStatus
18
+ */
19
+ export interface YoutubeV3Schema36PlaylistItemStatus {
20
+ /**
21
+ * This resource\'s privacy status.
22
+ * @type {string}
23
+ * @memberof YoutubeV3Schema36PlaylistItemStatus
24
+ */
25
+ privacyStatus?: string | null;
26
+ }
@@ -0,0 +1,44 @@
1
+ // tslint:disable
2
+ /**
3
+ * @cascateer/sterio
4
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+ *
6
+ * The version of the OpenAPI document: 1.0.0
7
+ *
8
+ *
9
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
10
+ * https://openapi-generator.tech
11
+ * Do not edit the class manually.
12
+ */
13
+
14
+ /**
15
+ * A resource id is a generic reference that points to another YouTube resource.
16
+ * @export
17
+ * @interface YoutubeV3Schema36ResourceId
18
+ */
19
+ export interface YoutubeV3Schema36ResourceId {
20
+ /**
21
+ * The ID that YouTube uses to uniquely identify the referred resource, if that resource is a channel. This property is only present if the resourceId.kind value is youtube#channel.
22
+ * @type {string}
23
+ * @memberof YoutubeV3Schema36ResourceId
24
+ */
25
+ channelId?: string | null;
26
+ /**
27
+ * The type of the API resource.
28
+ * @type {string}
29
+ * @memberof YoutubeV3Schema36ResourceId
30
+ */
31
+ kind?: string | null;
32
+ /**
33
+ * The ID that YouTube uses to uniquely identify the referred resource, if that resource is a playlist. This property is only present if the resourceId.kind value is youtube#playlist.
34
+ * @type {string}
35
+ * @memberof YoutubeV3Schema36ResourceId
36
+ */
37
+ playlistId?: string | null;
38
+ /**
39
+ * The ID that YouTube uses to uniquely identify the referred resource, if that resource is a video. This property is only present if the resourceId.kind value is youtube#video.
40
+ * @type {string}
41
+ * @memberof YoutubeV3Schema36ResourceId
42
+ */
43
+ videoId?: string | null;
44
+ }
@@ -0,0 +1,38 @@
1
+ // tslint:disable
2
+ /**
3
+ * @cascateer/sterio
4
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+ *
6
+ * The version of the OpenAPI document: 1.0.0
7
+ *
8
+ *
9
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
10
+ * https://openapi-generator.tech
11
+ * Do not edit the class manually.
12
+ */
13
+
14
+ /**
15
+ * A thumbnail is an image representing a YouTube resource.
16
+ * @export
17
+ * @interface YoutubeV3Schema36Thumbnail
18
+ */
19
+ export interface YoutubeV3Schema36Thumbnail {
20
+ /**
21
+ * (Optional) Height of the thumbnail image.
22
+ * @type {number}
23
+ * @memberof YoutubeV3Schema36Thumbnail
24
+ */
25
+ height?: number | null;
26
+ /**
27
+ * The thumbnail image\'s URL.
28
+ * @type {string}
29
+ * @memberof YoutubeV3Schema36Thumbnail
30
+ */
31
+ url?: string | null;
32
+ /**
33
+ * (Optional) Width of the thumbnail image.
34
+ * @type {number}
35
+ * @memberof YoutubeV3Schema36Thumbnail
36
+ */
37
+ width?: number | null;
38
+ }
@@ -0,0 +1,49 @@
1
+ // tslint:disable
2
+ /**
3
+ * @cascateer/sterio
4
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+ *
6
+ * The version of the OpenAPI document: 1.0.0
7
+ *
8
+ *
9
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
10
+ * https://openapi-generator.tech
11
+ * Do not edit the class manually.
12
+ */
13
+
14
+ import type {
15
+ YoutubeV3Schema36Thumbnail,
16
+ } from './';
17
+
18
+ /**
19
+ * Internal representation of thumbnails for a YouTube resource.
20
+ * @export
21
+ * @interface YoutubeV3Schema36ThumbnailDetails
22
+ */
23
+ export interface YoutubeV3Schema36ThumbnailDetails {
24
+ /**
25
+ * @type {YoutubeV3Schema36Thumbnail}
26
+ * @memberof YoutubeV3Schema36ThumbnailDetails
27
+ */
28
+ _default?: YoutubeV3Schema36Thumbnail;
29
+ /**
30
+ * @type {YoutubeV3Schema36Thumbnail}
31
+ * @memberof YoutubeV3Schema36ThumbnailDetails
32
+ */
33
+ high?: YoutubeV3Schema36Thumbnail;
34
+ /**
35
+ * @type {YoutubeV3Schema36Thumbnail}
36
+ * @memberof YoutubeV3Schema36ThumbnailDetails
37
+ */
38
+ maxres?: YoutubeV3Schema36Thumbnail;
39
+ /**
40
+ * @type {YoutubeV3Schema36Thumbnail}
41
+ * @memberof YoutubeV3Schema36ThumbnailDetails
42
+ */
43
+ medium?: YoutubeV3Schema36Thumbnail;
44
+ /**
45
+ * @type {YoutubeV3Schema36Thumbnail}
46
+ * @memberof YoutubeV3Schema36ThumbnailDetails
47
+ */
48
+ standard?: YoutubeV3Schema36Thumbnail;
49
+ }
@@ -0,0 +1,20 @@
1
+ export * from './GetYoutubeMusicAlbums200ResponseInner';
2
+ export * from './PartialSterioAlbumResourcesFull';
3
+ export * from './SpotifyApiAlbumObjectSimplified';
4
+ export * from './SpotifyApiArtistObjectSimplified';
5
+ export * from './SpotifyApiExternalUrlObject';
6
+ export * from './SpotifyApiImageObject';
7
+ export * from './SpotifyApiRestrictionsObject';
8
+ export * from './SterioAlbum';
9
+ export * from './SterioAlbumResource';
10
+ export * from './SterioAlbumResourcesTable';
11
+ export * from './SterioAlbumSongs';
12
+ export * from './SterioAlbumSongsVideoIdsInner';
13
+ export * from './YoutubePlaylist';
14
+ export * from './YoutubeV3Schema36PlaylistItem';
15
+ export * from './YoutubeV3Schema36PlaylistItemContentDetails';
16
+ export * from './YoutubeV3Schema36PlaylistItemSnippet';
17
+ export * from './YoutubeV3Schema36PlaylistItemStatus';
18
+ export * from './YoutubeV3Schema36ResourceId';
19
+ export * from './YoutubeV3Schema36Thumbnail';
20
+ export * from './YoutubeV3Schema36ThumbnailDetails';
@@ -0,0 +1,193 @@
1
+ // tslint:disable
2
+ /**
3
+ * @cascateer/sterio
4
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+ *
6
+ * The version of the OpenAPI document: 1.0.0
7
+ *
8
+ *
9
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
10
+ * https://openapi-generator.tech
11
+ * Do not edit the class manually.
12
+ */
13
+
14
+ import { of } from 'rxjs';
15
+ import type { Observable } from 'rxjs';
16
+ import { ajax } from 'rxjs/ajax';
17
+ import type { AjaxConfig, AjaxResponse } from 'rxjs/ajax';
18
+ import { map, concatMap } from 'rxjs/operators';
19
+ import { servers } from './servers';
20
+
21
+ export const BASE_PATH = servers[0].getUrl();
22
+
23
+ export interface ConfigurationParameters {
24
+ basePath?: string; // override base path
25
+ middleware?: Middleware[]; // middleware to apply before/after rxjs requests
26
+ username?: string; // parameter for basic security
27
+ password?: string; // parameter for basic security
28
+ apiKey?: string | ((name: string) => string); // parameter for apiKey security
29
+ accessToken?: string | ((name?: string, scopes?: string[]) => string); // parameter for oauth2 security
30
+ }
31
+
32
+ export class Configuration {
33
+ constructor(private configuration: ConfigurationParameters = {}) {}
34
+
35
+ get basePath(): string {
36
+ return this.configuration.basePath ?? BASE_PATH;
37
+ }
38
+
39
+ get middleware(): Middleware[] {
40
+ return this.configuration.middleware ?? [];
41
+ }
42
+
43
+ get username(): string | undefined {
44
+ return this.configuration.username;
45
+ }
46
+
47
+ get password(): string | undefined {
48
+ return this.configuration.password;
49
+ }
50
+
51
+ get apiKey(): ((name: string) => string) | undefined {
52
+ const { apiKey } = this.configuration;
53
+ return apiKey ? (typeof apiKey === 'string' ? () => apiKey : apiKey) : undefined;
54
+ }
55
+
56
+ get accessToken(): ((name: string, scopes?: string[]) => string) | undefined {
57
+ const { accessToken } = this.configuration;
58
+ return accessToken ? (typeof accessToken === 'string' ? () => accessToken : accessToken) : undefined;
59
+ }
60
+ }
61
+
62
+ /**
63
+ * This is the base class for all generated API classes.
64
+ */
65
+ export class BaseAPI {
66
+ private middleware: Middleware[] = [];
67
+
68
+ constructor(protected configuration = new Configuration()) {
69
+ this.middleware = configuration.middleware;
70
+ }
71
+
72
+ withMiddleware = (middlewares: Middleware[]): this => {
73
+ const next = this.clone();
74
+ next.middleware = next.middleware.concat(middlewares);
75
+ return next;
76
+ };
77
+
78
+ withPreMiddleware = (preMiddlewares: Array<Middleware['pre']>) =>
79
+ this.withMiddleware(preMiddlewares.map((pre) => ({ pre })));
80
+
81
+ withPostMiddleware = (postMiddlewares: Array<Middleware['post']>) =>
82
+ this.withMiddleware(postMiddlewares.map((post) => ({ post })));
83
+
84
+ protected request<T>(requestOpts: RequestOpts): Observable<T>
85
+ protected request<T>(requestOpts: RequestOpts, responseOpts?: ResponseOpts): Observable<AjaxResponse<T>>
86
+ protected request<T>(requestOpts: RequestOpts, responseOpts?: ResponseOpts): Observable<T | AjaxResponse<T>> {
87
+ return this.rxjsRequest<T>(this.createRequestArgs(requestOpts)).pipe(
88
+ map((res) => {
89
+ const { status, response } = res;
90
+ if (status >= 200 && status < 300) {
91
+ return responseOpts?.response === 'raw' ? res : response;
92
+ }
93
+ throw res;
94
+ })
95
+ );
96
+ }
97
+
98
+ private createRequestArgs = ({ url: baseUrl, query, method, headers, body, responseType }: RequestOpts): AjaxConfig => {
99
+ // only add the queryString to the URL if there are query parameters.
100
+ // this is done to avoid urls ending with a '?' character which buggy webservers
101
+ // do not handle correctly sometimes.
102
+ const url = `${this.configuration.basePath}${baseUrl}${query && Object.keys(query).length ? `?${queryString(query)}`: ''}`;
103
+
104
+ return {
105
+ url,
106
+ method,
107
+ headers,
108
+ body: body instanceof FormData ? body : JSON.stringify(body),
109
+ responseType: responseType ?? 'json',
110
+ };
111
+ }
112
+
113
+ private rxjsRequest = <T>(params: AjaxConfig): Observable<AjaxResponse<T>> =>
114
+ of(params).pipe(
115
+ map((request) => {
116
+ this.middleware.filter((item) => item.pre).forEach((mw) => (request = mw.pre!(request)));
117
+ return request;
118
+ }),
119
+ concatMap((args) =>
120
+ ajax<T>(args).pipe(
121
+ map((response) => {
122
+ this.middleware.filter((item) => item.post).forEach((mw) => (response = mw.post!(response)));
123
+ return response;
124
+ })
125
+ )
126
+ )
127
+ );
128
+
129
+ /**
130
+ * Create a shallow clone of `this` by constructing a new instance
131
+ * and then shallow cloning data members.
132
+ */
133
+ private clone = (): this =>
134
+ Object.assign(Object.create(Object.getPrototypeOf(this)), this);
135
+ }
136
+
137
+ /**
138
+ * @deprecated
139
+ * export for not being a breaking change
140
+ */
141
+ export class RequiredError extends Error {
142
+ override name: 'RequiredError' = 'RequiredError';
143
+ }
144
+
145
+ export const COLLECTION_FORMATS = {
146
+ csv: ',',
147
+ ssv: ' ',
148
+ tsv: '\t',
149
+ pipes: '|',
150
+ };
151
+
152
+ export type Json = any;
153
+ export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD';
154
+ export type HttpHeaders = { [key: string]: string };
155
+ export type HttpQuery = Partial<{ [key: string]: string | number | null | boolean | Array<string | number | null | boolean> }>; // partial is needed for strict mode
156
+ export type HttpBody = Json | FormData;
157
+
158
+ export interface RequestOpts extends AjaxConfig {
159
+ // TODO: replace custom 'query' prop with 'queryParams'
160
+ query?: HttpQuery; // additional prop
161
+ // the following props have improved types over AjaxRequest
162
+ method: HttpMethod;
163
+ headers?: HttpHeaders;
164
+ body?: HttpBody;
165
+ }
166
+
167
+ export interface ResponseOpts {
168
+ response?: 'raw';
169
+ }
170
+
171
+ export interface OperationOpts {
172
+ responseOpts?: ResponseOpts;
173
+ }
174
+
175
+ export const encodeURI = (value: any) => encodeURIComponent(`${value}`);
176
+
177
+ const queryString = (params: HttpQuery): string => Object.entries(params)
178
+ .map(([key, value]) => value instanceof Array
179
+ ? value.map((val) => `${encodeURI(key)}=${encodeURI(val)}`).join('&')
180
+ : `${encodeURI(key)}=${encodeURI(value)}`
181
+ )
182
+ .join('&');
183
+
184
+ export const throwIfNullOrUndefined = (value: any, paramName: string, nickname: string) => {
185
+ if (value == null) {
186
+ throw new Error(`Parameter "${paramName}" was null or undefined when calling "${nickname}".`);
187
+ }
188
+ };
189
+
190
+ export interface Middleware {
191
+ pre?(request: AjaxConfig): AjaxConfig;
192
+ post?(response: AjaxResponse<any>): AjaxResponse<any>;
193
+ }