This assume that those operations are available at the originating web server. If instead you're offering "Telegraph" as a subservice, then instead of Jo you have to write Jo("Telegraph"), the rest is the same.
Here's also Github. It's resource-oriented instead of verb-oriented (like Telegraph), so we use Jor instead of Jo (both are provided by the same library).
Notice that using ["users/fmontesi/repos"] is the "alternative" syntax. If the resource path is a valid method name in JavaScript, e.g., "/users", you can just write this:
Jor.users.get().then( response => ... );
I'm still wondering what's the best way of offering resource paths. Using a string is fine, but another option would be to have an extension of JavaScript, like JSX in react, but that would add a dependency (on Babel, for example).
So we could do something like:
To create an account:
Jo.createAccount( { shortName: "Homer" } ) .then( response => { alert( response.result.accessToken ); } );
To create a page:
Jo.createPage( { accessToken: token, title: "Title", content: "Content" } ) .then( response => { alert( response.result.url ); } );
This assume that those operations are available at the originating web server. If instead you're offering "Telegraph" as a subservice, then instead of Jo you have to write Jo("Telegraph"), the rest is the same.
I hope this clarifies things a bit.