Coder Social home page Coder Social logo

binder-protocol's Introduction

๐Ÿ’จ ๐Ÿ’จ The Binder Project is moving to a new repo. ๐Ÿ’จ ๐Ÿ’จ

๐Ÿ“š Same functionality. Better performance for you. ๐Ÿ“š

Over the past few months, we've been improving Binder's architecture and infrastructure. We're retiring this repo as it will no longer be actively developed. Future development will occur under the JupyterHub organization.

Thanks for updating your bookmarked links.

๐Ÿ’จ ๐Ÿ’จ The Binder Project is moving to a new repo. ๐Ÿ’จ ๐Ÿ’จ


binder-protocol

A declarative specification of the Binder API that ensures consistency between BinderModules and the client module

Used by binder-client to auto-generate the client and CLI interfaces

install

npm install binder-protocol

usage

The protocol declaration is a single JS object, where each bottom-level key represents a Binder API endpoint and the value is a schema object. The endpoints currently defined are (see the API description for more detail):

  • build
    • start - start a build
    • status - query the status of a single build
    • statusAll - query the status of all builds
  • registry
    • fetch - get a single template
    • fetchAll - get all registered templates
  • deploy
    • deploy - launch an instance of a template on the deploy backend
    • status - get the status of a single deployment matching a template/id combo
    • statusAll - get the status of all deployments for a given template

schema

Each endpoint is defined by the following properties:

  1. path string - templated string describing the pathname and any request parameters
  2. params object - keys for every request parameter and values describing that parameter's properties:
  3. type string - request parameter type
  4. description string - request parameter description
  5. required boolean - is this parameter required?
  6. description string - description of the endpoint
  7. msg string - message that should be displayed when the endpoint request is sent
  8. request object - keys for all properties of the HTTP request
  9. method string - HTTP method
  10. authorized boolean - if the endpoint requires an API token
  11. body object - HTTP post body
  12. response object - contains a description of the possible response body and error/success handling info
  13. body object - response body type description
  14. error object - names and handlers for all possible errors that the endpoint can generate (keyed by error name)
  15. status number - HTTP response code for the error
  16. msg string - description of the error that occurred
  17. suggestions [string] - possible fixes for the error
  18. success object - handler for the single success outcome that the endpoint can generate

examples

Here's a simple example from the deploy API, but see index.js for many more examples.

deploy: {
    ...
    
    statusAll: {
      path: '/applications/{template-name}',
      params: {
        'template-name': {
          type: String,
          description: 'name of the template with existing deployments',
          required: false
        }
      },
      description: 'Get information associated with all deployment for a given template',
      msg: 'Getting information about all deployments for {template-name}',
      request: {
        method: 'GET',
        authorized: true
      },
      response: {
        body: [{
          id: String,
          location: String
        }],
        error: {
          badDatabase: {
            status: 500,
            msg: 'Querying the database for all deployments failed',
            suggestions: [
              'ensure that the database is accessible to the deploy server',
              'check the Binder Logstash logs for database-oriented messages'
            ]
          }
        },
        success: {
          status: 200,
          msg: '{results}'
        }
      }
    }
  }

binder-protocol's People

Contributors

andreabedini avatar andrewosh avatar choldgraf avatar

Watchers

 avatar  avatar  avatar

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.