This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct TodoProperties { | |
title string | |
completed bool | |
} | |
struct Todo extends TodoProperties { | |
id int | |
} | |
interface TodoManager { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl --data-urlencode \ | |
idl@todo_manager.idl \ | |
http://barrister.bitmechanic.com/run > todo_manager.json |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
barrister -j todo_manager.json todo_manager.idl |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Client sends invalid parameters to server | |
require 'barrister' | |
trans = Barrister::HttpTransport.new("http://localhost:3000/v1/todos") | |
client = Barrister::Client.new(trans) | |
client.TodoManager.deleteTodo(45) # valid (45 is an int) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface TodoManager { | |
// returns all Todos | |
readTodos() []Todo | |
// creates new Todo and returns it with an id | |
createTodo(todo TodoProperties) Todo | |
// updates Todo and returns it | |
updateTodo(todo Todo) Todo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import barrister | |
from bottle import run, post, request | |
from store import Store | |
from functools import wraps | |
import sys | |
class TodoManager: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"jsonrpc":"2.0", | |
"id":"bv0D1yRJhkABZ3fx8ofU", | |
"method":"TodoManager.createTodo", | |
"params":[ | |
{ | |
"title":"Call Dad", | |
"completed":false | |
} | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
t "./todos" | |
"fmt" | |
"github.com/coopernurse/barrister-go" | |
"net/http" | |
) | |
type TodoManagerImpl struct { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require('express') | |
, fs = require('fs') | |
, http = require('http') | |
, path = require('path') | |
, barrister = require('barrister') | |
, store = require("./store").store | |
, idl = JSON.parse(fs.readFileSync("../todo_manager.v1.json").toString()); | |
var app = express(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import barrister | |
from bottle import run, post, request | |
from store import Store | |
from functools import wraps | |
import sys | |
class TodoManager(object): |