Metadata search client addon
An addon for the Imbo javascript client.
Installation
imboclient-js-metadata can be installed using npm:
npm install imboclient-metadata
Basic usage
There is no clearly defined add-on or plugin concept in the imboclient
, but this add-on is written in a way that requires you to add the functions it exports to the Imbo.Client prototype for it to work. Exactly how you want to do this is up to you.
'use strict';
var Imbo = require('imboclient');
var metadata = require('imboclient-metadata');
Imbo.Client.prototype.searchMetadata = metadata.searchMetadata;
Imbo.Client.prototype.searchGlobalMetadata = metadata.searchGlobalMetadata;
var client = new Imbo.Client('http://imbo', 'foobar', 'barfoo');
client.searchGlobalMetadata(
{ animal: 'cat' },
{
users: ['user', 'other-user'],
metadata: 1,
fields: ['width', 'height', 'imageIdentifer'],
sort: ['width:asc', 'height:desc']
},
function(err, body, meta, res) {
console.log(err, body, meta);
}
);
client.searchMetadata(
'user',
{ animal: 'cat' },
{},
function(err, body, meta, res) {
console.log(err, body, meta);
}
);
License
Copyright (c) 2015, Kristoffer Brabrand kristoffer@brabrand.no
Licensed under the MIT License