Skip to content
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(api/registry, api/search, api/version): add api endpoints to get closer to command line functionality #475

Merged
merged 9 commits into from
Jul 5, 2018

Conversation

ramfox
Copy link
Member

@ramfox ramfox commented Jun 28, 2018

close #474

@ghost ghost assigned ramfox Jun 28, 2018
@ghost ghost added the in progress label Jun 28, 2018
Copy link
Member

@b5 b5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If u promise to write tests for this stuff in the near future I think this is good to merge 😸.

if err != nil {
return err
}
if err = act.permission(ref); err != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the "permission" check should be dropped. "permission" checks to see if this peer owns the dataset in question, but peers should be able to check the status of datasets they don't own.

@@ -42,6 +42,21 @@ func (act Registry) Unpublish(ref repo.DatasetRef) (err error) {
return cli.DeleteDataset(ref.Peername, ref.Name, ds.Encode(), pub)
}

// Status checks to see if a dataset is published to a repo's specific registry
func (act Registry) Status(ref repo.DatasetRef) (err error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it. In the near future registries are going to get an upgrade where they can also pin, and we'll have to modify this func to return the status of two things:

  • if a given ref is published to the registry (what it's currently doing)
  • if that given ref is pinned to the registry (commng soon)

For now this is a great starting point.

We need an api endpoint that will allow users to publish, unpublish, and check the status of their datasets with reference to the registry.

The format will be consistant with the other endpoints:
`/registry/peername/datasetname@id/network/hash`

You check the registry by making a `GET` request
You publish to the registry by making a `PUT` or `POST` request
You unpublish from the registry by making a `DELETE` request
…npublish endpoints

also, this commit also plumbs the `Status` function from repo/registry, to lib/registry, to api/registry
currently, the response is coming back with errors, using the `GET` method on the `/registry/` endpoint is disabled for now. need to dive into the registryServer, but want to tackle search before flipping back to registry
@ramfox ramfox force-pushed the api branch 3 times, most recently from 260affa to c62af8a Compare July 3, 2018 20:37
So there was a point when the search response actually responsed with the correct search value. Now it's returning with an empty data field.

Definitely need to figure out why, but I've been spending too much time on this and I want to progress, so for now keeping the weirdness.
…ta/structure/etc info on add

also adding back checking responses for mime/multipart file tests
now that you can init from a dataset file (as well as a body file) from the api, like you can on the command line, I've added a test that ensure just that.

This has cascading effects on later tests, this commit adjusts those tests.
Copy link
Member

@b5 b5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

☝️ ☝️ 👇 👇 👈 👈 👉 👉 🅱️ 🅰️ 💥

@ramfox ramfox merged commit abb36a4 into master Jul 5, 2018
@ghost ghost removed the in progress label Jul 5, 2018
@ramfox ramfox deleted the api branch July 5, 2018 21:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bring API functionality closer to the command line
2 participants