hub-api-playground / utils /datas /api_collections.ts
severo's picture
severo HF staff
Add /croissant endpoint
9c57a48 verified
raw
history blame
6.48 kB
import { ApiCollection } from "@/utils/type";
export const API_COLLECTIONS: Array<ApiCollection> = [{
key: 'search',
endpoints: [
{
method: 'GET',
path: '/api/models',
parameters: {
search: "",
author: "",
filter: "",
sort: "",
direction: "",
limit: 5,
full: true,
config: true
},
tooltips: {
search: "Filter based on substrings for repos and their usernames, such as resnet or microsoft",
full: "Whether to fetch most model data, such as all tags, the files, etc.",
config: "Whether to also fetch the repo config.",
filter: "Filter based on tags, such as text-classification or spacy."
}
}, {
method: 'GET',
path: '/api/models/{repo_id}'
}, {
method: 'GET',
path: '/api/models-tags-by-type'
}, {
method: 'GET',
path: '/api/datasets',
parameters: {
search: "",
author: "",
filter: "",
sort: "",
direction: "",
limit: 5,
full: true,
},
tooltips: {
search: "Filter based on substrings for repos and their usernames, such as pets or microsoft",
full: "Whether to fetch most model data, such as all tags, the files, etc.",
config: "Whether to also fetch the repo config.",
filter: "Filter based on tags, such as task_categories:text-classification or languages:en."
}
}, {
method: 'GET',
path: '/api/datasets/{repo_id}',
parameters: {
full: true,
},
tooltips: {
full: "Whether to fetch most dataset data, such as all tags, the files, etc.",
}
}, {
method: 'GET',
path: '/api/datasets/{repo_id}/parquet'
}, {
method: 'GET',
path: '/api/datasets/{repo_id}/parquet/{config}/{split}/{n}.parquet'
}, {
method: 'GET',
path: '/api/datasets/{repo_id}/croissant'
}, {
method: 'GET',
path: '/api/datasets-tags-by-type'
}, {
method: 'GET',
path: '/api/spaces',
parameters: {
search: "",
author: "",
filter: "",
sort: "",
direction: "",
limit: 5,
full: true,
},
tooltips: {
search: "Filter based on substrings for repos and their usernames, such as resnet or microsoft",
full: "Whether to fetch most model data, such as all tags, the files, etc.",
config: "Whether to also fetch the repo config.",
filter: "Filter based on tags, such as text-classification or spacy."
}
}, {
method: 'GET',
path: '/api/spaces/{repo_id}'
}, {
method: 'GET',
path: '/api/metrics'
}],
},
{
key: 'repo',
endpoints: [{
method: 'POST',
path: '/api/repos/create',
body: [
{
label: "Type of repo (dataset or space; model by default)",
key: "type",
required: true,
},
{
label: "Name of repo",
key: "name",
required: true,
},
{
label: "Name of organization (optional)",
required: true,
key: "organization",
},
{
label: "SDK (if type is space)",
key: "sdk",
},
{
label: "Whether the repo is private",
required: true,
key: "private",
defaultValue: false,
},
]
}, {
method: 'DELETE',
path: '/api/repos/delete',
body: [{
label: "Type of repo (dataset or space; model by default)",
key: "type",
required: true,
},
{
label: "Name of repo",
key: "name",
required: true,
},
{
label: "Name of organization (optional)",
required: true,
key: "organization",
}]
}, {
method: 'POST',
path: '/api/repos/move',
body: [{
label: "From which repo",
key: "fromRepo",
required: true,
},
{
label: "To which repo",
key: "toRepo",
required: true,
}]
}],
},
{
key: 'user',
endpoints: [{
method: 'GET',
path: '/api/whoami-v2',
}],
},
{
key: 'collection',
endpoints: [{
method: 'POST',
path: '/api/collections',
body: [{
label: "Title of collection",
key: "title",
required: true,
}, {
label: "Namespace",
key: "namespace",
required: true,
}, {
label: "Description of collection",
key: "description",
required: true,
}, {
label: "Type",
key: "item.type",
required: true,
}, {
label: "RepoId/PaperId",
key: "item.id",
required: true,
}, {
label: "Whether the repo is private",
required: true,
key: "private",
defaultValue: false,
}]
}, {
method: "GET",
path: '/api/collections',
parameters: {
owner: "",
sort: "",
item: "",
limit: 5,
q: ""
},
tooltips: {
item: "filter collections containing a specific item. Value must be the item_type and item_id concatenated. Example: \"models/teknium/OpenHermes-2.5-Mistral-7B\", \"datasets/squad\" or \"papers/2311.12983\".",
q: "Filter based on substrings for titles & descriptions."
}
}, {
method: 'GET',
path: '/api/collections/{namespace}/{slug-id}',
},{
method: 'PATCH',
path: '/api/collections/{namespace}/{slug-id}',
body: [{
label: "Title of collection",
key: "title",
required: true,
}, {
label: "Namespace",
key: "namespace",
required: true,
}, {
label: "Position",
required: true,
key: "position",
defaultValue: 0,
}, {
label: "Theme",
required: true,
key: "theme",
}, {
label: "Whether the repo is private",
required: true,
key: "private",
defaultValue: false,
}]
}, {
method: 'DELETE',
path: '/api/collections/{namespace}/{slug-id}',
}, {
method: 'POST',
path: '/api/collections/{namespace}/{slug-id}/item',
body: [{
label: "Type",
key: "item.type",
required: true,
}, {
label: "RepoId/PaperId",
key: "item.id",
required: true,
}, {
label: "Note",
key: "note",
required: true,
}]
}, {
method: 'PATCH',
path: '/api/collections/{namespace}/{slug-id}/item/{itemId}',
body: [{
label: "Position",
key: "position",
defaultValue: 0,
required: true,
}, {
label: "Note",
key: "note",
required: true,
}]
}, {
method: 'DELETE',
path: '/api/collections/{namespace}/{slug-id}/item/{itemId}',
}]
}
]