divshot / divshot-api Goto Github PK
View Code? Open in Web Editor NEWWrapper for the Divshot API
Wrapper for the Divshot API
api.apps.list() hits the /apps endpoint and should return back user + organization apps (see #13). In the near future, I'm envisioning the following collection of methods for retrieving apps:
api.apps.list() - Returns apps for self + organizations.
api.user.self().apps.list() - Returns apps for self.
api.organizations.id().apps.list() - Returns apps for a specific organization.
Having this flexibility allows me to reduce my requests or speed things up, depending on my needs:
api.apps.list() for generating a billing summary without multiple requests for organization apps.
api.user.self().apps.list() for faster requests in the Dashboard main view.
app.subscription = {
updateCard: function (token, callback) {
var url = app.url() + '/subscription/card';
return app.http.request(url, 'PUT', {
form: {
card: token
}
}, callback);
}
};
I want us to switch to using multiple applications, even for internal use. For instance, the CLI should be a different app from the dashboard should be a different app from the builder. We should move away from including a default Client ID in the code at all.
Rather than having to do one-offs like:
$http(
url: divshot._api.host + '/apps/' + name + '/subscription'
method: 'DELETE'
headers: divshot._api.headers
)
We should be able to do something like
divshot.http(url: "/apps/" + name + "/subscription", method: "DELETE")
I think email needs to be wrapped inside form
.
If I create a client with the session
option set to true
, I am implying that I will not be using a Bearer token when making calls to the API.
As such, any calls made to protected resources that might normally trigger an authentication pre-hook (don't entirely understand the circumstances of this, but it seems to be happening) should be disabled.
Using the Angular library, I configure it to use session:
divshotProvider.configure({client_id: 'abc123', session: true})
Making a single call at this point, e.g. divshot.user.self()
completes successfully. However, other calls being made trigger a POST
request to /token
with no credentials resulting in a 401 and a setToken
call with no token to set.
Once this has happened, the Authorization header (which should be Session <CLIENT_ID>
) is Bearer undefined
.
At the moment api.apps.list() only returns the current user's apps (data.self), although the API endpoint returns all of the organization apps as well. I need a method that provides access to all of these apps to reduce the number of requests I need to make.
Add a browser-only auth module with functionality to be built out by me (or someone else). Let's set it up as a pull request that will complete when everything's done.
@scottcorgan if you can start the branch, that'd be great.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.