Skip to content

Commit

Permalink
Merge pull request #136 from saidone75/dev
Browse files Browse the repository at this point in the history
delete-shared-link
  • Loading branch information
saidone75 authored Mar 31, 2024
2 parents 8f55477 + e193e65 commit 3ab6878
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
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))))

0 comments on commit 3ab6878

Please sign in to comment.