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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devices.d.ts","sourceRoot":"","sources":["devices.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"devices.d.ts","sourceRoot":"","sources":["devices.js"],"names":[],"mappings":"AAaA;;;;GAIG;AAEH;;;;;;;;;;;;;GAaG;AAEH;;;;;;;;GAQG;AACH,uEALG;IAAyB,WAAW,EAA3B,MAAM;IACW,SAAS;IACD,cAAc;;;CAChD,GAAS,OAAO,CAAC,mBAAmB,CAAC,CAkBvC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH;;;;;;;;;GASG;AACH,sFANG;IAAyB,WAAW,EAA3B,MAAM;IACU,QAAQ,EAAxB,MAAM;IACW,SAAS;IACD,cAAc;;;CAChD,GAAS,OAAO,CAAC,wBAAwB,CAAC,CAmB5C;AAED;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH;;;;;GAKG;AAEH;;;;;GAKG;AAEH;;;;GAIG;AAEH;;;;;GAKG;AAEH;;;;;;GAMG;AAEH;;;;;;;;;GASG;AACH,sFANG;IAAyB,WAAW,EAA3B,MAAM;IACU,QAAQ,EAAxB,MAAM;IACW,SAAS;IACD,cAAc;;;CAChD,GAAS,OAAO,CAAC,wBAAwB,CAAC,CAmB5C;AAED;;;;;GAKG;AAEH;;;;GAIG;AAEH;;;;;;;;;;GAUG;AACH,uGAPG;IAAyB,WAAW,EAA3B,MAAM;IACU,QAAQ,EAAxB,MAAM;IACiC,YAAY,EAAnD,6BAA6B;IACZ,SAAS;IACD,cAAc;;;CAChD,GAAS,OAAO,CAAC,8BAA8B,CAAC,CAwBlD;AAED;;;;GAIG;AAEH;;;;GAIG;AAEH;;;;;;;;;;GAUG;AACH,6GAPG;IAAyB,WAAW,EAA3B,MAAM;IACU,QAAQ,EAAxB,MAAM;IAC8B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|
@@ -1,3 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @see https://yoto.dev/api/getgroups/
|
|
3
|
+
* @typedef {Object} YotoGroupsResponse
|
|
4
|
+
* @property {YotoGroup[]} groups - Array of family library groups
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* @see https://yoto.dev/api/getgroups/
|
|
8
|
+
* @typedef {Object} YotoGroup
|
|
9
|
+
* @property {string} id - Group identifier
|
|
10
|
+
* @property {string} name - Group name (e.g., "My Favourites")
|
|
11
|
+
* @property {string} familyId - Associated family ID
|
|
12
|
+
* @property {string} imageId - ID for the group image (can be uploaded family image hash or preset like "fp-cards")
|
|
13
|
+
* @property {string} imageUrl - CDN URL to the group image
|
|
14
|
+
* @property {YotoGroupItem[]} items - Array of content items in the group
|
|
15
|
+
* @property {any[]} cards - Array of card objects
|
|
16
|
+
* @property {string} createdAt - ISO 8601 timestamp when group was created
|
|
17
|
+
* @property {string} lastModifiedAt - ISO 8601 timestamp when group was last updated
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* @see https://yoto.dev/api/getgroups/
|
|
21
|
+
* @typedef {Object} YotoGroupItem
|
|
22
|
+
* @property {string} contentId - ID of the card content
|
|
23
|
+
* @property {string} addedAt - ISO 8601 timestamp when item was added to group
|
|
24
|
+
*/
|
|
25
|
+
/**
|
|
26
|
+
* Retrieves all family library groups for the authenticated user's family.
|
|
27
|
+
* Returns an empty array if no groups exist.
|
|
28
|
+
* @see https://yoto.dev/api/getgroups/
|
|
29
|
+
* @param {object} options
|
|
30
|
+
* @param {string} options.accessToken The API token to request with
|
|
31
|
+
* @param {string} [options.userAgent] Optional user agent string
|
|
32
|
+
* @param {RequestOptions} [options.requestOptions] Additional undici request options
|
|
33
|
+
* @return {Promise<YotoGroup[]>} Array of family library groups
|
|
34
|
+
* @example
|
|
35
|
+
* import { getGroups } from 'yoto-nodejs-client'
|
|
36
|
+
*
|
|
37
|
+
* const groups = await getGroups({
|
|
38
|
+
* accessToken
|
|
39
|
+
* })
|
|
40
|
+
*
|
|
41
|
+
* console.log('Groups:', groups.length)
|
|
42
|
+
* groups.forEach(group => {
|
|
43
|
+
* console.log(`${group.name}: ${group.items.length} items`)
|
|
44
|
+
* })
|
|
45
|
+
*/
|
|
1
46
|
export function getGroups({ accessToken, userAgent, requestOptions }: {
|
|
2
47
|
accessToken: string;
|
|
3
48
|
userAgent?: string | undefined;
|
|
@@ -5,6 +50,42 @@ export function getGroups({ accessToken, userAgent, requestOptions }: {
|
|
|
5
50
|
dispatcher?: import("undici").Dispatcher;
|
|
6
51
|
} & Omit<import("undici").Dispatcher.RequestOptions<unknown>, "origin" | "path" | "method"> & Partial<Pick<import("undici").Dispatcher.RequestOptions<null>, "method">>) | undefined;
|
|
7
52
|
}): Promise<YotoGroup[]>;
|
|
53
|
+
/**
|
|
54
|
+
* @see https://yoto.dev/api/createagroup/
|
|
55
|
+
* @typedef {Object} YotoCreateGroupRequest
|
|
56
|
+
* @property {string} name - Group name (max 100 characters, UTF-8 supported)
|
|
57
|
+
* @property {string} imageId - Image ID (preset like "fp-cards" or uploaded image hash)
|
|
58
|
+
* @property {YotoGroupItemInput[]} items - Array of content items (can be empty, order preserved)
|
|
59
|
+
*/
|
|
60
|
+
/**
|
|
61
|
+
* @see https://yoto.dev/api/createagroup/
|
|
62
|
+
* @typedef {Object} YotoGroupItemInput
|
|
63
|
+
* @property {string} contentId - ID of the card content to add to group
|
|
64
|
+
*/
|
|
65
|
+
/**
|
|
66
|
+
* Creates a new group in the family library.
|
|
67
|
+
* Max 20 groups per family. ContentIds must be in family's library (invalid ones filtered out).
|
|
68
|
+
* @see https://yoto.dev/api/createagroup/
|
|
69
|
+
* @param {object} options
|
|
70
|
+
* @param {string} options.token The API token to request with
|
|
71
|
+
* @param {YotoCreateGroupRequest} options.group The group data to create
|
|
72
|
+
* @param {string} [options.userAgent] Optional user agent string
|
|
73
|
+
* @param {RequestOptions} [options.requestOptions] Additional undici request options
|
|
74
|
+
* @return {Promise<YotoGroup>} The created group with populated cards array
|
|
75
|
+
* @example
|
|
76
|
+
* import { createGroup } from 'yoto-nodejs-client'
|
|
77
|
+
*
|
|
78
|
+
* const group = await createGroup({
|
|
79
|
+
* token: accessToken,
|
|
80
|
+
* group: {
|
|
81
|
+
* name: 'My Favourites',
|
|
82
|
+
* imageId: 'fp-cards',
|
|
83
|
+
* items: [
|
|
84
|
+
* { contentId: '37KwQ' }
|
|
85
|
+
* ]
|
|
86
|
+
* }
|
|
87
|
+
* })
|
|
88
|
+
*/
|
|
8
89
|
export function createGroup({ token, userAgent, group, requestOptions }: {
|
|
9
90
|
token: string;
|
|
10
91
|
group: YotoCreateGroupRequest;
|
|
@@ -13,6 +94,17 @@ export function createGroup({ token, userAgent, group, requestOptions }: {
|
|
|
13
94
|
dispatcher?: import("undici").Dispatcher;
|
|
14
95
|
} & Omit<import("undici").Dispatcher.RequestOptions<unknown>, "origin" | "path" | "method"> & Partial<Pick<import("undici").Dispatcher.RequestOptions<null>, "method">>) | undefined;
|
|
15
96
|
}): Promise<YotoGroup>;
|
|
97
|
+
/**
|
|
98
|
+
* Retrieves a specific group by ID.
|
|
99
|
+
* Returns 404 if group doesn't exist or belongs to another family.
|
|
100
|
+
* @see https://yoto.dev/api/getagroup/
|
|
101
|
+
* @param {object} options
|
|
102
|
+
* @param {string} options.accessToken The API token to request with
|
|
103
|
+
* @param {string} options.groupId The group ID to retrieve
|
|
104
|
+
* @param {string} [options.userAgent] Optional user agent string
|
|
105
|
+
* @param {RequestOptions} [options.requestOptions] Additional undici request options
|
|
106
|
+
* @return {Promise<YotoGroup>} The requested group with populated cards array
|
|
107
|
+
*/
|
|
16
108
|
export function getGroup({ accessToken, userAgent, groupId, requestOptions }: {
|
|
17
109
|
accessToken: string;
|
|
18
110
|
groupId: string;
|
|
@@ -21,6 +113,25 @@ export function getGroup({ accessToken, userAgent, groupId, requestOptions }: {
|
|
|
21
113
|
dispatcher?: import("undici").Dispatcher;
|
|
22
114
|
} & Omit<import("undici").Dispatcher.RequestOptions<unknown>, "origin" | "path" | "method"> & Partial<Pick<import("undici").Dispatcher.RequestOptions<null>, "method">>) | undefined;
|
|
23
115
|
}): Promise<YotoGroup>;
|
|
116
|
+
/**
|
|
117
|
+
* @see https://yoto.dev/api/updateagroup/
|
|
118
|
+
* @typedef {Object} YotoUpdateGroupRequest
|
|
119
|
+
* @property {string} name - Group name (max 100 characters, UTF-8 supported)
|
|
120
|
+
* @property {string} imageId - Image ID (preset like "fp-cards" or uploaded image hash)
|
|
121
|
+
* @property {YotoGroupItemInput[]} items - Array of content items (replaces entire array)
|
|
122
|
+
*/
|
|
123
|
+
/**
|
|
124
|
+
* Updates an existing group.
|
|
125
|
+
* Can only update groups owned by family. Returns 404 if doesn't exist or owned by another family.
|
|
126
|
+
* @see https://yoto.dev/api/updateagroup/
|
|
127
|
+
* @param {object} options
|
|
128
|
+
* @param {string} options.accessToken The API token to request with
|
|
129
|
+
* @param {string} options.groupId The group ID to update
|
|
130
|
+
* @param {YotoUpdateGroupRequest} options.group The updated group data
|
|
131
|
+
* @param {string} [options.userAgent] Optional user agent string
|
|
132
|
+
* @param {RequestOptions} [options.requestOptions] Additional undici request options
|
|
133
|
+
* @return {Promise<YotoGroup>} The updated group with populated cards array
|
|
134
|
+
*/
|
|
24
135
|
export function updateGroup({ accessToken, userAgent, groupId, group, requestOptions }: {
|
|
25
136
|
accessToken: string;
|
|
26
137
|
groupId: string;
|
|
@@ -30,6 +141,22 @@ export function updateGroup({ accessToken, userAgent, groupId, group, requestOpt
|
|
|
30
141
|
dispatcher?: import("undici").Dispatcher;
|
|
31
142
|
} & Omit<import("undici").Dispatcher.RequestOptions<unknown>, "origin" | "path" | "method"> & Partial<Pick<import("undici").Dispatcher.RequestOptions<null>, "method">>) | undefined;
|
|
32
143
|
}): Promise<YotoGroup>;
|
|
144
|
+
/**
|
|
145
|
+
* @see https://yoto.dev/api/deleteagroup/
|
|
146
|
+
* @typedef {Object} YotoDeleteGroupResponse
|
|
147
|
+
* @property {string} id - The ID of the deleted group
|
|
148
|
+
*/
|
|
149
|
+
/**
|
|
150
|
+
* Deletes a group permanently (hard delete, cannot be recovered).
|
|
151
|
+
* Content remains in family library. Returns 404 if doesn't exist or owned by another family.
|
|
152
|
+
* @see https://yoto.dev/api/deleteagroup/
|
|
153
|
+
* @param {object} options
|
|
154
|
+
* @param {string} options.accessToken The API token to request with
|
|
155
|
+
* @param {string} options.groupId The group ID to delete
|
|
156
|
+
* @param {string} [options.userAgent] Optional user agent string
|
|
157
|
+
* @param {RequestOptions} [options.requestOptions] Additional undici request options
|
|
158
|
+
* @return {Promise<YotoDeleteGroupResponse>} Confirmation with deleted group ID
|
|
159
|
+
*/
|
|
33
160
|
export function deleteGroup({ accessToken, userAgent, groupId, requestOptions }: {
|
|
34
161
|
accessToken: string;
|
|
35
162
|
groupId: string;
|
|
@@ -39,37 +166,97 @@ export function deleteGroup({ accessToken, userAgent, groupId, requestOptions }:
|
|
|
39
166
|
} & Omit<import("undici").Dispatcher.RequestOptions<unknown>, "origin" | "path" | "method"> & Partial<Pick<import("undici").Dispatcher.RequestOptions<null>, "method">>) | undefined;
|
|
40
167
|
}): Promise<YotoDeleteGroupResponse>;
|
|
41
168
|
export type YotoGroupsResponse = {
|
|
169
|
+
/**
|
|
170
|
+
* - Array of family library groups
|
|
171
|
+
*/
|
|
42
172
|
groups: YotoGroup[];
|
|
43
173
|
};
|
|
44
174
|
export type YotoGroup = {
|
|
175
|
+
/**
|
|
176
|
+
* - Group identifier
|
|
177
|
+
*/
|
|
45
178
|
id: string;
|
|
179
|
+
/**
|
|
180
|
+
* - Group name (e.g., "My Favourites")
|
|
181
|
+
*/
|
|
46
182
|
name: string;
|
|
183
|
+
/**
|
|
184
|
+
* - Associated family ID
|
|
185
|
+
*/
|
|
47
186
|
familyId: string;
|
|
187
|
+
/**
|
|
188
|
+
* - ID for the group image (can be uploaded family image hash or preset like "fp-cards")
|
|
189
|
+
*/
|
|
48
190
|
imageId: string;
|
|
191
|
+
/**
|
|
192
|
+
* - CDN URL to the group image
|
|
193
|
+
*/
|
|
49
194
|
imageUrl: string;
|
|
195
|
+
/**
|
|
196
|
+
* - Array of content items in the group
|
|
197
|
+
*/
|
|
50
198
|
items: YotoGroupItem[];
|
|
199
|
+
/**
|
|
200
|
+
* - Array of card objects
|
|
201
|
+
*/
|
|
51
202
|
cards: any[];
|
|
203
|
+
/**
|
|
204
|
+
* - ISO 8601 timestamp when group was created
|
|
205
|
+
*/
|
|
52
206
|
createdAt: string;
|
|
207
|
+
/**
|
|
208
|
+
* - ISO 8601 timestamp when group was last updated
|
|
209
|
+
*/
|
|
53
210
|
lastModifiedAt: string;
|
|
54
211
|
};
|
|
55
212
|
export type YotoGroupItem = {
|
|
213
|
+
/**
|
|
214
|
+
* - ID of the card content
|
|
215
|
+
*/
|
|
56
216
|
contentId: string;
|
|
217
|
+
/**
|
|
218
|
+
* - ISO 8601 timestamp when item was added to group
|
|
219
|
+
*/
|
|
57
220
|
addedAt: string;
|
|
58
221
|
};
|
|
59
222
|
export type YotoCreateGroupRequest = {
|
|
223
|
+
/**
|
|
224
|
+
* - Group name (max 100 characters, UTF-8 supported)
|
|
225
|
+
*/
|
|
60
226
|
name: string;
|
|
227
|
+
/**
|
|
228
|
+
* - Image ID (preset like "fp-cards" or uploaded image hash)
|
|
229
|
+
*/
|
|
61
230
|
imageId: string;
|
|
231
|
+
/**
|
|
232
|
+
* - Array of content items (can be empty, order preserved)
|
|
233
|
+
*/
|
|
62
234
|
items: YotoGroupItemInput[];
|
|
63
235
|
};
|
|
64
236
|
export type YotoGroupItemInput = {
|
|
237
|
+
/**
|
|
238
|
+
* - ID of the card content to add to group
|
|
239
|
+
*/
|
|
65
240
|
contentId: string;
|
|
66
241
|
};
|
|
67
242
|
export type YotoUpdateGroupRequest = {
|
|
243
|
+
/**
|
|
244
|
+
* - Group name (max 100 characters, UTF-8 supported)
|
|
245
|
+
*/
|
|
68
246
|
name: string;
|
|
247
|
+
/**
|
|
248
|
+
* - Image ID (preset like "fp-cards" or uploaded image hash)
|
|
249
|
+
*/
|
|
69
250
|
imageId: string;
|
|
251
|
+
/**
|
|
252
|
+
* - Array of content items (replaces entire array)
|
|
253
|
+
*/
|
|
70
254
|
items: YotoGroupItemInput[];
|
|
71
255
|
};
|
|
72
256
|
export type YotoDeleteGroupResponse = {
|
|
257
|
+
/**
|
|
258
|
+
* - The ID of the deleted group
|
|
259
|
+
*/
|
|
73
260
|
id: string;
|
|
74
261
|
};
|
|
75
262
|
//# sourceMappingURL=family-library-groups.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"family-library-groups.d.ts","sourceRoot":"","sources":["family-library-groups.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"family-library-groups.d.ts","sourceRoot":"","sources":["family-library-groups.js"],"names":[],"mappings":"AAWA;;;;GAIG;AAEH;;;;;;;;;;;;GAYG;AAEH;;;;;GAKG;AAEH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,sEAhBG;IAAyB,WAAW,EAA3B,MAAM;IACW,SAAS;IACD,cAAc;;;CAChD,GAAS,OAAO,CAAC,SAAS,EAAE,CAAC,CA6B/B;AAED;;;;;;GAMG;AAEH;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,yEAnBG;IAAyB,KAAK,EAArB,MAAM;IAC0B,KAAK,EAArC,sBAAsB;IACL,SAAS;IACD,cAAc;;;CAChD,GAAS,OAAO,CAAC,SAAS,CAAC,CAoC7B;AAED;;;;;;;;;;GAUG;AACH,8EANG;IAAyB,WAAW,EAA3B,MAAM;IACU,OAAO,EAAvB,MAAM;IACW,SAAS;IACD,cAAc;;;CAChD,GAAS,OAAO,CAAC,SAAS,CAAC,CAmB7B;AAED;;;;;;GAMG;AAEH;;;;;;;;;;;GAWG;AACH,wFAPG;IAAyB,WAAW,EAA3B,MAAM;IACU,OAAO,EAAvB,MAAM;IAC0B,KAAK,EAArC,sBAAsB;IACL,SAAS;IACD,cAAc;;;CAChD,GAAS,OAAO,CAAC,SAAS,CAAC,CAwB7B;AAED;;;;GAIG;AAEH;;;;;;;;;;GAUG;AACH,iFANG;IAAyB,WAAW,EAA3B,MAAM;IACU,OAAO,EAAvB,MAAM;IACW,SAAS;IACD,cAAc;;;CAChD,GAAS,OAAO,CAAC,uBAAuB,CAAC,CAmB3C;;;;;YAxOa,SAAS,EAAE;;;;;;QAMX,MAAM;;;;UACN,MAAM;;;;cACN,MAAM;;;;aACN,MAAM;;;;cACN,MAAM;;;;WACN,aAAa,EAAE;;;;WACf,GAAG,EAAE;;;;eACL,MAAM;;;;oBACN,MAAM;;;;;;eAMN,MAAM;;;;aACN,MAAM;;;;;;UA6CN,MAAM;;;;aACN,MAAM;;;;WACN,kBAAkB,EAAE;;;;;;eAMpB,MAAM;;;;;;UAmFN,MAAM;;;;aACN,MAAM;;;;WACN,kBAAkB,EAAE;;;;;;QA0CpB,MAAM"}
|
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @see https://yoto.dev/api/getfamilyimages/
|
|
3
|
+
* @typedef {Object} YotoFamilyImagesResponse
|
|
4
|
+
* @property {YotoFamilyImage[]} images
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* @see https://yoto.dev/api/getfamilyimages/
|
|
8
|
+
* @typedef {Object} YotoFamilyImage
|
|
9
|
+
* @property {string} imageId - The unique identifier for the family image (hash)
|
|
10
|
+
* @property {string} [name] - Optional name of the family image
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Retrieves the list of families associated with the authenticated user.
|
|
14
|
+
* @see https://yoto.dev/api/getfamilyimages/
|
|
15
|
+
* @param {object} options
|
|
16
|
+
* @param {string} options.accessToken The API token to request with
|
|
17
|
+
* @param {string} [options.userAgent] Optional user agent string
|
|
18
|
+
* @param {RequestOptions} [options.requestOptions] Additional undici request options
|
|
19
|
+
* @return {Promise<YotoFamilyImagesResponse>} The user's families
|
|
20
|
+
*/
|
|
1
21
|
export function getFamilyImages({ accessToken, userAgent, requestOptions }: {
|
|
2
22
|
accessToken: string;
|
|
3
23
|
userAgent?: string | undefined;
|
|
@@ -5,6 +25,23 @@ export function getFamilyImages({ accessToken, userAgent, requestOptions }: {
|
|
|
5
25
|
dispatcher?: import("undici").Dispatcher;
|
|
6
26
|
} & Omit<import("undici").Dispatcher.RequestOptions<unknown>, "origin" | "path" | "method"> & Partial<Pick<import("undici").Dispatcher.RequestOptions<null>, "method">>) | undefined;
|
|
7
27
|
}): Promise<YotoFamilyImagesResponse>;
|
|
28
|
+
/**
|
|
29
|
+
* @see https://yoto.dev/api/getafamilyimage/
|
|
30
|
+
* @typedef {Object} YotoFamilyImageResponse
|
|
31
|
+
* @property {string} imageUrl - The signed URL to the family image (expires after 7 days)
|
|
32
|
+
*/
|
|
33
|
+
/**
|
|
34
|
+
* Retrieves a signed URL for a specific family image. Returns a 302 redirect with the image URL in the Location header.
|
|
35
|
+
* The signed URL expires after 7 days.
|
|
36
|
+
* @see https://yoto.dev/api/getafamilyimage/
|
|
37
|
+
* @param {object} options
|
|
38
|
+
* @param {string} options.accessToken The API token to request with
|
|
39
|
+
* @param {string} options.imageId The family image ID (hash) to get the image for
|
|
40
|
+
* @param {'640x480' | '320x320'} options.size Image dimensions (supported: '640x480' or '320x320')
|
|
41
|
+
* @param {string} [options.userAgent] Optional user agent string
|
|
42
|
+
* @param {RequestOptions} [options.requestOptions] Additional undici request options
|
|
43
|
+
* @return {Promise<YotoFamilyImageResponse>} The signed image URL
|
|
44
|
+
*/
|
|
8
45
|
export function getAFamilyImage({ accessToken, userAgent, imageId, size, requestOptions }: {
|
|
9
46
|
accessToken: string;
|
|
10
47
|
imageId: string;
|
|
@@ -14,6 +51,42 @@ export function getAFamilyImage({ accessToken, userAgent, imageId, size, request
|
|
|
14
51
|
dispatcher?: import("undici").Dispatcher;
|
|
15
52
|
} & Omit<import("undici").Dispatcher.RequestOptions<unknown>, "origin" | "path" | "method"> & Partial<Pick<import("undici").Dispatcher.RequestOptions<null>, "method">>) | undefined;
|
|
16
53
|
}): Promise<YotoFamilyImageResponse>;
|
|
54
|
+
/**
|
|
55
|
+
* @see https://yoto.dev/api/uploadafamilyimage/
|
|
56
|
+
* @typedef {Object} YotoUploadFamilyImageResponse
|
|
57
|
+
* @property {string} imageId - The SHA256 checksum of the uploaded image
|
|
58
|
+
* @property {string} url - URL to the 'get a family image' endpoint (requires width/height params)
|
|
59
|
+
*/
|
|
60
|
+
/**
|
|
61
|
+
* Uploads a family image for use across various features in Yoto.
|
|
62
|
+
* Images are deduplicated using SHA256 checksums.
|
|
63
|
+
*
|
|
64
|
+
* Constraints:
|
|
65
|
+
* - Max size: 8mb
|
|
66
|
+
* - Supported formats: JPEG, GIF, PNG
|
|
67
|
+
* - Limit: 500 images per family
|
|
68
|
+
* - No restrictions on resolution or aspect ratio
|
|
69
|
+
*
|
|
70
|
+
* @see https://yoto.dev/api/uploadafamilyimage/
|
|
71
|
+
* @param {object} options
|
|
72
|
+
* @param {string} options.accessToken The API token to request with
|
|
73
|
+
* @param {Buffer} options.imageData The binary image data (JPEG, GIF, or PNG)
|
|
74
|
+
* @param {string} [options.userAgent] Optional user agent string
|
|
75
|
+
* @param {RequestOptions} [options.requestOptions] Additional undici request options
|
|
76
|
+
* @return {Promise<YotoUploadFamilyImageResponse>} The uploaded image details
|
|
77
|
+
* @example
|
|
78
|
+
* import { readFile } from 'fs/promises'
|
|
79
|
+
* import { uploadAFamilyImage } from 'yoto-nodejs-client'
|
|
80
|
+
*
|
|
81
|
+
* const imageData = await readFile('./family-photo.jpg')
|
|
82
|
+
* const result = await uploadAFamilyImage({
|
|
83
|
+
* accessToken,
|
|
84
|
+
* imageData
|
|
85
|
+
* })
|
|
86
|
+
*
|
|
87
|
+
* console.log('Image ID:', result.imageId)
|
|
88
|
+
* console.log('Image URL:', result.url)
|
|
89
|
+
*/
|
|
17
90
|
export function uploadAFamilyImage({ accessToken, userAgent, imageData, requestOptions }: {
|
|
18
91
|
accessToken: string;
|
|
19
92
|
imageData: Buffer;
|
|
@@ -26,14 +99,29 @@ export type YotoFamilyImagesResponse = {
|
|
|
26
99
|
images: YotoFamilyImage[];
|
|
27
100
|
};
|
|
28
101
|
export type YotoFamilyImage = {
|
|
102
|
+
/**
|
|
103
|
+
* - The unique identifier for the family image (hash)
|
|
104
|
+
*/
|
|
29
105
|
imageId: string;
|
|
106
|
+
/**
|
|
107
|
+
* - Optional name of the family image
|
|
108
|
+
*/
|
|
30
109
|
name?: string;
|
|
31
110
|
};
|
|
32
111
|
export type YotoFamilyImageResponse = {
|
|
112
|
+
/**
|
|
113
|
+
* - The signed URL to the family image (expires after 7 days)
|
|
114
|
+
*/
|
|
33
115
|
imageUrl: string;
|
|
34
116
|
};
|
|
35
117
|
export type YotoUploadFamilyImageResponse = {
|
|
118
|
+
/**
|
|
119
|
+
* - The SHA256 checksum of the uploaded image
|
|
120
|
+
*/
|
|
36
121
|
imageId: string;
|
|
122
|
+
/**
|
|
123
|
+
* - URL to the 'get a family image' endpoint (requires width/height params)
|
|
124
|
+
*/
|
|
37
125
|
url: string;
|
|
38
126
|
};
|
|
39
127
|
//# sourceMappingURL=family.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"family.d.ts","sourceRoot":"","sources":["family.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"family.d.ts","sourceRoot":"","sources":["family.js"],"names":[],"mappings":"AAWA;;;;GAIG;AAEH;;;;;GAKG;AAEH;;;;;;;;GAQG;AACH,4EALG;IAAyB,WAAW,EAA3B,MAAM;IACW,SAAS;IACD,cAAc;;;CAChD,GAAS,OAAO,CAAC,wBAAwB,CAAC,CAkB5C;AAED;;;;GAIG;AAEH;;;;;;;;;;;GAWG;AACH,2FAPG;IAAyB,WAAW,EAA3B,MAAM;IACU,OAAO,EAAvB,MAAM;IACyB,IAAI,EAAnC,SAAS,GAAG,SAAS;IACJ,SAAS;IACD,cAAc;;;CAChD,GAAS,OAAO,CAAC,uBAAuB,CAAC,CAsC3C;AAED;;;;;GAKG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,0FAlBG;IAAyB,WAAW,EAA3B,MAAM;IACU,SAAS,EAAzB,MAAM;IACW,SAAS;IACD,cAAc;;;CAChD,GAAS,OAAO,CAAC,6BAA6B,CAAC,CAmCjD;;YAvJa,eAAe,EAAE;;;;;;aAMjB,MAAM;;;;WACN,MAAM;;;;;;cAiCN,MAAM;;;;;;aAwDN,MAAM;;;;SACN,MAAM"}
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Request options derived from undici.request
|
|
3
|
+
* @typedef {NonNullable<Parameters<typeof request>[1]>} RequestOptions
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @param {object} [options]
|
|
7
|
+
* @param {string} [options.userAgent] - Optional user agent string to prepend to library user agent
|
|
8
|
+
* @param {RequestOptions} [options.requestOptions] - Additional undici request options
|
|
9
|
+
*/
|
|
1
10
|
export function defaultHeaders(options?: {
|
|
2
11
|
userAgent?: string | undefined;
|
|
3
12
|
requestOptions?: ({
|
|
@@ -7,6 +16,11 @@ export function defaultHeaders(options?: {
|
|
|
7
16
|
Accept: string;
|
|
8
17
|
'User-Agent': string;
|
|
9
18
|
};
|
|
19
|
+
/**
|
|
20
|
+
* @param {object} params
|
|
21
|
+
* @param {string} params.accessToken
|
|
22
|
+
* @param {string} [params.userAgent] - Optional user agent string to prepend to library user agent
|
|
23
|
+
*/
|
|
10
24
|
export function defaultAuthHeaders({ accessToken: token, userAgent }: {
|
|
11
25
|
accessToken: string;
|
|
12
26
|
userAgent?: string | undefined;
|
|
@@ -15,14 +29,34 @@ export function defaultAuthHeaders({ accessToken: token, userAgent }: {
|
|
|
15
29
|
Accept: string;
|
|
16
30
|
'User-Agent': string;
|
|
17
31
|
};
|
|
32
|
+
/**
|
|
33
|
+
* Merge undici request options with defaults
|
|
34
|
+
* Properly merges headers by supplementing rather than overriding
|
|
35
|
+
* Only supports object headers (not arrays)
|
|
36
|
+
* @param {RequestOptions} baseOptions - Base request options with headers
|
|
37
|
+
* @param {RequestOptions} [requestOptions] - Additional request options to merge
|
|
38
|
+
* @returns {object} Merged options
|
|
39
|
+
*/
|
|
18
40
|
export function mergeRequestOptions(baseOptions: RequestOptions, requestOptions?: RequestOptions): object;
|
|
41
|
+
/**
|
|
42
|
+
* @param {Dispatcher.ResponseData} response
|
|
43
|
+
* @param {any} [extra]
|
|
44
|
+
*/
|
|
19
45
|
export function handleBadResponse(response: Dispatcher.ResponseData, extra?: any): Promise<void>;
|
|
20
46
|
export class YotoAPIError extends Error {
|
|
47
|
+
/**
|
|
48
|
+
* @param {Dispatcher.ResponseData} response A undici Response
|
|
49
|
+
* @param {string | object} body response body
|
|
50
|
+
* @param {any} [extra] any extra info to attach to the error
|
|
51
|
+
*/
|
|
21
52
|
constructor(response: Dispatcher.ResponseData, body: string | object, extra?: any);
|
|
22
|
-
statusCode: number;
|
|
23
|
-
body: string | object;
|
|
24
|
-
extra: any;
|
|
53
|
+
/** @type { number } */ statusCode: number;
|
|
54
|
+
/** @type {string | object } */ body: string | object;
|
|
55
|
+
/** @type {any} */ extra: any;
|
|
25
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* Request options derived from undici.request
|
|
59
|
+
*/
|
|
26
60
|
export type RequestOptions = NonNullable<Parameters<typeof request>[1]>;
|
|
27
61
|
import type { Dispatcher } from 'undici';
|
|
28
62
|
import type { request } from 'undici';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["helpers.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["helpers.js"],"names":[],"mappings":"AAOA;;;GAGG;AAEH;;;;GAIG;AACH,yCAHG;IAAyB,SAAS;IACD,cAAc;;;CACjD;;;EAWA;AAED;;;;GAIG;AACH,sEAHG;IAAwB,WAAW,EAA1B,MAAM;IACS,SAAS;CACnC;;;;EAMA;AAED;;;;;;;GAOG;AACH,iDAJW,cAAc,mBACd,cAAc,GACZ,MAAM,CAoBlB;AAED;;;GAGG;AACH,4CAHY,uBAAuB,UACvB,GAAG,iBAWd;AAED;IAKE;;;;OAIG;IACH,sBAJY,uBAAuB,QACvB,MAAM,GAAG,MAAM,UACf,GAAG,EAUd;IAjBD,uBAAuB,CAAC,YAAZ,MAAM,CAAgB;IAClC,+BAA+B,CAAC,MAArB,MAAM,GAAG,MAAM,CAAU;IACpC,kBAAkB,CAAC,OAAR,GAAG,CAAU;CAgBzB;;;;6BA9FY,WAAW,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;gCARxB,QAAQ;6BACX,QAAQ"}
|