-
Notifications
You must be signed in to change notification settings - Fork 453
feat(hub): create and delete a collection #1584
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(hub): create and delete a collection #1584
Conversation
* Custom fetch function to use instead of the default one, for example to use a proxy or edit headers. | ||
*/ | ||
fetch?: typeof fetch; | ||
} & ApiCreateCollectionPayload & |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we put the payload to a variable params.payload
? That way, if we decide to add new prop to ApiCreateCollectionPayload
in the future, we will not need to remap the entire body as we foward all the props from params.payload
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, but name the parameter collection
/** | ||
* First item to add to the collection upon creation. | ||
*/ | ||
item?: { | ||
type: "paper" | "collection" | "space" | "model" | "dataset"; | ||
id: string; | ||
}; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TBH not sure it's worth it to add this param to the API for the hub library, since the user will most of the time want to add other items.
(It'd be nice if we had a way to init collection with multiple items, cc @Kakulukian)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, I think so too. I just removed it for this PR (and it's in line with what we do in the Python client)
/** | ||
* The slug of the collection to delete. | ||
*/ | ||
collectionSlug: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
collectionSlug: string; | |
slug: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, I also change it in create-collection.ts
. WDYT?
I was a bit confused when I saw the endpoint: But in fact, We also have |
You can add it to this PR And yes it's confusing |
Hey @coyotte508, there are failed tests but they are unrelated. We merge this PR? |
Issue: #271
API doc:
Python client:
We don't have
delete-collection.spec.ts
as we already test deletion increate-collection.spec.ts
(similar to how it’s done increate-repo.spec.ts
).