Update API.md

This commit is contained in:
AJ ONeal 2017-08-02 18:28:41 -06:00
parent 10bdac0109
commit 9fc0436bf2
1 changed files with 30 additions and 17 deletions

23
API.md
View File

@ -176,33 +176,46 @@ req.clientApiUri // The api URL for the instance of an app
req.pkgId // The name of the package being accessed req.pkgId // The name of the package being accessed
// i.e. the 'hello@example.com' part of https://api.example.com/api/hello@example.com/kv/foo // i.e. the 'hello@example.com' part of https://api.example.com/api/hello@example.com/kv/foo
req.oauth3.accountIdx // The system id of the account represented by the token
// i.e. this is the user
``` ```
Internal (and/or deprecated) APIs that you will very likely encounter Internal (and/or deprecated) APIs that you will very likely encounter
``` ```
req.getSiteStore().then(function (models) { req.getSiteStore().then(function (models) {
req.Models = models; req.Models = models;
}); });
req.Models.ComExampleHelloData.create(obj) //
// Consider Models for a package 'hello@example.com', the would be named like so
//
req.Models.HelloExampleComData.create(obj)
req.Models.ComExampleHelloData.save(obj) req.Models.ComExampleHelloData.save(obj)
req.Models.ComExampleHelloData.find(params) req.Models.ComExampleHelloData.find(params)
req.Models.ComExampleHelloData.destroy(objOrId) req.Models.ComExampleHelloData.destroy(objOrId)
req.oauth3.accountIdx // The system id of the account represented by the token //
// These should be scoped in such a way that the only hand back data specific
// to the experience and not expose secrets
//
req.getSiteConfig('com.example.hello').then(function (config) { req.getSiteConfig('com.example.hello').then(function (config) {
// the com.example.hello section of /srv/walnut/etc/:domain/config.json // the com.example.hello section of /srv/walnut/etc/:domain/config.json
}); });
req.getSitePackageConfig req.getSitePackageConfig
req.getSiteMailer().then(function (mailer) {});
// helper methods until we have agnostic means of doing the same / similar tasks //
// Deprecated
//
// These helper methods should be moved to a capability
req.Stripe req.Stripe
req.Mandrill req.Mandrill
req.Mailchimp req.Mailchimp
req.getSiteMailer().then(function (mailer) {});
``` ```
RESTful API Contstraints RESTful API Contstraints