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

delete-shared-link #136

Merged
merged 1 commit into from
Mar 31, 2024
Merged
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
13 changes: 12 additions & 1 deletion src/cral/alfresco/core/shared_links.clj
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,15 @@
(format "%s/shared-links/%s" (config/get-url 'core) shared-id)
nil
{:query-params query-params}
opts)))
opts)))

(defn delete-shared-link
"Deletes the shared link with identifier **shared-id**.
More info [here](https://api-explorer.alfresco.com/api-explorer/?urls.primaryName=Core%20API#/shared-links/deleteSharedLink)."
[^Ticket ticket ^String shared-id & [^PersistentHashMap opts]]
(utils/call-rest
client/delete
(format "%s/shared-links/%s" (config/get-url 'core) shared-id)
ticket
{}
opts))
6 changes: 4 additions & 2 deletions test/cral/shared_links_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
(def user "admin")
(def password "admin")

(deftest create-then-list-then-get-shared-link
(deftest create-then-list-then-get-then-delete-shared-link
(let [ticket (get-in (auth/create-ticket user password) [:body :entry])
parent-id (:id (tu/get-guest-home ticket))
;; create a node
Expand All @@ -29,6 +29,8 @@
(Thread/sleep 1000)
(recur (shared-links/list-shared-links ticket))))
;; get shared link
(is (= (:status (shared-links/get-shared-link (get-in create-shared-link-response [:body :entry :id]))) 200)))
(is (= (:status (shared-links/get-shared-link (get-in create-shared-link-response [:body :entry :id]))) 200))
;; delete shared link
(is (= (:status (shared-links/delete-shared-link ticket (get-in create-shared-link-response [:body :entry :id]))) 204)))
;; clean up
(is (= (:status (nodes/delete-node ticket (get-in create-node-response [:body :entry :id]))) 204))))