Skip to content

Commit

Permalink
add facets and autolabel support
Browse files Browse the repository at this point in the history
  • Loading branch information
chregu committed Oct 17, 2019
1 parent 93d18db commit df7c3eb
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 3 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,18 @@ rokka.sourceimages.download('myorg', 'c421f4e8cefe0fd3aab22832f51e85bacda0a47a')
.catch(function(err) {});
```

#### rokka.sourceimages.autolabel(organization, hash) → Promise

Autolabels an image.

You need to be a paying customer to be able to use this.

```js
rokka.sourceimages.autolabel('myorg', 'c421f4e8cefe0fd3aab22832f51e85bacda0a47a')
.then(function(result) {})
.catch(function(err) {});
```

#### rokka.sourceimages.create(organization, fileName, binaryData, [metadata=null], [options={}]) → Promise

Upload an image.
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rokka",
"version": "1.3.0",
"version": "1.4.0",
"description": "JavaScript client library for rokka.io",
"main": "index.js",
"scripts": {
Expand Down
34 changes: 33 additions & 1 deletion src/apis/sourceimages.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,13 @@ export default state => {
*/
sourceimages.list = (
organization,
{ limit = null, offset = null, sort = null, search = null } = {}
{
limit = null,
offset = null,
sort = null,
search = null,
facets = null
} = {}
) => {
let queryParams = {}

Expand All @@ -61,6 +67,9 @@ export default state => {
if (offset !== null) {
queryParams.offset = offset
}
if (facets !== null) {
queryParams.facets = facets
}
if (sort !== null) {
if (Array.isArray(sort)) {
sort = sort.join(',')
Expand Down Expand Up @@ -140,6 +149,29 @@ export default state => {
return state.request('GET', `sourceimages/${organization}/${hash}/download`)
}

/**
* Autolabels an image.
*
* You need to be a paying customer to be able to use this.
*
* ```js
* rokka.sourceimages.autolabel('myorg', 'c421f4e8cefe0fd3aab22832f51e85bacda0a47a')
* .then(function(result) {})
* .catch(function(err) {});
* ```
*
* @authenticated
* @param {string} organization name
* @param {string} hash image hash
* @return {Promise}
*/
sourceimages.autolabel = (organization, hash) => {
return state.request(
'POST',
`sourceimages/${organization}/${hash}/autolabel`
)
}

/**
* Upload an image.
*
Expand Down

0 comments on commit df7c3eb

Please sign in to comment.