ldsorg.js
This is a thin layer over the LDS.org api. All of the data is exactly the same with one exception: pictures are included in calls to individuals and households.
Questions? Comments? Leave an issue or join the discussion on Google Groups
Installation
Note that hogwarts.js
is for testing and thus optional. If you use hogwarts.js
you must also include chance.js
.
node.js
npm install ldsorg
browser
via bower
bower install ldsorg
script(src="bower_components/forEachAsync/forEachAsync.js")script(src="bower_components/forAllAsync/forAllAsync.js")script(src="bower_components/join/join.js")script(src="bower_components/lateral/lateral.js")script(src="bower_components/ldsorgjs/ward.js")script(src="bower_components/ldsorgjs/stake.js")script(src="bower_components/ldsorgjs/browser.js")script(src="bower_components/ldsorgjs/ldsorg.js")script(src="bower_components/ldsorgjs/cache-browser.js")script(src="bower_components/chance/chance.js")script(src="bower_components/ldsorgjs/hogwarts.js")
via download
wget http://ldsorg.github.io/ldsorgjs/ldsorg.all.js
Usage
In about 25 seconds you can download all of the data (including pictures) for your entire ward.
Note: You can log in as the user dumbledore
with any password and have access to the fake stake Bettendorf
from hogwarts.js
.
; { 'use strict'; var LdsOrg = exportsLdsOrg || LdsOrg // you should probably create your own cache strategy Cache = exportsLdsOrgCache || LdsOrgCache ldsorg ts = Date username password isNode ; if 'undefined' !== typeof process && processargv username = processargv2; password = processargv3; isNode = true; ldsorg = LdsOrg; // In the browser you must be already signed in ldsorg; }'undefined' !== typeof exports && exports || 'return this';
You should provide your own caching strategy with the same api as the provided cache.js
or cache-browser.js
.
API
TODO list respective urls and link to examples on ldsorg-api-documentation repo
LdsOrg
- LdsOrg.create(opts) - returns an LdsOrg instance
- #signin(cb, { username: 'u', password: 'p'}) - cb when signin is complete
- cb is a function
function (err) {}
- auth is an object
{ username: 'johndoe', password: 'secret' }
- cb is a function
- #signout(cb)
- #init(cb, emitFn) - cb when init is complete. emitFn(eventname, arg1, arg2, ...) for each event
- #getCurrentUserId(fn)
- #getCurrentUnits(fn)
- #getCurrentStakes(fn)
- #getCurrentUserMeta(fn)
- #getCurrentHousehold(fn)
- #getStake(stakeUnitNo) - returns an LdsStake instance
- #getCurrentStake() - returns an LdsStake instance
Options
{ prefetch: true }
- start downloading the whole stake atinit
- current stake
- current ward
- other wards in stake
- other stakes
LdsStake
- LdsStake.create(opts, ldsOrg)
- #getPositions(fn)
- #getLeadership(fn, group)
- #getWard(wardUnitNo) - returns an LdsWard instance
- #getCurrentWard() - returns an LdsWard instance
- #getWards(fn, wardsOrIds, opts)
- #getAll(fn)
LdsWard
- LdsWard.create(opts, ldsOrg, ldsStake) - called internally
- #init(cb)
- #getMemberList(fn)
- #getPhotoList(fn)
- #getOrganization(fn, orgname)
- #getPositions(fn)
- #getLeadership(fn, group)
- #getHouseholdWithPhotos(fn, profileOrId, opts)
- #getOrganizations(fn, orgnames)
- #getCallings(fn)
- #getHouseholds(fn, households, opts)
- #getAll(fn, opts)
- #getHousehold(fn, profileOrId)
- #getHouseholdPhoto(fn, id)
- #getIndividualPhoto(fn, id)
Build it yourself
mkdir -p bower_componentsgit clone git@github.com:FuturesJS/forAllAsync.git bower_components/forAllAsyncgit clone git@github.com:FuturesJS/forEachAsync.git bower_components/forEachAsyncgit clone git@github.com:FuturesJS/join.git bower_components/joingit clone git@github.com:FuturesJS/lateral.git bower_components/lateralgit clone git@github.com:LDSorg/ldsorgjs.git bower_components/ldsorgjs cat \ "bower_components/forAllAsync/forAllAsync.js" \ "bower_components/forEachAsync/forEachAsync.js" \ "bower_components/join/join.js" \ "bower_components/lateral/lateral.js" \ "bower_components/ldsorg/stake.js" \ "bower_components/ldsorg/ward.js" \ "bower_components/ldsorg/browser.js" \ "bower_components/ldsorg/ldsorg.js" \ "bower_components/ldsorg/cache-browser.js" \ > ldsorg.all.js
TODO
Be able to serialize / deserialize top-level LdsOrg object so that it can be used between sessions for APIs.