Simple helper for interacting with the Landlord APIs
npm install @d2l/landlord-client --save
var LandlordClient = require('@d2l/landlord-client');
var client = new LandlordClient();
client
.lookupTenantId('valence.desire2learn.com:443')
.then(function (tenantId) {
// do something
})
.catch(function (err) {
// handle error
});
You may optionally specify the Landlord instance to connect to.
...new LandlordClient({ endpoint: 'https://landlord.brightspace.com' });
You may optionally specifiy an instance of a cache inheriting from
LandlordClient.AbstractLandlordCache
.
Given the host, will fetch then TenantId from Landlord. Returns a Promise to a String.
Given the TenantId, well fetch the base url from Landlord. Returns a Promise to a String.
Given the TenantId, will fetch the host (no protocol) from Landlord. Returns a Promise to a String.
Provided as part of the export is an object containing the well-typed errors which may be returned from function calls.
npm test
-
Fork the repository. Committing directly against this repository is highly discouraged.
-
Make your modifications in a branch, updating and writing new unit tests as necessary in the
spec
directory. -
Ensure that all tests pass with
npm test
-
rebase
your changes against master. Do not merge. -
Submit a pull request to this repository. Wait for tests to run and someone to chime in.
This repository is configured with EditorConfig and ESLint ESLint rules. See the docs.dev code style article for information on installing editor extensions.