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

Add ingest API - delete collection #31

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/clj/cmr/client/http/impl.clj
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@
:get http/get
:head http/head
:put http/put
:post http/post))
:post http/post
:delete http/delete))

(defn- call
[client method args options]
Expand Down Expand Up @@ -161,7 +162,11 @@
([this url]
(delete this url {}))
([this url options]
:not-implemented))
(call this
:delete
(->> options
(create-http-client-args this url))
options)))

(defn- copy
([this url]
Expand Down
1 change: 1 addition & 0 deletions src/clj/cmr/client/ingest.clj
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
get-providers
create-collection
update-collection
delete-collection
create-variable
update-variable])

Expand Down
15 changes: 15 additions & 0 deletions src/cljc/cmr/client/ingest/impl.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,20 @@
(http-util/merge-header options
(base/get-token-header this))))))

(defn delete-collection
"Delete a collection."
([this provider-id native-id]
(delete-collection this provider-id native-id {}))
([this provider-id native-id options]
(-> this
:http-client
(http/delete (base/get-url this
(format "/providers/%s/collections/%s"
provider-id
native-id))
(http-util/merge-header options
(base/get-token-header this))))))

(defn save-variable
"Save a variable."
([this provider-id native-id metadata]
Expand All @@ -65,5 +79,6 @@
{:get-providers get-providers
:create-collection save-collection
:update-collection save-collection
:delete-collection delete-collection
:create-variable save-variable
:update-variable save-variable}))
3 changes: 3 additions & 0 deletions src/cljc/cmr/client/ingest/protocol.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
(^:export update-collection [this provider-id native-id metadata]
[this provider-id native-id metadata options]
"Update a collection.")
(^:export delete-collection [this provider-id native-id]
[this provider-id native-id options]
"Delete a collection.")
(^:export create-variable [this provider-id native-id metadata]
[this provider-id native-id metadata options]
"Create a variable.")
Expand Down
4 changes: 4 additions & 0 deletions src/cljs/cmr/client/ingest.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
get-providers
create-collection
update-collection
delete-collection
create-variable
update-variable])

Expand Down Expand Up @@ -55,6 +56,9 @@
(update-collection
[this]
(ingest/save-collection this provider-id native-id data))
(delete-collection
[this]
(ingest/delete-collection this provider-id native-id))
(create-variable
[this]
(ingest/save-variable this provider-id native-id data))
Expand Down