@keystrokehq/spotify 0.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.
- package/LICENSE +21 -0
- package/README.md +113 -0
- package/dist/_official/index.d.mts +32 -0
- package/dist/_official/index.mjs +3 -0
- package/dist/_runtime/index.d.mts +1 -0
- package/dist/_runtime/index.mjs +1 -0
- package/dist/albums.d.mts +265 -0
- package/dist/albums.mjs +72 -0
- package/dist/artists.d.mts +237 -0
- package/dist/artists.mjs +84 -0
- package/dist/audio-analysis.d.mts +91 -0
- package/dist/audio-analysis.mjs +19 -0
- package/dist/audio-features.d.mts +61 -0
- package/dist/audio-features.mjs +31 -0
- package/dist/audiobooks.d.mts +176 -0
- package/dist/audiobooks.mjs +59 -0
- package/dist/browse.d.mts +74 -0
- package/dist/browse.mjs +31 -0
- package/dist/categories.d.mts +118 -0
- package/dist/categories.mjs +66 -0
- package/dist/chapters.d.mts +163 -0
- package/dist/chapters.mjs +39 -0
- package/dist/client.d.mts +3486 -0
- package/dist/client.mjs +758 -0
- package/dist/connection.d.mts +2 -0
- package/dist/connection.mjs +3 -0
- package/dist/episodes.d.mts +149 -0
- package/dist/episodes.mjs +39 -0
- package/dist/errors.d.mts +34 -0
- package/dist/errors.mjs +89 -0
- package/dist/events.d.mts +613 -0
- package/dist/events.mjs +55 -0
- package/dist/factory-tZba6Hij.mjs +8 -0
- package/dist/follow.d.mts +83 -0
- package/dist/follow.mjs +65 -0
- package/dist/genres.d.mts +14 -0
- package/dist/genres.mjs +19 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.mjs +1 -0
- package/dist/integration-DQ5Egd4f.d.mts +41 -0
- package/dist/integration-ykoImsCq.mjs +78 -0
- package/dist/library.d.mts +472 -0
- package/dist/library.mjs +225 -0
- package/dist/markets.d.mts +14 -0
- package/dist/markets.mjs +20 -0
- package/dist/me.d.mts +169 -0
- package/dist/me.mjs +58 -0
- package/dist/messaging.d.mts +1 -0
- package/dist/messaging.mjs +1 -0
- package/dist/operations.d.mts +6 -0
- package/dist/operations.mjs +237 -0
- package/dist/player.d.mts +877 -0
- package/dist/player.mjs +220 -0
- package/dist/playlists.d.mts +546 -0
- package/dist/playlists.mjs +243 -0
- package/dist/recommendations.d.mts +144 -0
- package/dist/recommendations.mjs +137 -0
- package/dist/schemas.d.mts +3312 -0
- package/dist/schemas.mjs +460 -0
- package/dist/search.d.mts +389 -0
- package/dist/search.mjs +42 -0
- package/dist/shows.d.mts +159 -0
- package/dist/shows.mjs +59 -0
- package/dist/tracks.d.mts +173 -0
- package/dist/tracks.mjs +37 -0
- package/dist/triggers.d.mts +45 -0
- package/dist/triggers.mjs +201 -0
- package/dist/users.d.mts +35 -0
- package/dist/users.mjs +20 -0
- package/dist/verification.d.mts +1 -0
- package/dist/verification.mjs +1 -0
- package/package.json +187 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Keystroke
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# @keystrokehq/spotify
|
|
2
|
+
|
|
3
|
+
Spotify integration for Keystroke workflows and agents.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
This package provides official Spotify authoring surfaces for:
|
|
8
|
+
|
|
9
|
+
- catalog reads across albums, artists, tracks, shows, episodes, audiobooks, and chapters
|
|
10
|
+
- playlist management, follow/library helpers, and playback controls
|
|
11
|
+
- polling triggers for devices, playlists, recently played tracks, and saved items
|
|
12
|
+
- an official Spotify platform-app credential seed for Keystroke-managed OAuth
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
pnpm add @keystrokehq/spotify
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Credentials
|
|
21
|
+
|
|
22
|
+
Public connection shape:
|
|
23
|
+
|
|
24
|
+
- `SPOTIFY_ACCESS_TOKEN`
|
|
25
|
+
|
|
26
|
+
Internal provider-app credential shape:
|
|
27
|
+
|
|
28
|
+
- `clientId`
|
|
29
|
+
- `clientSecret`
|
|
30
|
+
|
|
31
|
+
Spotify access tokens are short-lived and the public connection is modeled as OAuth. Provider-owned app credentials stay on the internal platform-app seed rather than the public user connection.
|
|
32
|
+
|
|
33
|
+
## Safety Model
|
|
34
|
+
|
|
35
|
+
Mutating operations are marked with `needsApproval: true`.
|
|
36
|
+
|
|
37
|
+
Spotify playback writes also inherit Spotify's own Premium and device-availability constraints.
|
|
38
|
+
|
|
39
|
+
## Example
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
import { spotify } from '@keystrokehq/spotify/connection';
|
|
43
|
+
import { getAlbum } from '@keystrokehq/spotify/albums';
|
|
44
|
+
import { createPlaylist } from '@keystrokehq/spotify/playlists';
|
|
45
|
+
|
|
46
|
+
void spotify;
|
|
47
|
+
void getAlbum;
|
|
48
|
+
void createPlaylist;
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
import { spotifyOperations } from '@keystrokehq/spotify/operations';
|
|
53
|
+
|
|
54
|
+
void spotifyOperations.get_spotify_album;
|
|
55
|
+
void spotifyOperations.SPOTIFY_GET_AN_ARTIST;
|
|
56
|
+
void spotifyOperations.SPOTIFY_GET_RECENTLY_PLAYED_TRACKS;
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
import { polling } from '@keystrokehq/spotify/triggers';
|
|
61
|
+
|
|
62
|
+
void polling.newDeviceAdded({ schedule: '5m' });
|
|
63
|
+
void polling.playlistItemsChanged({ playlistId: 'playlist-123', schedule: '10m' });
|
|
64
|
+
void polling.savedItemAdded({ itemType: 'track', schedule: '15m' });
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Domain Modules
|
|
68
|
+
|
|
69
|
+
- `@keystrokehq/spotify/albums`
|
|
70
|
+
- `@keystrokehq/spotify/artists`
|
|
71
|
+
- `@keystrokehq/spotify/tracks`
|
|
72
|
+
- `@keystrokehq/spotify/shows`
|
|
73
|
+
- `@keystrokehq/spotify/episodes`
|
|
74
|
+
- `@keystrokehq/spotify/audiobooks`
|
|
75
|
+
- `@keystrokehq/spotify/chapters`
|
|
76
|
+
- `@keystrokehq/spotify/search`
|
|
77
|
+
- `@keystrokehq/spotify/browse`
|
|
78
|
+
- `@keystrokehq/spotify/markets`
|
|
79
|
+
- `@keystrokehq/spotify/genres`
|
|
80
|
+
- `@keystrokehq/spotify/categories`
|
|
81
|
+
- `@keystrokehq/spotify/recommendations`
|
|
82
|
+
- `@keystrokehq/spotify/playlists`
|
|
83
|
+
- `@keystrokehq/spotify/users`
|
|
84
|
+
- `@keystrokehq/spotify/me`
|
|
85
|
+
- `@keystrokehq/spotify/follow`
|
|
86
|
+
- `@keystrokehq/spotify/player`
|
|
87
|
+
- `@keystrokehq/spotify/library`
|
|
88
|
+
- `@keystrokehq/spotify/audio-features`
|
|
89
|
+
- `@keystrokehq/spotify/audio-analysis`
|
|
90
|
+
- `@keystrokehq/spotify/operations`
|
|
91
|
+
- `@keystrokehq/spotify/triggers`
|
|
92
|
+
|
|
93
|
+
## Polling Triggers
|
|
94
|
+
|
|
95
|
+
Spotify does not expose a server-side webhook/event surface for this package, so all first-class triggers are polling-based:
|
|
96
|
+
|
|
97
|
+
- `polling.newDeviceAdded()`
|
|
98
|
+
- `polling.playlistItemsChanged({ playlistId })`
|
|
99
|
+
- `polling.userPlaylistsChanged()`
|
|
100
|
+
- `polling.recentlyPlayedTrackAdded()`
|
|
101
|
+
- `polling.savedItemAdded({ itemType })`
|
|
102
|
+
|
|
103
|
+
## Deprecated Or Restricted Endpoints
|
|
104
|
+
|
|
105
|
+
Spotify's current platform docs still expose some endpoints that may be restricted or return app-eligibility errors for newer apps. This package keeps those operations available, but documents them as deprecated where applicable:
|
|
106
|
+
|
|
107
|
+
- artist related artists
|
|
108
|
+
- available genre seeds
|
|
109
|
+
- recommendations
|
|
110
|
+
- audio features
|
|
111
|
+
- audio analysis
|
|
112
|
+
- featured playlists
|
|
113
|
+
- category playlists
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { i as spotifyOfficialIntegration, r as spotifyBundle } from "../integration-DQ5Egd4f.mjs";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { CredentialSet } from "@keystrokehq/core";
|
|
4
|
+
import * as _keystrokehq_core_credential_set0 from "@keystrokehq/core/credential-set";
|
|
5
|
+
|
|
6
|
+
//#region src/_official/provider-app.d.ts
|
|
7
|
+
declare const spotifyAppCredentialSet: CredentialSet<"spotify-app", z.ZodObject<{
|
|
8
|
+
clientId: z.ZodString;
|
|
9
|
+
clientSecret: z.ZodString;
|
|
10
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
11
|
+
clientId: z.ZodString;
|
|
12
|
+
clientSecret: z.ZodString;
|
|
13
|
+
}, z.core.$strip>>[] | undefined>;
|
|
14
|
+
declare const spotifyPlatformProviderSeed: {
|
|
15
|
+
readonly provider: "spotify";
|
|
16
|
+
readonly appRef: "spotify-platform";
|
|
17
|
+
readonly displayName: "Spotify Platform";
|
|
18
|
+
readonly credentialSetName: "Keystroke Spotify Platform App";
|
|
19
|
+
readonly envShape: {
|
|
20
|
+
readonly KEYSTROKE_PLATFORM_SPOTIFY_CLIENT_ID: z.ZodOptional<z.ZodString>;
|
|
21
|
+
readonly KEYSTROKE_PLATFORM_SPOTIFY_CLIENT_SECRET: z.ZodOptional<z.ZodString>;
|
|
22
|
+
};
|
|
23
|
+
readonly requiredEnvKeys: readonly ["KEYSTROKE_PLATFORM_SPOTIFY_CLIENT_ID", "KEYSTROKE_PLATFORM_SPOTIFY_CLIENT_SECRET"];
|
|
24
|
+
readonly externalAppIdEnvKey: "KEYSTROKE_PLATFORM_SPOTIFY_CLIENT_ID";
|
|
25
|
+
readonly buildCredentials: (env: Record<string, string | undefined>) => {
|
|
26
|
+
clientId: string | undefined;
|
|
27
|
+
clientSecret: string | undefined;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
type SpotifyAppCredentials = z.infer<typeof spotifyAppCredentialSet.auth>;
|
|
31
|
+
//#endregion
|
|
32
|
+
export { SpotifyAppCredentials, spotifyAppCredentialSet, spotifyBundle, spotifyOfficialIntegration, spotifyPlatformProviderSeed };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import * as _keystrokehq_core0 from "@keystrokehq/core";
|
|
3
|
+
import * as _keystrokehq_core_credential_set0 from "@keystrokehq/core/credential-set";
|
|
4
|
+
|
|
5
|
+
//#region src/albums.d.ts
|
|
6
|
+
declare const getAlbum: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
7
|
+
id: z.ZodString;
|
|
8
|
+
market: z.ZodOptional<z.ZodString>;
|
|
9
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
10
|
+
albumType: z.ZodOptional<z.ZodEnum<{
|
|
11
|
+
album: "album";
|
|
12
|
+
single: "single";
|
|
13
|
+
compilation: "compilation";
|
|
14
|
+
}>>;
|
|
15
|
+
artists: z.ZodArray<z.ZodObject<{
|
|
16
|
+
externalUrls: z.ZodOptional<z.ZodObject<{
|
|
17
|
+
spotify: z.ZodOptional<z.ZodURL>;
|
|
18
|
+
}, z.core.$strip>>;
|
|
19
|
+
href: z.ZodOptional<z.ZodURL>;
|
|
20
|
+
id: z.ZodString;
|
|
21
|
+
name: z.ZodString;
|
|
22
|
+
type: z.ZodLiteral<"artist">;
|
|
23
|
+
uri: z.ZodOptional<z.ZodString>;
|
|
24
|
+
}, z.core.$strip>>;
|
|
25
|
+
availableMarkets: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
26
|
+
externalUrls: z.ZodOptional<z.ZodObject<{
|
|
27
|
+
spotify: z.ZodOptional<z.ZodURL>;
|
|
28
|
+
}, z.core.$strip>>;
|
|
29
|
+
href: z.ZodOptional<z.ZodURL>;
|
|
30
|
+
id: z.ZodString;
|
|
31
|
+
images: z.ZodArray<z.ZodObject<{
|
|
32
|
+
url: z.ZodURL;
|
|
33
|
+
height: z.ZodNullable<z.ZodNumber>;
|
|
34
|
+
width: z.ZodNullable<z.ZodNumber>;
|
|
35
|
+
}, z.core.$strip>>;
|
|
36
|
+
name: z.ZodString;
|
|
37
|
+
releaseDate: z.ZodOptional<z.ZodString>;
|
|
38
|
+
releaseDatePrecision: z.ZodOptional<z.ZodEnum<{
|
|
39
|
+
year: "year";
|
|
40
|
+
month: "month";
|
|
41
|
+
day: "day";
|
|
42
|
+
}>>;
|
|
43
|
+
totalTracks: z.ZodOptional<z.ZodNumber>;
|
|
44
|
+
type: z.ZodLiteral<"album">;
|
|
45
|
+
uri: z.ZodOptional<z.ZodString>;
|
|
46
|
+
copyrights: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
47
|
+
text: z.ZodString;
|
|
48
|
+
type: z.ZodString;
|
|
49
|
+
}, z.core.$strip>>>;
|
|
50
|
+
genres: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
51
|
+
label: z.ZodOptional<z.ZodString>;
|
|
52
|
+
popularity: z.ZodOptional<z.ZodNumber>;
|
|
53
|
+
restrictions: z.ZodOptional<z.ZodObject<{
|
|
54
|
+
reason: z.ZodString;
|
|
55
|
+
}, z.core.$strip>>;
|
|
56
|
+
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"spotify", z.ZodObject<{
|
|
57
|
+
SPOTIFY_ACCESS_TOKEN: z.ZodString;
|
|
58
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
59
|
+
SPOTIFY_ACCESS_TOKEN: z.ZodString;
|
|
60
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
61
|
+
declare const getAlbumTracks: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
62
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
63
|
+
offset: z.ZodOptional<z.ZodNumber>;
|
|
64
|
+
id: z.ZodString;
|
|
65
|
+
market: z.ZodOptional<z.ZodString>;
|
|
66
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
67
|
+
href: z.ZodOptional<z.ZodURL>;
|
|
68
|
+
items: z.ZodArray<z.ZodObject<{
|
|
69
|
+
album: z.ZodOptional<z.ZodObject<{
|
|
70
|
+
albumType: z.ZodOptional<z.ZodEnum<{
|
|
71
|
+
album: "album";
|
|
72
|
+
single: "single";
|
|
73
|
+
compilation: "compilation";
|
|
74
|
+
}>>;
|
|
75
|
+
artists: z.ZodArray<z.ZodObject<{
|
|
76
|
+
externalUrls: z.ZodOptional<z.ZodObject<{
|
|
77
|
+
spotify: z.ZodOptional<z.ZodURL>;
|
|
78
|
+
}, z.core.$strip>>;
|
|
79
|
+
href: z.ZodOptional<z.ZodURL>;
|
|
80
|
+
id: z.ZodString;
|
|
81
|
+
name: z.ZodString;
|
|
82
|
+
type: z.ZodLiteral<"artist">;
|
|
83
|
+
uri: z.ZodOptional<z.ZodString>;
|
|
84
|
+
}, z.core.$strip>>;
|
|
85
|
+
availableMarkets: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
86
|
+
externalUrls: z.ZodOptional<z.ZodObject<{
|
|
87
|
+
spotify: z.ZodOptional<z.ZodURL>;
|
|
88
|
+
}, z.core.$strip>>;
|
|
89
|
+
href: z.ZodOptional<z.ZodURL>;
|
|
90
|
+
id: z.ZodString;
|
|
91
|
+
images: z.ZodArray<z.ZodObject<{
|
|
92
|
+
url: z.ZodURL;
|
|
93
|
+
height: z.ZodNullable<z.ZodNumber>;
|
|
94
|
+
width: z.ZodNullable<z.ZodNumber>;
|
|
95
|
+
}, z.core.$strip>>;
|
|
96
|
+
name: z.ZodString;
|
|
97
|
+
releaseDate: z.ZodOptional<z.ZodString>;
|
|
98
|
+
releaseDatePrecision: z.ZodOptional<z.ZodEnum<{
|
|
99
|
+
year: "year";
|
|
100
|
+
month: "month";
|
|
101
|
+
day: "day";
|
|
102
|
+
}>>;
|
|
103
|
+
totalTracks: z.ZodOptional<z.ZodNumber>;
|
|
104
|
+
type: z.ZodLiteral<"album">;
|
|
105
|
+
uri: z.ZodOptional<z.ZodString>;
|
|
106
|
+
}, z.core.$strip>>;
|
|
107
|
+
artists: z.ZodArray<z.ZodObject<{
|
|
108
|
+
externalUrls: z.ZodOptional<z.ZodObject<{
|
|
109
|
+
spotify: z.ZodOptional<z.ZodURL>;
|
|
110
|
+
}, z.core.$strip>>;
|
|
111
|
+
href: z.ZodOptional<z.ZodURL>;
|
|
112
|
+
id: z.ZodString;
|
|
113
|
+
name: z.ZodString;
|
|
114
|
+
type: z.ZodLiteral<"artist">;
|
|
115
|
+
uri: z.ZodOptional<z.ZodString>;
|
|
116
|
+
}, z.core.$strip>>;
|
|
117
|
+
availableMarkets: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
118
|
+
discNumber: z.ZodOptional<z.ZodNumber>;
|
|
119
|
+
durationMs: z.ZodNumber;
|
|
120
|
+
explicit: z.ZodBoolean;
|
|
121
|
+
externalIds: z.ZodOptional<z.ZodObject<{
|
|
122
|
+
isrc: z.ZodOptional<z.ZodString>;
|
|
123
|
+
ean: z.ZodOptional<z.ZodString>;
|
|
124
|
+
upc: z.ZodOptional<z.ZodString>;
|
|
125
|
+
}, z.core.$strip>>;
|
|
126
|
+
externalUrls: z.ZodOptional<z.ZodObject<{
|
|
127
|
+
spotify: z.ZodOptional<z.ZodURL>;
|
|
128
|
+
}, z.core.$strip>>;
|
|
129
|
+
href: z.ZodOptional<z.ZodURL>;
|
|
130
|
+
id: z.ZodString;
|
|
131
|
+
isLocal: z.ZodOptional<z.ZodBoolean>;
|
|
132
|
+
isPlayable: z.ZodOptional<z.ZodBoolean>;
|
|
133
|
+
name: z.ZodString;
|
|
134
|
+
popularity: z.ZodOptional<z.ZodNumber>;
|
|
135
|
+
previewUrl: z.ZodOptional<z.ZodUnion<readonly [z.ZodURL, z.ZodNull]>>;
|
|
136
|
+
restrictions: z.ZodOptional<z.ZodObject<{
|
|
137
|
+
reason: z.ZodString;
|
|
138
|
+
}, z.core.$strip>>;
|
|
139
|
+
trackNumber: z.ZodOptional<z.ZodNumber>;
|
|
140
|
+
type: z.ZodLiteral<"track">;
|
|
141
|
+
uri: z.ZodOptional<z.ZodString>;
|
|
142
|
+
}, z.core.$strip>>;
|
|
143
|
+
limit: z.ZodNumber;
|
|
144
|
+
nextPageToken: z.ZodOptional<z.ZodString>;
|
|
145
|
+
offset: z.ZodNumber;
|
|
146
|
+
previousPageToken: z.ZodOptional<z.ZodString>;
|
|
147
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
148
|
+
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"spotify", z.ZodObject<{
|
|
149
|
+
SPOTIFY_ACCESS_TOKEN: z.ZodString;
|
|
150
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
151
|
+
SPOTIFY_ACCESS_TOKEN: z.ZodString;
|
|
152
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
153
|
+
declare const getSeveralAlbums: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
154
|
+
ids: z.ZodArray<z.ZodString>;
|
|
155
|
+
market: z.ZodOptional<z.ZodString>;
|
|
156
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
157
|
+
albums: z.ZodArray<z.ZodObject<{
|
|
158
|
+
albumType: z.ZodOptional<z.ZodEnum<{
|
|
159
|
+
album: "album";
|
|
160
|
+
single: "single";
|
|
161
|
+
compilation: "compilation";
|
|
162
|
+
}>>;
|
|
163
|
+
artists: z.ZodArray<z.ZodObject<{
|
|
164
|
+
externalUrls: z.ZodOptional<z.ZodObject<{
|
|
165
|
+
spotify: z.ZodOptional<z.ZodURL>;
|
|
166
|
+
}, z.core.$strip>>;
|
|
167
|
+
href: z.ZodOptional<z.ZodURL>;
|
|
168
|
+
id: z.ZodString;
|
|
169
|
+
name: z.ZodString;
|
|
170
|
+
type: z.ZodLiteral<"artist">;
|
|
171
|
+
uri: z.ZodOptional<z.ZodString>;
|
|
172
|
+
}, z.core.$strip>>;
|
|
173
|
+
availableMarkets: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
174
|
+
externalUrls: z.ZodOptional<z.ZodObject<{
|
|
175
|
+
spotify: z.ZodOptional<z.ZodURL>;
|
|
176
|
+
}, z.core.$strip>>;
|
|
177
|
+
href: z.ZodOptional<z.ZodURL>;
|
|
178
|
+
id: z.ZodString;
|
|
179
|
+
images: z.ZodArray<z.ZodObject<{
|
|
180
|
+
url: z.ZodURL;
|
|
181
|
+
height: z.ZodNullable<z.ZodNumber>;
|
|
182
|
+
width: z.ZodNullable<z.ZodNumber>;
|
|
183
|
+
}, z.core.$strip>>;
|
|
184
|
+
name: z.ZodString;
|
|
185
|
+
releaseDate: z.ZodOptional<z.ZodString>;
|
|
186
|
+
releaseDatePrecision: z.ZodOptional<z.ZodEnum<{
|
|
187
|
+
year: "year";
|
|
188
|
+
month: "month";
|
|
189
|
+
day: "day";
|
|
190
|
+
}>>;
|
|
191
|
+
totalTracks: z.ZodOptional<z.ZodNumber>;
|
|
192
|
+
type: z.ZodLiteral<"album">;
|
|
193
|
+
uri: z.ZodOptional<z.ZodString>;
|
|
194
|
+
copyrights: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
195
|
+
text: z.ZodString;
|
|
196
|
+
type: z.ZodString;
|
|
197
|
+
}, z.core.$strip>>>;
|
|
198
|
+
genres: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
199
|
+
label: z.ZodOptional<z.ZodString>;
|
|
200
|
+
popularity: z.ZodOptional<z.ZodNumber>;
|
|
201
|
+
restrictions: z.ZodOptional<z.ZodObject<{
|
|
202
|
+
reason: z.ZodString;
|
|
203
|
+
}, z.core.$strip>>;
|
|
204
|
+
}, z.core.$strip>>;
|
|
205
|
+
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"spotify", z.ZodObject<{
|
|
206
|
+
SPOTIFY_ACCESS_TOKEN: z.ZodString;
|
|
207
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
208
|
+
SPOTIFY_ACCESS_TOKEN: z.ZodString;
|
|
209
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
210
|
+
declare const getNewReleases: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
211
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
212
|
+
offset: z.ZodOptional<z.ZodNumber>;
|
|
213
|
+
country: z.ZodOptional<z.ZodString>;
|
|
214
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
215
|
+
href: z.ZodOptional<z.ZodURL>;
|
|
216
|
+
items: z.ZodArray<z.ZodObject<{
|
|
217
|
+
albumType: z.ZodOptional<z.ZodEnum<{
|
|
218
|
+
album: "album";
|
|
219
|
+
single: "single";
|
|
220
|
+
compilation: "compilation";
|
|
221
|
+
}>>;
|
|
222
|
+
artists: z.ZodArray<z.ZodObject<{
|
|
223
|
+
externalUrls: z.ZodOptional<z.ZodObject<{
|
|
224
|
+
spotify: z.ZodOptional<z.ZodURL>;
|
|
225
|
+
}, z.core.$strip>>;
|
|
226
|
+
href: z.ZodOptional<z.ZodURL>;
|
|
227
|
+
id: z.ZodString;
|
|
228
|
+
name: z.ZodString;
|
|
229
|
+
type: z.ZodLiteral<"artist">;
|
|
230
|
+
uri: z.ZodOptional<z.ZodString>;
|
|
231
|
+
}, z.core.$strip>>;
|
|
232
|
+
availableMarkets: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
233
|
+
externalUrls: z.ZodOptional<z.ZodObject<{
|
|
234
|
+
spotify: z.ZodOptional<z.ZodURL>;
|
|
235
|
+
}, z.core.$strip>>;
|
|
236
|
+
href: z.ZodOptional<z.ZodURL>;
|
|
237
|
+
id: z.ZodString;
|
|
238
|
+
images: z.ZodArray<z.ZodObject<{
|
|
239
|
+
url: z.ZodURL;
|
|
240
|
+
height: z.ZodNullable<z.ZodNumber>;
|
|
241
|
+
width: z.ZodNullable<z.ZodNumber>;
|
|
242
|
+
}, z.core.$strip>>;
|
|
243
|
+
name: z.ZodString;
|
|
244
|
+
releaseDate: z.ZodOptional<z.ZodString>;
|
|
245
|
+
releaseDatePrecision: z.ZodOptional<z.ZodEnum<{
|
|
246
|
+
year: "year";
|
|
247
|
+
month: "month";
|
|
248
|
+
day: "day";
|
|
249
|
+
}>>;
|
|
250
|
+
totalTracks: z.ZodOptional<z.ZodNumber>;
|
|
251
|
+
type: z.ZodLiteral<"album">;
|
|
252
|
+
uri: z.ZodOptional<z.ZodString>;
|
|
253
|
+
}, z.core.$strip>>;
|
|
254
|
+
limit: z.ZodNumber;
|
|
255
|
+
nextPageToken: z.ZodOptional<z.ZodString>;
|
|
256
|
+
offset: z.ZodNumber;
|
|
257
|
+
previousPageToken: z.ZodOptional<z.ZodString>;
|
|
258
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
259
|
+
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"spotify", z.ZodObject<{
|
|
260
|
+
SPOTIFY_ACCESS_TOKEN: z.ZodString;
|
|
261
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
262
|
+
SPOTIFY_ACCESS_TOKEN: z.ZodString;
|
|
263
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
264
|
+
//#endregion
|
|
265
|
+
export { getAlbum, getAlbumTracks, getNewReleases, getSeveralAlbums };
|
package/dist/albums.mjs
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { spotifyAlbumPageSchema, spotifyAlbumSchema, spotifyIdSchema, spotifyMarketSchema, spotifyTrackPageSchema } from "./schemas.mjs";
|
|
2
|
+
import { createSpotifyClient } from "./client.mjs";
|
|
3
|
+
import { t as spotifyOperation } from "./factory-tZba6Hij.mjs";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
|
|
6
|
+
//#region src/albums.ts
|
|
7
|
+
const albumIdListSchema = z.array(spotifyIdSchema).min(1).max(20);
|
|
8
|
+
const pagingSchema = z.object({
|
|
9
|
+
limit: z.number().int().positive().max(50).optional(),
|
|
10
|
+
offset: z.number().int().nonnegative().optional()
|
|
11
|
+
});
|
|
12
|
+
const severalAlbumsResponseSchema = z.object({ albums: z.array(spotifyAlbumSchema) });
|
|
13
|
+
const getAlbum = spotifyOperation({
|
|
14
|
+
id: "get_spotify_album",
|
|
15
|
+
name: "Get Spotify Album",
|
|
16
|
+
description: "Fetch a Spotify album by its ID.",
|
|
17
|
+
input: z.object({
|
|
18
|
+
id: spotifyIdSchema,
|
|
19
|
+
market: spotifyMarketSchema.optional()
|
|
20
|
+
}),
|
|
21
|
+
output: spotifyAlbumSchema,
|
|
22
|
+
run: async (input, credentials) => {
|
|
23
|
+
return createSpotifyClient(credentials).albums.getAlbum(input.id, input.market);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
const getAlbumTracks = spotifyOperation({
|
|
27
|
+
id: "get_spotify_album_tracks",
|
|
28
|
+
name: "Get Spotify Album Tracks",
|
|
29
|
+
description: "List tracks for a Spotify album.",
|
|
30
|
+
input: pagingSchema.extend({
|
|
31
|
+
id: spotifyIdSchema,
|
|
32
|
+
market: spotifyMarketSchema.optional()
|
|
33
|
+
}),
|
|
34
|
+
output: spotifyTrackPageSchema,
|
|
35
|
+
run: async (input, credentials) => {
|
|
36
|
+
return createSpotifyClient(credentials).albums.getAlbumTracks(input.id, {
|
|
37
|
+
market: input.market,
|
|
38
|
+
limit: input.limit,
|
|
39
|
+
offset: input.offset
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
const getSeveralAlbums = spotifyOperation({
|
|
44
|
+
id: "get_spotify_several_albums",
|
|
45
|
+
name: "Get Several Spotify Albums",
|
|
46
|
+
description: "Fetch multiple Spotify albums in one request.",
|
|
47
|
+
input: z.object({
|
|
48
|
+
ids: albumIdListSchema,
|
|
49
|
+
market: spotifyMarketSchema.optional()
|
|
50
|
+
}),
|
|
51
|
+
output: severalAlbumsResponseSchema,
|
|
52
|
+
run: async (input, credentials) => {
|
|
53
|
+
return createSpotifyClient(credentials).albums.getSeveralAlbums(input.ids, input.market);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
const getNewReleases = spotifyOperation({
|
|
57
|
+
id: "get_spotify_new_releases",
|
|
58
|
+
name: "Get Spotify New Releases",
|
|
59
|
+
description: "List Spotify new-release albums for a market.",
|
|
60
|
+
input: pagingSchema.extend({ country: spotifyMarketSchema.optional() }),
|
|
61
|
+
output: spotifyAlbumPageSchema,
|
|
62
|
+
run: async (input, credentials) => {
|
|
63
|
+
return createSpotifyClient(credentials).albums.getNewReleases({
|
|
64
|
+
country: input.country,
|
|
65
|
+
limit: input.limit,
|
|
66
|
+
offset: input.offset
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
//#endregion
|
|
72
|
+
export { getAlbum, getAlbumTracks, getNewReleases, getSeveralAlbums };
|