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

get-rendition-content #296

Merged
merged 1 commit into from
Jun 9, 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
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