Giter Site home page Giter Site logo

divshot-api's People

Contributors

collin avatar fastdivision avatar mbleigh avatar scottcorgan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

divshot-api's Issues

Add method to only list user's apps from a new API endpoint

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.

Don't include a default Client ID

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.

Provide generic http method that has pre-baked defaults

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")

If options.session is true, do not run authentication pre-hooks

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.

Error Scenario

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.

Refactor apps.list() method to list user + organization apps

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.

Browser Auth

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.