hub-api-playground / utils /datas /api_collections.ts
victor's picture
victor HF Staff
Update api_collections.ts
abd78a0
raw
history blame
9.09 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,
inference_provider: "",
expand: "",
},
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.",
inference_provider:
"Filter based on the available inference providers for the model (https://huggingface.co/docs/huggingface_hub/en/guides/inference#supported-providers-and-tasks).",
expand:
"Expand the model attributes. For example, you can get the supported provides with 'expand[]=inferenceProviderMapping'.",
},
},
{
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}/croissant",
},
{
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-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/semantic-search",
parameters: {
q: "",
category: "",
},
tooltips: {
q: "Search query for semantic search",
category: "Filter based on Space categories",
},
},
{
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: "organizations",
endpoints: [
{
method: "GET",
path: "/api/organizations/{organization_name}/members",
},
],
},
{
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}",
},
],
},
];