Skip to content

Commit

Permalink
get-rendition-content
Browse files Browse the repository at this point in the history
  • Loading branch information
saidone75 committed Jun 9, 2024
1 parent 798e40b commit 4d2ca39
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/cral/api/core/renditions.clj
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
[cral.utils.utils :as utils])
(:import (clojure.lang PersistentHashMap PersistentVector)
(cral.model.auth Ticket)
(cral.model.core ListRenditionsQueryParams)))
(cral.model.core GetRenditionContentQueryParams
ListRenditionsQueryParams)))

(defn create-rendition
"An asynchronous request to create a rendition for file `node-id`.
Expand Down Expand Up @@ -83,4 +84,18 @@
(format "%s/nodes/%s/renditions/%s" (config/get-url 'core) node-id rendition-id)
ticket
{:query-params nil}
opts)))
opts)))

(defn get-rendition-content
"Gets the rendition content for `rendition-id` of file `node-id`.\\
More info [here](https://api-explorer.alfresco.com/api-explorer/?urls.primaryName=Core%20API#/renditions/getRenditionContent)."
([^Ticket ticket ^String node-id ^String rendition-id]
(get-rendition-content ticket node-id rendition-id nil))
([^Ticket ticket ^String node-id ^String rendition-id ^GetRenditionContentQueryParams query-params & [^PersistentHashMap opts]]
(utils/call-rest
client/get
(format "%s/nodes/%s/renditions/%s/content" (config/get-url 'core) node-id rendition-id)
ticket
{:as :byte-array
:query-params query-params}
(merge {:return-headers true} opts))))
4 changes: 4 additions & 0 deletions src/cral/model/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,10 @@
(defrecord ListRenditionsQueryParams
[^String where])

(defrecord GetRenditionContentQueryParams
[^Boolean attachment
^Boolean placeholder])

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

0 comments on commit 4d2ca39

Please sign in to comment.