Skip to content

Commit

Permalink
support query parameters in sourceimages.get and .list
Browse files Browse the repository at this point in the history
  • Loading branch information
chregu committed Oct 22, 2019
1 parent 533b6d6 commit 5fda315
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ Check out [the rokka documentation](https://rokka.io/documentation/references/se
Sorting works with user metadata as well and can be passed as either an array or as a
comma separated string.

#### rokka.sourceimages.get(organization, hash) → Promise
#### rokka.sourceimages.get(organization, hash, queryParams) → Promise

Get information of a source image by hash.

Expand Down
17 changes: 14 additions & 3 deletions src/apis/sourceimages.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ export default state => {
offset = null,
sort = null,
search = null,
facets = null
facets = null,
deleted = null
} = {}
) => {
let queryParams = {}
Expand All @@ -70,6 +71,10 @@ export default state => {
if (facets !== null) {
queryParams.facets = facets
}
if (deleted !== null) {
queryParams.deleted = deleted
}

if (sort !== null) {
if (Array.isArray(sort)) {
sort = sort.join(',')
Expand Down Expand Up @@ -100,10 +105,16 @@ export default state => {
* @authenticated
* @param {string} organization name
* @param {string} hash image hash
* @param {Object} queryParams like {deleted: true}
* @return {Promise}
*/
sourceimages.get = (organization, hash) => {
return state.request('GET', `sourceimages/${organization}/${hash}`)
sourceimages.get = (organization, hash, queryParams = {}) => {
return state.request(
'GET',
`sourceimages/${organization}/${hash}`,
null,
queryParams
)
}

/**
Expand Down

0 comments on commit 5fda315

Please sign in to comment.