Giter VIP home page Giter VIP logo

api-designer's Introduction

API Designer

![Gitter](https://badges.gitter.im/Join Chat.svg)

Build Status Dependency Status DevDependency Status npm version Bower version

API Designer is a standalone/embeddable editor for RAML (RESTful API Modeling Language) written in JavaScript using Angular.JS. By default, the editor uses an in-browser filesystem stored in HTML5 Localstorage.

Examples of designing RAML with API Designer in the Wild

API Designer online

There is an online preview version of the API Designer, check it out a different branch.

Running Locally

npm install -g api-designer

api-designer

This will start a local designer instance using the in-browser filesystem.

Embedding

The following example details how to embed the API Designer:

<!doctype html>
<html>
  <head>
    <meta charset="utf-8">
    <title>My App</title>
    <link rel="stylesheet" href="dist/styles/api-designer-vendor.css">
    <link rel="stylesheet" href="dist/styles/api-designer.css">
  </head>
  <body ng-app="ramlEditorApp">
    <raml-editor></raml-editor>
    <script src="dist/scripts/api-designer-vendor.js"></script>
    <script src="dist/scripts/api-designer.js"></script>
    <script>
      // This part is needed only if you want to provide your own Persistance Implementation
      // Angular Module must match "ramlEditorApp"
      angular.module('ramlEditorApp')
      .factory('MyFileSystem', function ($q, config, $rootScope) {
        var service = {};

        service.directory = function (path) {
          var deferred = $q.defer();
        
          // Your magic goes here:
           // Do deferred.resolve(data); to fulfull the promise or
           // deferred.reject(error); to reject it.
        
           return deferred.promise;
        };

        service.load = function (path, name) {
          var deferred = $q.defer();
        
          // Your magic goes here:
           // Do deferred.resolve(data); to fulfull the promise or
           // deferred.reject(error); to reject it.
        
           return deferred.promise;
        };

        service.remove = function (path, name) {
          var deferred = $q.defer();
        
          // Your magic goes here:
           // Do deferred.resolve(data); to fulfull the promise or
           // deferred.reject(error); to reject it.
        
           return deferred.promise;
        };

        service.save = function (path, name, contents) {
          var deferred = $q.defer();
        
          // Your magic goes here:
           // Do deferred.resolve(data); to fulfull the promise or
           // deferred.reject(error); to reject it.
        
           return deferred.promise;
        };

        return service;
      })
      .config(function (fileSystemProvider, MyFileSystem, $rootScope) {
        // Set MyFileSystem as the filesystem to use
        fileSystemProvider.setFileSystemFactory(MyFileSystem);
        
        // In case you want to send notifications to the user
        // (for instance, that he must login to save).
        // The expires flags means whether
        // it should be hidden after a period of time or the
        // user should dismiss it manually.
        $rootScope.$broadcast('event:notification',
          {message: 'File saved.', expires: true});

      });
    </script>
    <style>
      html,
      body {
        height: 100%;
      }
    </style>
  </body>
</html>

Contribution

If you want to contribute to this project, please read our contribution guide first.

License

Copyright 2013 MuleSoft, Inc. Licensed under the Common Public Attribution License (CPAL), Version 1.0

api-designer's People

Contributors

agustinlg avatar alejofernandez avatar aminix avatar blai avatar blakeembrey avatar clarkcutler avatar comptly avatar gitter-badger avatar ivolazy avatar jcalabrese avatar jcenturion avatar jisoldi avatar juancoen avatar llattes avatar nanovazquez avatar noambenami avatar pennycoders avatar pose avatar rlugojr avatar rodrigoi avatar sichvoge avatar tokafish avatar viceversus avatar xaka avatar

Watchers

 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.