node package manager
Stop writing boring code. Discover, share, and reuse within your team. Create a free org »

hapi.app.avatars

hapi.app.avatars

This is a small library built on top of HAPILib, intended to be used as part of HAPI.App.

The functionality is very limited at present. It allows you to very easily access all assets available to a user, organised in a data structure intended to enable easy app development.

The library uses jQuery Deferred to handle asynchronous tasks, all of which return a promise.

To get assets available to a user:

var hav = new HapiAvatars;
hav.user.assets({ representation: "standard" })
    .then(function(assets) { doSomethingWithAssets(assets); });

The data structure returned is of the form:

{
   pack_name:
   {
       category_name:
       [
           {
               Id: "1",
               Label: "asset_label",
               Title: "Asset Title",
               Metadata: {},
               DateCreated: "2013-01-14T17:11:11.777",
               GoodId: "1",
               CategoryId: "1",
               Thumbnail: "http://thumbnail.com/thumbnail",
               Layers: [...]
           },
           {
               Id: "2",
               Label: "asset_label",
               Title: "Asset Title",
               Metadata: {},
               DateCreated: "2013-01-14T17:11:11.777",
               GoodId: "1",
               CategoryId: "1",
               Thumbnail: "http://thumbnail.com/thumbnail",
               Layers: [...]
           }, ...
       ],
       category_name:
       [
           {
               ...
           }
       ]
   }
}