Add version history, screenshots, embed generator, collections, npm search, format-on-save, and custom fonts
This commit is contained in:
@@ -39,3 +39,47 @@ export function listFiddles({ q, js_type, tag, page, limit, sort } = {}) {
|
||||
export function listTags() {
|
||||
return request('/api/tags');
|
||||
}
|
||||
|
||||
// Version history
|
||||
export function listVersions(id) {
|
||||
return request(`${BASE}/${id}/versions`);
|
||||
}
|
||||
|
||||
export function getVersion(id, ver) {
|
||||
return request(`${BASE}/${id}/versions/${ver}`);
|
||||
}
|
||||
|
||||
export function revertVersion(id, ver) {
|
||||
return request(`${BASE}/${id}/revert/${ver}`, { method: 'POST' });
|
||||
}
|
||||
|
||||
// Collections
|
||||
export function createCollection(data) {
|
||||
return request('/api/collections', { method: 'POST', body: JSON.stringify(data) });
|
||||
}
|
||||
|
||||
export function listCollections() {
|
||||
return request('/api/collections');
|
||||
}
|
||||
|
||||
export function getCollection(id) {
|
||||
return request(`/api/collections/${id}`);
|
||||
}
|
||||
|
||||
export function updateCollection(id, data) {
|
||||
return request(`/api/collections/${id}`, { method: 'PUT', body: JSON.stringify(data) });
|
||||
}
|
||||
|
||||
export function deleteCollection(id) {
|
||||
return request(`/api/collections/${id}`, { method: 'DELETE' });
|
||||
}
|
||||
|
||||
export function addToCollection(collectionId, fiddleId) {
|
||||
return request(`/api/collections/${collectionId}/fiddles`, {
|
||||
method: 'POST', body: JSON.stringify({ fiddle_id: fiddleId }),
|
||||
});
|
||||
}
|
||||
|
||||
export function removeFromCollection(collectionId, fiddleId) {
|
||||
return request(`/api/collections/${collectionId}/fiddles/${fiddleId}`, { method: 'DELETE' });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user