yoto-nodejs-client 0.0.1 → 0.0.2
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/bin/lib/cli-helpers.d.ts +32 -0
- package/bin/lib/cli-helpers.d.ts.map +1 -1
- package/bin/lib/token-helpers.d.ts +32 -0
- package/bin/lib/token-helpers.d.ts.map +1 -1
- package/index.d.ts +368 -0
- package/index.d.ts.map +1 -1
- package/lib/api-endpoints/auth.d.ts +85 -0
- package/lib/api-endpoints/auth.d.ts.map +1 -1
- package/lib/api-endpoints/constants.d.ts +22 -0
- package/lib/api-endpoints/constants.d.ts.map +1 -1
- package/lib/api-endpoints/content.d.ts +760 -0
- package/lib/api-endpoints/content.d.ts.map +1 -1
- package/lib/api-endpoints/devices.d.ts +581 -0
- package/lib/api-endpoints/devices.d.ts.map +1 -1
- package/lib/api-endpoints/family-library-groups.d.ts +187 -0
- package/lib/api-endpoints/family-library-groups.d.ts.map +1 -1
- package/lib/api-endpoints/family.d.ts +88 -0
- package/lib/api-endpoints/family.d.ts.map +1 -1
- package/lib/api-endpoints/helpers.d.ts +37 -3
- package/lib/api-endpoints/helpers.d.ts.map +1 -1
- package/lib/api-endpoints/icons.d.ts +196 -0
- package/lib/api-endpoints/icons.d.ts.map +1 -1
- package/lib/api-endpoints/media.d.ts +83 -0
- package/lib/api-endpoints/media.d.ts.map +1 -1
- package/lib/api-endpoints/test-helpers.d.ts +21 -0
- package/lib/api-endpoints/test-helpers.d.ts.map +1 -1
- package/lib/mqtt/client.d.ts +277 -0
- package/lib/mqtt/client.d.ts.map +1 -1
- package/lib/mqtt/commands.d.ts +195 -0
- package/lib/mqtt/commands.d.ts.map +1 -1
- package/lib/mqtt/factory.d.ts +43 -0
- package/lib/mqtt/factory.d.ts.map +1 -1
- package/lib/mqtt/topics.d.ts +157 -0
- package/lib/mqtt/topics.d.ts.map +1 -1
- package/lib/token.d.ts +88 -0
- package/lib/token.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,3 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @see https://yoto.dev/api/getpublicicons/
|
|
3
|
+
* @typedef {Object} YotoPublicIconsResponse
|
|
4
|
+
* @property {YotoPublicIcon[]} displayIcons - Array of public display icons
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* @see https://yoto.dev/api/getpublicicons/
|
|
8
|
+
* @typedef {Object} YotoPublicIcon
|
|
9
|
+
* @property {string} displayIconId - Unique identifier for the icon
|
|
10
|
+
* @property {string} mediaId - Unique identifier for the underlying icon file
|
|
11
|
+
* @property {string} userId - ID of the user who uploaded this icon (always "yoto" for public icons)
|
|
12
|
+
* @property {string} createdAt - ISO 8601 timestamp when icon record was created
|
|
13
|
+
* @property {string} title - Title of the display icon
|
|
14
|
+
* @property {string} url - URL of the display icon
|
|
15
|
+
* @property {boolean} public - Indicates if the icon is public (always true for public icons)
|
|
16
|
+
* @property {boolean} [new] - Indicates if this is a new icon (may not always be present)
|
|
17
|
+
* @property {string[]} publicTags - Public tags associated with the display icon
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* Retrieves the list of public icons that are available to every user.
|
|
21
|
+
* @see https://yoto.dev/api/getpublicicons/
|
|
22
|
+
* @param {object} options
|
|
23
|
+
* @param {string} options.accessToken The API token to request with
|
|
24
|
+
* @param {string} [options.userAgent] Optional user agent string
|
|
25
|
+
* @param {RequestOptions} [options.requestOptions] Additional undici request options
|
|
26
|
+
* @return {Promise<YotoPublicIconsResponse>} Public display icons
|
|
27
|
+
* @example
|
|
28
|
+
* import { getPublicIcons } from 'yoto-nodejs-client'
|
|
29
|
+
*
|
|
30
|
+
* const icons = await getPublicIcons({
|
|
31
|
+
* accessToken
|
|
32
|
+
* })
|
|
33
|
+
*
|
|
34
|
+
* console.log(`Found ${icons.displayIcons.length} public icons`)
|
|
35
|
+
* icons.displayIcons.forEach(icon => {
|
|
36
|
+
* console.log(`${icon.title} - Tags: ${icon.publicTags.join(', ')}`)
|
|
37
|
+
* })
|
|
38
|
+
*/
|
|
1
39
|
export function getPublicIcons({ accessToken, userAgent, requestOptions }: {
|
|
2
40
|
accessToken: string;
|
|
3
41
|
userAgent?: string | undefined;
|
|
@@ -5,6 +43,30 @@ export function getPublicIcons({ accessToken, userAgent, requestOptions }: {
|
|
|
5
43
|
dispatcher?: import("undici").Dispatcher;
|
|
6
44
|
} & Omit<import("undici").Dispatcher.RequestOptions<unknown>, "origin" | "path" | "method"> & Partial<Pick<import("undici").Dispatcher.RequestOptions<null>, "method">>) | undefined;
|
|
7
45
|
}): Promise<YotoPublicIconsResponse>;
|
|
46
|
+
/**
|
|
47
|
+
* @see https://yoto.dev/api/getusericons/
|
|
48
|
+
* @typedef {Object} YotoUserIconsResponse
|
|
49
|
+
* @property {YotoUserIcon[]} displayIcons - Array of user's custom display icons
|
|
50
|
+
*/
|
|
51
|
+
/**
|
|
52
|
+
* @see https://yoto.dev/api/getusericons/
|
|
53
|
+
* @typedef {Object} YotoUserIcon
|
|
54
|
+
* @property {string} displayIconId - Unique identifier for the icon
|
|
55
|
+
* @property {string} mediaId - Unique identifier for the underlying icon file
|
|
56
|
+
* @property {string} userId - ID of the user who uploaded this icon
|
|
57
|
+
* @property {string} createdAt - ISO 8601 timestamp when icon record was created
|
|
58
|
+
* @property {string} url - URL of the display icon
|
|
59
|
+
* @property {boolean} public - Indicates if the icon is public (always false for user icons)
|
|
60
|
+
*/
|
|
61
|
+
/**
|
|
62
|
+
* Retrieves the authenticated user's custom uploaded icons.
|
|
63
|
+
* @see https://yoto.dev/api/getusericons/
|
|
64
|
+
* @param {object} options
|
|
65
|
+
* @param {string} options.accessToken The API token to request with
|
|
66
|
+
* @param {string} [options.userAgent] Optional user agent string
|
|
67
|
+
* @param {RequestOptions} [options.requestOptions] Additional undici request options
|
|
68
|
+
* @return {Promise<YotoUserIconsResponse>} User's custom display icons
|
|
69
|
+
*/
|
|
8
70
|
export function getUserIcons({ accessToken, userAgent, requestOptions }: {
|
|
9
71
|
accessToken: string;
|
|
10
72
|
userAgent?: string | undefined;
|
|
@@ -12,6 +74,65 @@ export function getUserIcons({ accessToken, userAgent, requestOptions }: {
|
|
|
12
74
|
dispatcher?: import("undici").Dispatcher;
|
|
13
75
|
} & Omit<import("undici").Dispatcher.RequestOptions<unknown>, "origin" | "path" | "method"> & Partial<Pick<import("undici").Dispatcher.RequestOptions<null>, "method">>) | undefined;
|
|
14
76
|
}): Promise<YotoUserIconsResponse>;
|
|
77
|
+
/**
|
|
78
|
+
* @see https://yoto.dev/api/uploadcustomicon/
|
|
79
|
+
* @typedef {Object} YotoUploadIconResponse
|
|
80
|
+
* @property {YotoDisplayIcon} displayIcon - The uploaded or existing display icon
|
|
81
|
+
*/
|
|
82
|
+
/**
|
|
83
|
+
* @see https://yoto.dev/api/uploadcustomicon/
|
|
84
|
+
* @typedef {Object} YotoDisplayIcon
|
|
85
|
+
* @property {string} displayIconId - Unique identifier for the icon
|
|
86
|
+
* @property {string} mediaId - Unique identifier for the underlying icon file
|
|
87
|
+
* @property {string} userId - ID of the user who uploaded this icon
|
|
88
|
+
* @property {string | object} url - URL of the display icon, or empty object {} for duplicates
|
|
89
|
+
* @property {boolean} [new] - True if this is a new upload, undefined for duplicates
|
|
90
|
+
* @property {string} [_id] - MongoDB ID (present for duplicate uploads)
|
|
91
|
+
* @property {string} [createdAt] - ISO 8601 timestamp (present for duplicate uploads)
|
|
92
|
+
*/
|
|
93
|
+
/**
|
|
94
|
+
* Uploads a custom 16×16px icon for the authenticated user.
|
|
95
|
+
* Icons are deduplicated by content - re-uploading the same image returns the existing icon.
|
|
96
|
+
*
|
|
97
|
+
* Image processing with autoConvert=true (recommended):
|
|
98
|
+
* - Auto-resizes to 16×16px (crop/pad as needed)
|
|
99
|
+
* - Adjusts brightness if > ⅔
|
|
100
|
+
* - Converts to PNG
|
|
101
|
+
* - Accepts any image format
|
|
102
|
+
*
|
|
103
|
+
* Image requirements with autoConvert=false (strict):
|
|
104
|
+
* - Must be exactly 16×16px
|
|
105
|
+
* - Only PNG or GIF allowed
|
|
106
|
+
* - PNG must be 24-bit RGBA (sRGB, 4 channels, hasAlpha, no palette)
|
|
107
|
+
* - GIF accepted as-is
|
|
108
|
+
*
|
|
109
|
+
* @see https://yoto.dev/api/uploadcustomicon/
|
|
110
|
+
* @param {object} options
|
|
111
|
+
* @param {string} options.accessToken The API token to request with
|
|
112
|
+
* @param {Buffer} options.imageData The binary image data (16×16px icon)
|
|
113
|
+
* @param {boolean} [options.autoConvert=true] Auto-resize and process the image to 16×16px
|
|
114
|
+
* @param {string} [options.filename] Override the stored base filename
|
|
115
|
+
* @param {string} [options.userAgent] Optional user agent string
|
|
116
|
+
* @param {RequestOptions} [options.requestOptions] Additional undici request options
|
|
117
|
+
* @return {Promise<YotoUploadIconResponse>} The uploaded or existing display icon
|
|
118
|
+
* @example
|
|
119
|
+
* import { readFile } from 'fs/promises'
|
|
120
|
+
* import { uploadIcon } from 'yoto-nodejs-client'
|
|
121
|
+
*
|
|
122
|
+
* const imageData = await readFile('./my-icon.png')
|
|
123
|
+
* const result = await uploadIcon({
|
|
124
|
+
* accessToken,
|
|
125
|
+
* imageData,
|
|
126
|
+
* autoConvert: true,
|
|
127
|
+
* filename: 'my-custom-icon'
|
|
128
|
+
* })
|
|
129
|
+
*
|
|
130
|
+
* if (result.displayIcon.new) {
|
|
131
|
+
* console.log('New icon uploaded:', result.displayIcon.displayIconId)
|
|
132
|
+
* } else {
|
|
133
|
+
* console.log('Icon already exists:', result.displayIcon.displayIconId)
|
|
134
|
+
* }
|
|
135
|
+
*/
|
|
15
136
|
export function uploadIcon({ accessToken, userAgent, imageData, autoConvert, filename, requestOptions }: {
|
|
16
137
|
accessToken: string;
|
|
17
138
|
imageData: Buffer;
|
|
@@ -23,40 +144,115 @@ export function uploadIcon({ accessToken, userAgent, imageData, autoConvert, fil
|
|
|
23
144
|
} & Omit<import("undici").Dispatcher.RequestOptions<unknown>, "origin" | "path" | "method"> & Partial<Pick<import("undici").Dispatcher.RequestOptions<null>, "method">>) | undefined;
|
|
24
145
|
}): Promise<YotoUploadIconResponse>;
|
|
25
146
|
export type YotoPublicIconsResponse = {
|
|
147
|
+
/**
|
|
148
|
+
* - Array of public display icons
|
|
149
|
+
*/
|
|
26
150
|
displayIcons: YotoPublicIcon[];
|
|
27
151
|
};
|
|
28
152
|
export type YotoPublicIcon = {
|
|
153
|
+
/**
|
|
154
|
+
* - Unique identifier for the icon
|
|
155
|
+
*/
|
|
29
156
|
displayIconId: string;
|
|
157
|
+
/**
|
|
158
|
+
* - Unique identifier for the underlying icon file
|
|
159
|
+
*/
|
|
30
160
|
mediaId: string;
|
|
161
|
+
/**
|
|
162
|
+
* - ID of the user who uploaded this icon (always "yoto" for public icons)
|
|
163
|
+
*/
|
|
31
164
|
userId: string;
|
|
165
|
+
/**
|
|
166
|
+
* - ISO 8601 timestamp when icon record was created
|
|
167
|
+
*/
|
|
32
168
|
createdAt: string;
|
|
169
|
+
/**
|
|
170
|
+
* - Title of the display icon
|
|
171
|
+
*/
|
|
33
172
|
title: string;
|
|
173
|
+
/**
|
|
174
|
+
* - URL of the display icon
|
|
175
|
+
*/
|
|
34
176
|
url: string;
|
|
177
|
+
/**
|
|
178
|
+
* - Indicates if the icon is public (always true for public icons)
|
|
179
|
+
*/
|
|
35
180
|
public: boolean;
|
|
181
|
+
/**
|
|
182
|
+
* - Indicates if this is a new icon (may not always be present)
|
|
183
|
+
*/
|
|
36
184
|
new?: boolean;
|
|
185
|
+
/**
|
|
186
|
+
* - Public tags associated with the display icon
|
|
187
|
+
*/
|
|
37
188
|
publicTags: string[];
|
|
38
189
|
};
|
|
39
190
|
export type YotoUserIconsResponse = {
|
|
191
|
+
/**
|
|
192
|
+
* - Array of user's custom display icons
|
|
193
|
+
*/
|
|
40
194
|
displayIcons: YotoUserIcon[];
|
|
41
195
|
};
|
|
42
196
|
export type YotoUserIcon = {
|
|
197
|
+
/**
|
|
198
|
+
* - Unique identifier for the icon
|
|
199
|
+
*/
|
|
43
200
|
displayIconId: string;
|
|
201
|
+
/**
|
|
202
|
+
* - Unique identifier for the underlying icon file
|
|
203
|
+
*/
|
|
44
204
|
mediaId: string;
|
|
205
|
+
/**
|
|
206
|
+
* - ID of the user who uploaded this icon
|
|
207
|
+
*/
|
|
45
208
|
userId: string;
|
|
209
|
+
/**
|
|
210
|
+
* - ISO 8601 timestamp when icon record was created
|
|
211
|
+
*/
|
|
46
212
|
createdAt: string;
|
|
213
|
+
/**
|
|
214
|
+
* - URL of the display icon
|
|
215
|
+
*/
|
|
47
216
|
url: string;
|
|
217
|
+
/**
|
|
218
|
+
* - Indicates if the icon is public (always false for user icons)
|
|
219
|
+
*/
|
|
48
220
|
public: boolean;
|
|
49
221
|
};
|
|
50
222
|
export type YotoUploadIconResponse = {
|
|
223
|
+
/**
|
|
224
|
+
* - The uploaded or existing display icon
|
|
225
|
+
*/
|
|
51
226
|
displayIcon: YotoDisplayIcon;
|
|
52
227
|
};
|
|
53
228
|
export type YotoDisplayIcon = {
|
|
229
|
+
/**
|
|
230
|
+
* - Unique identifier for the icon
|
|
231
|
+
*/
|
|
54
232
|
displayIconId: string;
|
|
233
|
+
/**
|
|
234
|
+
* - Unique identifier for the underlying icon file
|
|
235
|
+
*/
|
|
55
236
|
mediaId: string;
|
|
237
|
+
/**
|
|
238
|
+
* - ID of the user who uploaded this icon
|
|
239
|
+
*/
|
|
56
240
|
userId: string;
|
|
241
|
+
/**
|
|
242
|
+
* - URL of the display icon, or empty object {} for duplicates
|
|
243
|
+
*/
|
|
57
244
|
url: string | object;
|
|
245
|
+
/**
|
|
246
|
+
* - True if this is a new upload, undefined for duplicates
|
|
247
|
+
*/
|
|
58
248
|
new?: boolean;
|
|
249
|
+
/**
|
|
250
|
+
* - MongoDB ID (present for duplicate uploads)
|
|
251
|
+
*/
|
|
59
252
|
_id?: string;
|
|
253
|
+
/**
|
|
254
|
+
* - ISO 8601 timestamp (present for duplicate uploads)
|
|
255
|
+
*/
|
|
60
256
|
createdAt?: string;
|
|
61
257
|
};
|
|
62
258
|
//# sourceMappingURL=icons.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["icons.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["icons.js"],"names":[],"mappings":"AAWA;;;;GAIG;AAEH;;;;;;;;;;;;GAYG;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,2EAhBG;IAAyB,WAAW,EAA3B,MAAM;IACW,SAAS;IACD,cAAc;;;CAChD,GAAS,OAAO,CAAC,uBAAuB,CAAC,CA6B3C;AAED;;;;GAIG;AAEH;;;;;;;;;GASG;AAEH;;;;;;;;GAQG;AACH,yEALG;IAAyB,WAAW,EAA3B,MAAM;IACW,SAAS;IACD,cAAc;;;CAChD,GAAS,OAAO,CAAC,qBAAqB,CAAC,CAkBzC;AAED;;;;GAIG;AAEH;;;;;;;;;;GAUG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,yGAzBG;IAAyB,WAAW,EAA3B,MAAM;IACU,SAAS,EAAzB,MAAM;IACY,WAAW;IACZ,QAAQ;IACR,SAAS;IACD,cAAc;;;CAChD,GAAS,OAAO,CAAC,sBAAsB,CAAC,CA6C1C;;;;;kBA1La,cAAc,EAAE;;;;;;mBAMhB,MAAM;;;;aACN,MAAM;;;;YACN,MAAM;;;;eACN,MAAM;;;;WACN,MAAM;;;;SACN,MAAM;;;;YACN,OAAO;;;;UACP,OAAO;;;;gBACP,MAAM,EAAE;;;;;;kBA4CR,YAAY,EAAE;;;;;;mBAMd,MAAM;;;;aACN,MAAM;;;;YACN,MAAM;;;;eACN,MAAM;;;;SACN,MAAM;;;;YACN,OAAO;;;;;;iBAiCP,eAAe;;;;;;mBAMf,MAAM;;;;aACN,MAAM;;;;YACN,MAAM;;;;SACN,MAAM,GAAG,MAAM;;;;UACf,OAAO;;;;UACP,MAAM;;;;gBACN,MAAM"}
|
|
@@ -1,3 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @see https://yoto.dev/api/getanuploadurl/
|
|
3
|
+
* @typedef {Object} YotoAudioUpload
|
|
4
|
+
* @property {string} uploadId - Upload identifier
|
|
5
|
+
* @property {string | null} uploadUrl - Signed upload URL, or null if file already exists
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* @see https://yoto.dev/api/getanuploadurl/
|
|
9
|
+
* @typedef {Object} YotoAudioUploadUrlResponse
|
|
10
|
+
* @property {YotoAudioUpload} upload
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* @see https://yoto.dev/api/uploadcoverimage/
|
|
14
|
+
* @typedef {Object} YotoCoverImage
|
|
15
|
+
* @property {string} mediaId - Media identifier
|
|
16
|
+
* @property {string} mediaUrl - URL to access the uploaded cover image
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* @see https://yoto.dev/api/uploadcoverimage/
|
|
20
|
+
* @typedef {Object} YotoUploadCoverImageResponse
|
|
21
|
+
* @property {YotoCoverImage} coverImage
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* @see https://yoto.dev/api/uploadcoverimage/
|
|
25
|
+
* @typedef {'default' | 'activities' | 'music' | 'myo' | 'podcast' | 'radio' | 'sfx' | 'stories'} YotoCoverType
|
|
26
|
+
*/
|
|
27
|
+
/**
|
|
28
|
+
* Get a signed URL for uploading an audio file. The SHA256 hash is used to check
|
|
29
|
+
* if a file with that checksum already exists (deduplication).
|
|
30
|
+
*
|
|
31
|
+
* Response behavior:
|
|
32
|
+
* - If file already exists: uploadUrl will be null (file is already in store)
|
|
33
|
+
* - If file doesn't exist: uploadUrl contains a signed URL for uploading
|
|
34
|
+
* - uploadId is always returned and can be used to reference the upload
|
|
35
|
+
*
|
|
36
|
+
* @see https://yoto.dev/api/getanuploadurl/
|
|
37
|
+
* @param {object} options
|
|
38
|
+
* @param {string} options.accessToken - Authentication token
|
|
39
|
+
* @param {string} options.sha256 - SHA256 hash of the file to upload
|
|
40
|
+
* @param {string} [options.filename] - Optional filename for the uploaded file
|
|
41
|
+
* @param {string} [options.userAgent] - Optional user agent string
|
|
42
|
+
* @param {RequestOptions} [options.requestOptions] - Additional undici request options
|
|
43
|
+
* @returns {Promise<YotoAudioUploadUrlResponse>}
|
|
44
|
+
*/
|
|
1
45
|
export function getAudioUploadUrl({ accessToken, userAgent, sha256, filename, requestOptions }: {
|
|
2
46
|
accessToken: string;
|
|
3
47
|
sha256: string;
|
|
@@ -7,6 +51,33 @@ export function getAudioUploadUrl({ accessToken, userAgent, sha256, filename, re
|
|
|
7
51
|
dispatcher?: import("undici").Dispatcher;
|
|
8
52
|
} & Omit<import("undici").Dispatcher.RequestOptions<unknown>, "origin" | "path" | "method"> & Partial<Pick<import("undici").Dispatcher.RequestOptions<null>, "method">>) | undefined;
|
|
9
53
|
}): Promise<YotoAudioUploadUrlResponse>;
|
|
54
|
+
/**
|
|
55
|
+
* Upload a cover image to the user's media account. Supports both direct binary
|
|
56
|
+
* uploads and fetching from a URL. Images are automatically resized based on coverType.
|
|
57
|
+
*
|
|
58
|
+
* Image processing:
|
|
59
|
+
* - Images are resized according to coverType (default: 638x1011px)
|
|
60
|
+
* - Aspect ratio is preserved
|
|
61
|
+
* - Images are cropped to fit dimensions, positioned to center
|
|
62
|
+
* - Supports automatic image conversion with autoConvert flag
|
|
63
|
+
*
|
|
64
|
+
* Cover type dimensions:
|
|
65
|
+
* - default/activities/music/sfx/stories: 638×1011px
|
|
66
|
+
* - myo: 520×400px
|
|
67
|
+
* - podcast/radio: 600×600px
|
|
68
|
+
*
|
|
69
|
+
* @see https://yoto.dev/api/uploadcoverimage/
|
|
70
|
+
* @param {object} options
|
|
71
|
+
* @param {string} options.accessToken - Authentication token
|
|
72
|
+
* @param {Buffer | Uint8Array | string} [options.imageData] - Binary image data to upload (required if imageUrl not provided)
|
|
73
|
+
* @param {string} [options.imageUrl] - URL of image to fetch and upload (required if imageData not provided)
|
|
74
|
+
* @param {boolean} [options.autoConvert] - Whether to automatically convert the image
|
|
75
|
+
* @param {YotoCoverType} [options.coverType] - Type of cover image, determines dimensions
|
|
76
|
+
* @param {string} [options.filename] - Custom filename for the uploaded image
|
|
77
|
+
* @param {string} [options.userAgent] - Optional user agent string
|
|
78
|
+
* @param {RequestOptions} [options.requestOptions] - Additional undici request options
|
|
79
|
+
* @returns {Promise<YotoUploadCoverImageResponse>}
|
|
80
|
+
*/
|
|
10
81
|
export function uploadCoverImage({ accessToken, userAgent, imageData, imageUrl, autoConvert, coverType, filename, requestOptions }: {
|
|
11
82
|
accessToken: string;
|
|
12
83
|
imageData?: string | Buffer<ArrayBufferLike> | Uint8Array<ArrayBufferLike> | undefined;
|
|
@@ -20,14 +91,26 @@ export function uploadCoverImage({ accessToken, userAgent, imageData, imageUrl,
|
|
|
20
91
|
} & Omit<import("undici").Dispatcher.RequestOptions<unknown>, "origin" | "path" | "method"> & Partial<Pick<import("undici").Dispatcher.RequestOptions<null>, "method">>) | undefined;
|
|
21
92
|
}): Promise<YotoUploadCoverImageResponse>;
|
|
22
93
|
export type YotoAudioUpload = {
|
|
94
|
+
/**
|
|
95
|
+
* - Upload identifier
|
|
96
|
+
*/
|
|
23
97
|
uploadId: string;
|
|
98
|
+
/**
|
|
99
|
+
* - Signed upload URL, or null if file already exists
|
|
100
|
+
*/
|
|
24
101
|
uploadUrl: string | null;
|
|
25
102
|
};
|
|
26
103
|
export type YotoAudioUploadUrlResponse = {
|
|
27
104
|
upload: YotoAudioUpload;
|
|
28
105
|
};
|
|
29
106
|
export type YotoCoverImage = {
|
|
107
|
+
/**
|
|
108
|
+
* - Media identifier
|
|
109
|
+
*/
|
|
30
110
|
mediaId: string;
|
|
111
|
+
/**
|
|
112
|
+
* - URL to access the uploaded cover image
|
|
113
|
+
*/
|
|
31
114
|
mediaUrl: string;
|
|
32
115
|
};
|
|
33
116
|
export type YotoUploadCoverImageResponse = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"media.d.ts","sourceRoot":"","sources":["media.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"media.d.ts","sourceRoot":"","sources":["media.js"],"names":[],"mappings":"AAkBA;;;;;GAKG;AAEH;;;;GAIG;AAEH;;;;;GAKG;AAEH;;;;GAIG;AAEH;;;GAGG;AAEH;;;;;;;;;;;;;;;;;GAiBG;AACH,gGAPG;IAAwB,WAAW,EAA3B,MAAM;IACU,MAAM,EAAtB,MAAM;IACW,QAAQ;IACR,SAAS;IACD,cAAc;;;CAC/C,GAAU,OAAO,CAAC,0BAA0B,CAAC,CAuB/C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,oIAVG;IAAwB,WAAW,EAA3B,MAAM;IACiC,SAAS;IAC/B,QAAQ;IACP,WAAW;IACL,SAAS;IAChB,QAAQ;IACR,SAAS;IACD,cAAc;;;CAC/C,GAAU,OAAO,CAAC,4BAA4B,CAAC,CAuCjD;;;;;cArIa,MAAM;;;;eACN,MAAM,GAAG,IAAI;;;YAMb,eAAe;;;;;;aAMf,MAAM;;;;cACN,MAAM;;;gBAMN,cAAc;;4BAKf,SAAS,GAAG,YAAY,GAAG,OAAO,GAAG,KAAK,GAAG,SAAS,GAAG,OAAO,GAAG,KAAK,GAAG,SAAS"}
|
|
@@ -1,7 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Load tokens from .env file for testing
|
|
3
|
+
* @returns {{accessToken: string, refreshToken: string, clientId: string}}
|
|
4
|
+
*/
|
|
1
5
|
export function loadTestTokens(): {
|
|
2
6
|
accessToken: string;
|
|
3
7
|
refreshToken: string;
|
|
4
8
|
clientId: string;
|
|
5
9
|
};
|
|
10
|
+
/**
|
|
11
|
+
* Log API response for type verification and documentation.
|
|
12
|
+
*
|
|
13
|
+
* This is a first-class testing feature, not temporary debug code.
|
|
14
|
+
* It helps with:
|
|
15
|
+
* - Writing new tests by showing actual API response structure
|
|
16
|
+
* - Verifying type definitions match reality
|
|
17
|
+
* - Debugging test failures
|
|
18
|
+
* - Documenting API behavior
|
|
19
|
+
*
|
|
20
|
+
* @param {string} label - Descriptive label for the response (e.g., 'GET DEVICES')
|
|
21
|
+
* @param {any} response - The API response object to log
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* const devices = await getDevices({ token })
|
|
25
|
+
* logResponse('GET DEVICES', devices)
|
|
26
|
+
*/
|
|
6
27
|
export function logResponse(label: string, response: any): void;
|
|
7
28
|
//# sourceMappingURL=test-helpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-helpers.d.ts","sourceRoot":"","sources":["test-helpers.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"test-helpers.d.ts","sourceRoot":"","sources":["test-helpers.js"],"names":[],"mappings":"AAMA;;;GAGG;AACH,kCAFa;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAC,CAiCzE;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,mCAPW,MAAM,YACN,GAAG,QASb"}
|