forked from replicate/replicate-javascript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcollections.js
More file actions
28 lines (24 loc) · 720 Bytes
/
collections.js
File metadata and controls
28 lines (24 loc) · 720 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/**
* Fetch a model collection
*
* @param {string} collection_slug - Required. The slug of the collection. See http://replicate.com/collections
* @returns {Promise<object>} - Resolves with the collection data
*/
async function getCollection(collection_slug) {
const response = await this.request(`/collections/${collection_slug}`, {
method: "GET",
});
return response.json();
}
/**
* Fetch a list of model collections
*
* @returns {Promise<object>} - Resolves with the collections data
*/
async function listCollections() {
const response = await this.request("/collections", {
method: "GET",
});
return response.json();
}
module.exports = { get: getCollection, list: listCollections };