@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/dist/library.mjs
ADDED
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import { spotifyBooleanListSchema, spotifyIdSchema, spotifyMarketSchema, spotifyMutationSuccessSchema, spotifySavedAlbumPageSchema, spotifySavedAudiobookPageSchema, spotifySavedEpisodePageSchema, spotifySavedShowPageSchema, spotifySavedTrackPageSchema } 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/library.ts
|
|
7
|
+
const offsetPaginationInputSchema = z.object({
|
|
8
|
+
limit: z.number().int().positive().max(50).optional(),
|
|
9
|
+
offset: z.number().int().nonnegative().optional()
|
|
10
|
+
});
|
|
11
|
+
const marketOffsetPaginationInputSchema = offsetPaginationInputSchema.extend({ market: spotifyMarketSchema.optional() });
|
|
12
|
+
const savedItemIdsInputSchema = z.object({ ids: z.array(spotifyIdSchema).min(1).max(50) });
|
|
13
|
+
const listSavedAlbums = spotifyOperation({
|
|
14
|
+
id: "list_saved_albums",
|
|
15
|
+
name: "List Saved Albums",
|
|
16
|
+
description: "List albums saved in the connected Spotify account library.",
|
|
17
|
+
input: marketOffsetPaginationInputSchema,
|
|
18
|
+
output: spotifySavedAlbumPageSchema,
|
|
19
|
+
run: async (input, credentials) => {
|
|
20
|
+
return createSpotifyClient(credentials).library.listSavedAlbums(input);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const saveAlbums = spotifyOperation({
|
|
24
|
+
id: "save_albums",
|
|
25
|
+
name: "Save Albums",
|
|
26
|
+
description: "Save albums to the connected Spotify account library.",
|
|
27
|
+
input: savedItemIdsInputSchema,
|
|
28
|
+
output: spotifyMutationSuccessSchema,
|
|
29
|
+
needsApproval: true,
|
|
30
|
+
run: async (input, credentials) => {
|
|
31
|
+
return createSpotifyClient(credentials).library.saveAlbums(input.ids);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
const removeSavedAlbums = spotifyOperation({
|
|
35
|
+
id: "remove_saved_albums",
|
|
36
|
+
name: "Remove Saved Albums",
|
|
37
|
+
description: "Remove saved albums from the connected Spotify account library.",
|
|
38
|
+
input: savedItemIdsInputSchema,
|
|
39
|
+
output: spotifyMutationSuccessSchema,
|
|
40
|
+
needsApproval: true,
|
|
41
|
+
run: async (input, credentials) => {
|
|
42
|
+
return createSpotifyClient(credentials).library.removeSavedAlbums(input.ids);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
const checkSavedAlbums = spotifyOperation({
|
|
46
|
+
id: "check_saved_albums",
|
|
47
|
+
name: "Check Saved Albums",
|
|
48
|
+
description: "Check whether albums are saved in the connected Spotify account library.",
|
|
49
|
+
input: savedItemIdsInputSchema,
|
|
50
|
+
output: spotifyBooleanListSchema,
|
|
51
|
+
run: async (input, credentials) => {
|
|
52
|
+
return createSpotifyClient(credentials).library.checkSavedAlbums(input.ids);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
const listSavedTracks = spotifyOperation({
|
|
56
|
+
id: "list_saved_tracks",
|
|
57
|
+
name: "List Saved Tracks",
|
|
58
|
+
description: "List tracks saved in the connected Spotify account library.",
|
|
59
|
+
input: marketOffsetPaginationInputSchema,
|
|
60
|
+
output: spotifySavedTrackPageSchema,
|
|
61
|
+
run: async (input, credentials) => {
|
|
62
|
+
return createSpotifyClient(credentials).library.listSavedTracks(input);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
const saveTracks = spotifyOperation({
|
|
66
|
+
id: "save_tracks",
|
|
67
|
+
name: "Save Tracks",
|
|
68
|
+
description: "Save tracks to the connected Spotify account library.",
|
|
69
|
+
input: savedItemIdsInputSchema,
|
|
70
|
+
output: spotifyMutationSuccessSchema,
|
|
71
|
+
needsApproval: true,
|
|
72
|
+
run: async (input, credentials) => {
|
|
73
|
+
return createSpotifyClient(credentials).library.saveTracks(input.ids);
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
const removeSavedTracks = spotifyOperation({
|
|
77
|
+
id: "remove_saved_tracks",
|
|
78
|
+
name: "Remove Saved Tracks",
|
|
79
|
+
description: "Remove saved tracks from the connected Spotify account library.",
|
|
80
|
+
input: savedItemIdsInputSchema,
|
|
81
|
+
output: spotifyMutationSuccessSchema,
|
|
82
|
+
needsApproval: true,
|
|
83
|
+
run: async (input, credentials) => {
|
|
84
|
+
return createSpotifyClient(credentials).library.removeSavedTracks(input.ids);
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
const checkSavedTracks = spotifyOperation({
|
|
88
|
+
id: "check_saved_tracks",
|
|
89
|
+
name: "Check Saved Tracks",
|
|
90
|
+
description: "Check whether tracks are saved in the connected Spotify account library.",
|
|
91
|
+
input: savedItemIdsInputSchema,
|
|
92
|
+
output: spotifyBooleanListSchema,
|
|
93
|
+
run: async (input, credentials) => {
|
|
94
|
+
return createSpotifyClient(credentials).library.checkSavedTracks(input.ids);
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
const listSavedShows = spotifyOperation({
|
|
98
|
+
id: "list_saved_shows",
|
|
99
|
+
name: "List Saved Shows",
|
|
100
|
+
description: "List shows saved in the connected Spotify account library.",
|
|
101
|
+
input: offsetPaginationInputSchema,
|
|
102
|
+
output: spotifySavedShowPageSchema,
|
|
103
|
+
run: async (input, credentials) => {
|
|
104
|
+
return createSpotifyClient(credentials).library.listSavedShows(input);
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
const saveShows = spotifyOperation({
|
|
108
|
+
id: "save_shows",
|
|
109
|
+
name: "Save Shows",
|
|
110
|
+
description: "Save shows to the connected Spotify account library.",
|
|
111
|
+
input: savedItemIdsInputSchema,
|
|
112
|
+
output: spotifyMutationSuccessSchema,
|
|
113
|
+
needsApproval: true,
|
|
114
|
+
run: async (input, credentials) => {
|
|
115
|
+
return createSpotifyClient(credentials).library.saveShows(input.ids);
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
const removeSavedShows = spotifyOperation({
|
|
119
|
+
id: "remove_saved_shows",
|
|
120
|
+
name: "Remove Saved Shows",
|
|
121
|
+
description: "Remove saved shows from the connected Spotify account library.",
|
|
122
|
+
input: savedItemIdsInputSchema,
|
|
123
|
+
output: spotifyMutationSuccessSchema,
|
|
124
|
+
needsApproval: true,
|
|
125
|
+
run: async (input, credentials) => {
|
|
126
|
+
return createSpotifyClient(credentials).library.removeSavedShows(input.ids);
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
const checkSavedShows = spotifyOperation({
|
|
130
|
+
id: "check_saved_shows",
|
|
131
|
+
name: "Check Saved Shows",
|
|
132
|
+
description: "Check whether shows are saved in the connected Spotify account library.",
|
|
133
|
+
input: savedItemIdsInputSchema,
|
|
134
|
+
output: spotifyBooleanListSchema,
|
|
135
|
+
run: async (input, credentials) => {
|
|
136
|
+
return createSpotifyClient(credentials).library.checkSavedShows(input.ids);
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
const listSavedEpisodes = spotifyOperation({
|
|
140
|
+
id: "list_saved_episodes",
|
|
141
|
+
name: "List Saved Episodes",
|
|
142
|
+
description: "List episodes saved in the connected Spotify account library.",
|
|
143
|
+
input: marketOffsetPaginationInputSchema,
|
|
144
|
+
output: spotifySavedEpisodePageSchema,
|
|
145
|
+
run: async (input, credentials) => {
|
|
146
|
+
return createSpotifyClient(credentials).library.listSavedEpisodes(input);
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
const saveEpisodes = spotifyOperation({
|
|
150
|
+
id: "save_episodes",
|
|
151
|
+
name: "Save Episodes",
|
|
152
|
+
description: "Save episodes to the connected Spotify account library.",
|
|
153
|
+
input: savedItemIdsInputSchema,
|
|
154
|
+
output: spotifyMutationSuccessSchema,
|
|
155
|
+
needsApproval: true,
|
|
156
|
+
run: async (input, credentials) => {
|
|
157
|
+
return createSpotifyClient(credentials).library.saveEpisodes(input.ids);
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
const removeSavedEpisodes = spotifyOperation({
|
|
161
|
+
id: "remove_saved_episodes",
|
|
162
|
+
name: "Remove Saved Episodes",
|
|
163
|
+
description: "Remove saved episodes from the connected Spotify account library.",
|
|
164
|
+
input: savedItemIdsInputSchema,
|
|
165
|
+
output: spotifyMutationSuccessSchema,
|
|
166
|
+
needsApproval: true,
|
|
167
|
+
run: async (input, credentials) => {
|
|
168
|
+
return createSpotifyClient(credentials).library.removeSavedEpisodes(input.ids);
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
const checkSavedEpisodes = spotifyOperation({
|
|
172
|
+
id: "check_saved_episodes",
|
|
173
|
+
name: "Check Saved Episodes",
|
|
174
|
+
description: "Check whether episodes are saved in the connected Spotify account library.",
|
|
175
|
+
input: savedItemIdsInputSchema,
|
|
176
|
+
output: spotifyBooleanListSchema,
|
|
177
|
+
run: async (input, credentials) => {
|
|
178
|
+
return createSpotifyClient(credentials).library.checkSavedEpisodes(input.ids);
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
const listSavedAudiobooks = spotifyOperation({
|
|
182
|
+
id: "list_saved_audiobooks",
|
|
183
|
+
name: "List Saved Audiobooks",
|
|
184
|
+
description: "List audiobooks saved in the connected Spotify account library.",
|
|
185
|
+
input: offsetPaginationInputSchema,
|
|
186
|
+
output: spotifySavedAudiobookPageSchema,
|
|
187
|
+
run: async (input, credentials) => {
|
|
188
|
+
return createSpotifyClient(credentials).library.listSavedAudiobooks(input);
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
const saveAudiobooks = spotifyOperation({
|
|
192
|
+
id: "save_audiobooks",
|
|
193
|
+
name: "Save Audiobooks",
|
|
194
|
+
description: "Save audiobooks to the connected Spotify account library.",
|
|
195
|
+
input: savedItemIdsInputSchema,
|
|
196
|
+
output: spotifyMutationSuccessSchema,
|
|
197
|
+
needsApproval: true,
|
|
198
|
+
run: async (input, credentials) => {
|
|
199
|
+
return createSpotifyClient(credentials).library.saveAudiobooks(input.ids);
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
const removeSavedAudiobooks = spotifyOperation({
|
|
203
|
+
id: "remove_saved_audiobooks",
|
|
204
|
+
name: "Remove Saved Audiobooks",
|
|
205
|
+
description: "Remove saved audiobooks from the connected Spotify account library.",
|
|
206
|
+
input: savedItemIdsInputSchema,
|
|
207
|
+
output: spotifyMutationSuccessSchema,
|
|
208
|
+
needsApproval: true,
|
|
209
|
+
run: async (input, credentials) => {
|
|
210
|
+
return createSpotifyClient(credentials).library.removeSavedAudiobooks(input.ids);
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
const checkSavedAudiobooks = spotifyOperation({
|
|
214
|
+
id: "check_saved_audiobooks",
|
|
215
|
+
name: "Check Saved Audiobooks",
|
|
216
|
+
description: "Check whether audiobooks are saved in the connected Spotify account library.",
|
|
217
|
+
input: savedItemIdsInputSchema,
|
|
218
|
+
output: spotifyBooleanListSchema,
|
|
219
|
+
run: async (input, credentials) => {
|
|
220
|
+
return createSpotifyClient(credentials).library.checkSavedAudiobooks(input.ids);
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
//#endregion
|
|
225
|
+
export { checkSavedAlbums, checkSavedAudiobooks, checkSavedEpisodes, checkSavedShows, checkSavedTracks, listSavedAlbums, listSavedAudiobooks, listSavedEpisodes, listSavedShows, listSavedTracks, removeSavedAlbums, removeSavedAudiobooks, removeSavedEpisodes, removeSavedShows, removeSavedTracks, saveAlbums, saveAudiobooks, saveEpisodes, saveShows, saveTracks };
|
|
@@ -0,0 +1,14 @@
|
|
|
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/markets.d.ts
|
|
6
|
+
declare const getAvailableMarkets: _keystrokehq_core0.Operation<z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
|
|
7
|
+
markets: z.ZodArray<z.ZodString>;
|
|
8
|
+
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"spotify", z.ZodObject<{
|
|
9
|
+
SPOTIFY_ACCESS_TOKEN: z.ZodString;
|
|
10
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
11
|
+
SPOTIFY_ACCESS_TOKEN: z.ZodString;
|
|
12
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { getAvailableMarkets };
|
package/dist/markets.mjs
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { spotifyMarketSchema } 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/markets.ts
|
|
7
|
+
const availableMarketsResponseSchema = z.object({ markets: z.array(spotifyMarketSchema) });
|
|
8
|
+
const getAvailableMarkets = spotifyOperation({
|
|
9
|
+
id: "get_spotify_available_markets",
|
|
10
|
+
name: "Get Spotify Available Markets",
|
|
11
|
+
description: "List the markets currently supported by Spotify.",
|
|
12
|
+
input: z.object({}),
|
|
13
|
+
output: availableMarketsResponseSchema,
|
|
14
|
+
run: async (_input, credentials) => {
|
|
15
|
+
return createSpotifyClient(credentials).discovery.getAvailableMarkets();
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
//#endregion
|
|
20
|
+
export { getAvailableMarkets };
|
package/dist/me.d.mts
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
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/me.d.ts
|
|
6
|
+
declare const getMe: _keystrokehq_core0.Operation<z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
|
|
7
|
+
displayName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
8
|
+
externalUrls: z.ZodOptional<z.ZodObject<{
|
|
9
|
+
spotify: z.ZodOptional<z.ZodURL>;
|
|
10
|
+
}, z.core.$strip>>;
|
|
11
|
+
followers: z.ZodOptional<z.ZodObject<{
|
|
12
|
+
href: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
|
|
13
|
+
total: z.ZodNumber;
|
|
14
|
+
}, z.core.$strip>>;
|
|
15
|
+
href: z.ZodOptional<z.ZodURL>;
|
|
16
|
+
id: z.ZodString;
|
|
17
|
+
type: z.ZodLiteral<"user">;
|
|
18
|
+
uri: z.ZodOptional<z.ZodString>;
|
|
19
|
+
email: z.ZodOptional<z.ZodEmail>;
|
|
20
|
+
country: z.ZodOptional<z.ZodString>;
|
|
21
|
+
product: z.ZodOptional<z.ZodString>;
|
|
22
|
+
images: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
23
|
+
url: z.ZodURL;
|
|
24
|
+
height: z.ZodNullable<z.ZodNumber>;
|
|
25
|
+
width: z.ZodNullable<z.ZodNumber>;
|
|
26
|
+
}, z.core.$strip>>>;
|
|
27
|
+
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"spotify", z.ZodObject<{
|
|
28
|
+
SPOTIFY_ACCESS_TOKEN: z.ZodString;
|
|
29
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
30
|
+
SPOTIFY_ACCESS_TOKEN: z.ZodString;
|
|
31
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
32
|
+
declare const getMyTopArtists: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
33
|
+
timeRange: z.ZodOptional<z.ZodEnum<{
|
|
34
|
+
short_term: "short_term";
|
|
35
|
+
medium_term: "medium_term";
|
|
36
|
+
long_term: "long_term";
|
|
37
|
+
}>>;
|
|
38
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
39
|
+
offset: z.ZodOptional<z.ZodNumber>;
|
|
40
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
41
|
+
href: z.ZodOptional<z.ZodURL>;
|
|
42
|
+
items: z.ZodArray<z.ZodObject<{
|
|
43
|
+
externalUrls: z.ZodOptional<z.ZodObject<{
|
|
44
|
+
spotify: z.ZodOptional<z.ZodURL>;
|
|
45
|
+
}, z.core.$strip>>;
|
|
46
|
+
href: z.ZodOptional<z.ZodURL>;
|
|
47
|
+
id: z.ZodString;
|
|
48
|
+
name: z.ZodString;
|
|
49
|
+
type: z.ZodLiteral<"artist">;
|
|
50
|
+
uri: z.ZodOptional<z.ZodString>;
|
|
51
|
+
followers: z.ZodOptional<z.ZodObject<{
|
|
52
|
+
href: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
|
|
53
|
+
total: z.ZodNumber;
|
|
54
|
+
}, z.core.$strip>>;
|
|
55
|
+
genres: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
56
|
+
images: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
57
|
+
url: z.ZodURL;
|
|
58
|
+
height: z.ZodNullable<z.ZodNumber>;
|
|
59
|
+
width: z.ZodNullable<z.ZodNumber>;
|
|
60
|
+
}, z.core.$strip>>>;
|
|
61
|
+
popularity: z.ZodOptional<z.ZodNumber>;
|
|
62
|
+
}, z.core.$strip>>;
|
|
63
|
+
limit: z.ZodNumber;
|
|
64
|
+
nextPageToken: z.ZodOptional<z.ZodString>;
|
|
65
|
+
offset: z.ZodNumber;
|
|
66
|
+
previousPageToken: z.ZodOptional<z.ZodString>;
|
|
67
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
68
|
+
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"spotify", z.ZodObject<{
|
|
69
|
+
SPOTIFY_ACCESS_TOKEN: z.ZodString;
|
|
70
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
71
|
+
SPOTIFY_ACCESS_TOKEN: z.ZodString;
|
|
72
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
73
|
+
declare const getMyTopTracks: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
74
|
+
timeRange: z.ZodOptional<z.ZodEnum<{
|
|
75
|
+
short_term: "short_term";
|
|
76
|
+
medium_term: "medium_term";
|
|
77
|
+
long_term: "long_term";
|
|
78
|
+
}>>;
|
|
79
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
80
|
+
offset: z.ZodOptional<z.ZodNumber>;
|
|
81
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
82
|
+
href: z.ZodOptional<z.ZodURL>;
|
|
83
|
+
items: z.ZodArray<z.ZodObject<{
|
|
84
|
+
album: z.ZodOptional<z.ZodObject<{
|
|
85
|
+
albumType: z.ZodOptional<z.ZodEnum<{
|
|
86
|
+
album: "album";
|
|
87
|
+
single: "single";
|
|
88
|
+
compilation: "compilation";
|
|
89
|
+
}>>;
|
|
90
|
+
artists: z.ZodArray<z.ZodObject<{
|
|
91
|
+
externalUrls: z.ZodOptional<z.ZodObject<{
|
|
92
|
+
spotify: z.ZodOptional<z.ZodURL>;
|
|
93
|
+
}, z.core.$strip>>;
|
|
94
|
+
href: z.ZodOptional<z.ZodURL>;
|
|
95
|
+
id: z.ZodString;
|
|
96
|
+
name: z.ZodString;
|
|
97
|
+
type: z.ZodLiteral<"artist">;
|
|
98
|
+
uri: z.ZodOptional<z.ZodString>;
|
|
99
|
+
}, z.core.$strip>>;
|
|
100
|
+
availableMarkets: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
101
|
+
externalUrls: z.ZodOptional<z.ZodObject<{
|
|
102
|
+
spotify: z.ZodOptional<z.ZodURL>;
|
|
103
|
+
}, z.core.$strip>>;
|
|
104
|
+
href: z.ZodOptional<z.ZodURL>;
|
|
105
|
+
id: z.ZodString;
|
|
106
|
+
images: z.ZodArray<z.ZodObject<{
|
|
107
|
+
url: z.ZodURL;
|
|
108
|
+
height: z.ZodNullable<z.ZodNumber>;
|
|
109
|
+
width: z.ZodNullable<z.ZodNumber>;
|
|
110
|
+
}, z.core.$strip>>;
|
|
111
|
+
name: z.ZodString;
|
|
112
|
+
releaseDate: z.ZodOptional<z.ZodString>;
|
|
113
|
+
releaseDatePrecision: z.ZodOptional<z.ZodEnum<{
|
|
114
|
+
year: "year";
|
|
115
|
+
month: "month";
|
|
116
|
+
day: "day";
|
|
117
|
+
}>>;
|
|
118
|
+
totalTracks: z.ZodOptional<z.ZodNumber>;
|
|
119
|
+
type: z.ZodLiteral<"album">;
|
|
120
|
+
uri: z.ZodOptional<z.ZodString>;
|
|
121
|
+
}, z.core.$strip>>;
|
|
122
|
+
artists: z.ZodArray<z.ZodObject<{
|
|
123
|
+
externalUrls: z.ZodOptional<z.ZodObject<{
|
|
124
|
+
spotify: z.ZodOptional<z.ZodURL>;
|
|
125
|
+
}, z.core.$strip>>;
|
|
126
|
+
href: z.ZodOptional<z.ZodURL>;
|
|
127
|
+
id: z.ZodString;
|
|
128
|
+
name: z.ZodString;
|
|
129
|
+
type: z.ZodLiteral<"artist">;
|
|
130
|
+
uri: z.ZodOptional<z.ZodString>;
|
|
131
|
+
}, z.core.$strip>>;
|
|
132
|
+
availableMarkets: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
133
|
+
discNumber: z.ZodOptional<z.ZodNumber>;
|
|
134
|
+
durationMs: z.ZodNumber;
|
|
135
|
+
explicit: z.ZodBoolean;
|
|
136
|
+
externalIds: z.ZodOptional<z.ZodObject<{
|
|
137
|
+
isrc: z.ZodOptional<z.ZodString>;
|
|
138
|
+
ean: z.ZodOptional<z.ZodString>;
|
|
139
|
+
upc: z.ZodOptional<z.ZodString>;
|
|
140
|
+
}, z.core.$strip>>;
|
|
141
|
+
externalUrls: z.ZodOptional<z.ZodObject<{
|
|
142
|
+
spotify: z.ZodOptional<z.ZodURL>;
|
|
143
|
+
}, z.core.$strip>>;
|
|
144
|
+
href: z.ZodOptional<z.ZodURL>;
|
|
145
|
+
id: z.ZodString;
|
|
146
|
+
isLocal: z.ZodOptional<z.ZodBoolean>;
|
|
147
|
+
isPlayable: z.ZodOptional<z.ZodBoolean>;
|
|
148
|
+
name: z.ZodString;
|
|
149
|
+
popularity: z.ZodOptional<z.ZodNumber>;
|
|
150
|
+
previewUrl: z.ZodOptional<z.ZodUnion<readonly [z.ZodURL, z.ZodNull]>>;
|
|
151
|
+
restrictions: z.ZodOptional<z.ZodObject<{
|
|
152
|
+
reason: z.ZodString;
|
|
153
|
+
}, z.core.$strip>>;
|
|
154
|
+
trackNumber: z.ZodOptional<z.ZodNumber>;
|
|
155
|
+
type: z.ZodLiteral<"track">;
|
|
156
|
+
uri: z.ZodOptional<z.ZodString>;
|
|
157
|
+
}, z.core.$strip>>;
|
|
158
|
+
limit: z.ZodNumber;
|
|
159
|
+
nextPageToken: z.ZodOptional<z.ZodString>;
|
|
160
|
+
offset: z.ZodNumber;
|
|
161
|
+
previousPageToken: z.ZodOptional<z.ZodString>;
|
|
162
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
163
|
+
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"spotify", z.ZodObject<{
|
|
164
|
+
SPOTIFY_ACCESS_TOKEN: z.ZodString;
|
|
165
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
166
|
+
SPOTIFY_ACCESS_TOKEN: z.ZodString;
|
|
167
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
168
|
+
//#endregion
|
|
169
|
+
export { getMe, getMyTopArtists, getMyTopTracks };
|
package/dist/me.mjs
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { spotifyArtistPageSchema, spotifyTrackPageSchema, spotifyUserSchema } 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/me.ts
|
|
7
|
+
const emptyInputSchema = z.object({});
|
|
8
|
+
const topItemTimeRangeSchema = z.enum([
|
|
9
|
+
"short_term",
|
|
10
|
+
"medium_term",
|
|
11
|
+
"long_term"
|
|
12
|
+
]);
|
|
13
|
+
const topItemsInputSchema = z.object({
|
|
14
|
+
timeRange: topItemTimeRangeSchema.optional(),
|
|
15
|
+
limit: z.number().int().min(1).max(50).optional(),
|
|
16
|
+
offset: z.number().int().nonnegative().optional()
|
|
17
|
+
});
|
|
18
|
+
const getMe = spotifyOperation({
|
|
19
|
+
id: "get_spotify_me",
|
|
20
|
+
name: "Get Spotify Me",
|
|
21
|
+
description: "Fetch the current Spotify user profile.",
|
|
22
|
+
input: emptyInputSchema,
|
|
23
|
+
output: spotifyUserSchema,
|
|
24
|
+
run: async (_input, credentials) => {
|
|
25
|
+
return createSpotifyClient(credentials).users.getMe();
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
const getMyTopArtists = spotifyOperation({
|
|
29
|
+
id: "get_spotify_my_top_artists",
|
|
30
|
+
name: "Get My Top Spotify Artists",
|
|
31
|
+
description: "List the current user's top Spotify artists.",
|
|
32
|
+
input: topItemsInputSchema,
|
|
33
|
+
output: spotifyArtistPageSchema,
|
|
34
|
+
run: async (input, credentials) => {
|
|
35
|
+
return createSpotifyClient(credentials).users.getMyTopArtists({
|
|
36
|
+
time_range: input.timeRange,
|
|
37
|
+
limit: input.limit,
|
|
38
|
+
offset: input.offset
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
const getMyTopTracks = spotifyOperation({
|
|
43
|
+
id: "get_spotify_my_top_tracks",
|
|
44
|
+
name: "Get My Top Spotify Tracks",
|
|
45
|
+
description: "List the current user's top Spotify tracks.",
|
|
46
|
+
input: topItemsInputSchema,
|
|
47
|
+
output: spotifyTrackPageSchema,
|
|
48
|
+
run: async (input, credentials) => {
|
|
49
|
+
return createSpotifyClient(credentials).users.getMyTopTracks({
|
|
50
|
+
time_range: input.timeRange,
|
|
51
|
+
limit: input.limit,
|
|
52
|
+
offset: input.offset
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
//#endregion
|
|
58
|
+
export { getMe, getMyTopArtists, getMyTopTracks };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|