Git Product home page Git Product logo

cloud-client-api-http's People

Contributors

jasonkuhrt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cloud-client-api-http's Issues

Add support for GET .../input

Add support for the new V3 API endpoint that allows for GETing a stream of input amplitude of a device.

This endpoint also supports https://github.com/littlebits/stream-sift features but because the endpoint is a GET the pattern spec must be sent as a urlEncoded value. This library should make this arcane and asinine process transparent to the user.

Also, what will the stream API we use be? Kefir? Custom?

pojo installation support

Need a simple script with public URI that people of all skill levels can include in html pages and immediately use. Most likely will register a global object called littleBitsAPI or similar, a simple example usage would be such as littlebits/cloud-api-lessons#4

  • Committed dist
  • Committed dist-min
  • littleBits cdn hosting of dist + dist-min

transparent support for both snake and camel case

The current solution to options arguments is lame. Firstly we don't base our key names on those in the HTTP API spec because that goes against JS naming conventions (= more unimportant details for developers to remember), secondly, we don't standardize the HTTP API spec key names to camelCase because of the terrible results entailed: subscriberId, durationMs, etc.

So we lose either way: unique names to learn, difficult-to-read names.

However there's a third way: support both. This has several benefits:

Remove snake_case support?

Remove library confusion. We're not tailoring to python developers. And we're not going to single-handedly change the JavaScript industry.

New interface

The following sketches the core necessary actions and their types.

-- Devices Actions

devicesGet :: AccessToken -> Promise (List Device)

-- Device Actions

devicePost     :: AccessToken -> DeviceSpec -> Promise Device
deviceSettings :: AccessToken -> DeviceID -> SettingsSpec -> Promise Device
deviceGet      :: AccessToken -> DeviceID -> Promise Device
deviceDelete   :: AccessToken -> DeviceID -> Promise Device

-- Device Input Actions

deviceInputGet :: AccessToken -> DeviceID -> ReadSemantics -> Promise InputEvent

-- Device Output Actions

deviceOutputPost :: AccessToken -> DeviceID -> Promise ()

-- Relation Actions

relationPost         :: AccessToken -> RelationSpec -> Promise Relation
relationGet          :: AccessToken -> EdgeIdent -> Promise Relation
relationGetSubjects  :: AccessToken -> VertexID -> Promise (List Relation)
relationGetObservers :: AccessToken -> VertexID -> Promise (List Relation)
relationDelete       :: AccessToken -> EdgeIdent -> Promise Relation

Sugar for AccessToken

There should be an easy way for the user to get an API that has the first argument AccessToken applied. For example the following could return whole API with AccessToken partially applied to each action:

littleBitsCloud
  .withUser('83hs026fbn2pqw=27qbs91571k')
  // deviceSettings :: DeviceID -> SettingsSpec -> Promise Device
  // deviceGet      :: DeviceID -> Promise Device
  // etc.

Sugar for DeviceID

There should be an easy way for the user to get an API to work with a specific device wherein the second argument DeviceID is applied. For example:

littleBitsCloud
  .withUser('83hs026fbn2pqw=27qbs91571k')
  .withDevice('71d1hoa610')
  // deviceSettings :: SettingsSpec -> Promise Device
  // deviceGet      :: Promise Device
  // etc.

The returned API function names should have aliases that drop the device prefix given that it is redundant in this chaining context. So for example these two would be the same:

littleBitsCloud
  .withUser('83hs026fbn2pqw=27qbs91571k')
  .withDevice('71d1hoa610')
  .deviceSettings({ input_interval_ms: 50 })
  // ...
littleBitsCloud
  .withUser('83hs026fbn2pqw=27qbs91571k')
  .withDevice('71d1hoa610')
  .settings({ input_interval_ms: 50 })
  // ...

device_id must be camelCased acceptable

Currently path-params are not customizable so we're stuck with device_id e.g.

output({device_id: 'foo', percent: 50})

We could use deviceId but wow that would suck. We could use id or device.

I solved this type of problem before forsubscriber_id and publisher_id by using subscriber and publisher. Similarly I think I prefer device here:

output({device: 'foo', percent: 50})

If we had snake_case support in the community I wouldn't think twice about renaming these keys.

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.