Skip to content

Commit

Permalink
Merge pull request #291 from saidone75/dev
Browse files Browse the repository at this point in the history
list-renditions
  • Loading branch information
saidone75 authored Jun 8, 2024
2 parents 82fb67b + 47eca36 commit 5afc724
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
23 changes: 22 additions & 1 deletion src/cral/api/core/renditions.clj
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
[cral.model.core]
[cral.utils.utils :as utils])
(:import (clojure.lang PersistentHashMap PersistentVector)
(cral.model.auth Ticket)))
(cral.model.auth Ticket)
(cral.model.core ListRenditionsQueryParams)))

(defn create-rendition
"An asynchronous request to create a rendition for file `node-id`.
Expand Down Expand Up @@ -51,4 +52,24 @@
{:body (json/write-str (utils/camel-case-stringify-keys body))
:query-params nil
:content-type :json}
opts)))

(defn list-renditions
"Gets a list of the rendition information for each rendition of the the file `node-id`, including the rendition id.
Each rendition returned has a **status**: CREATED means it is available to view or download, NOT_CREATED means the
rendition can be requested.
You can use the **where** parameter in `query-params` to filter the returned renditions by status. For example, the
following **where** clause will return just the CREATED renditions:
```
(status='CREATED')
```
More info [here](https://api-explorer.alfresco.com/api-explorer/?urls.primaryName=Core%20API#/renditions/listRenditions)."
([^Ticket ticket ^String node-id]
(list-renditions ticket node-id nil))
([^Ticket ticket ^String node-id ^ListRenditionsQueryParams query-params & [^PersistentHashMap opts]]
(utils/call-rest
client/get
(format "%s/nodes/%s/renditions" (config/get-url 'core) node-id)
ticket
{:query-params query-params}
opts)))
3 changes: 3 additions & 0 deletions src/cral/model/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,9 @@
(defrecord CreateRenditionBody
[^String id])

(defrecord ListRenditionsQueryParams
[^String where])

;; shared-links
(defrecord CreateSharedLinkBody
[^String node-id
Expand Down

0 comments on commit 5afc724

Please sign in to comment.