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 | |
| require 'forwardable' | |
| require 'barrister' | |
| require 'sinatra' | |
| require './store.rb' | |
| class TodoManager | |
| def initialize(store) | |
| @store = store |
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 | |
| require 'barrister' | |
| trans = Barrister::HttpTransport.new("http://localhost:3000/v1/todos") | |
| client = Barrister::Client.new(trans) | |
| begin | |
| result = client.TodoManager.createTodo({ 'title' => 'Call Mom', 'completed' => false }) | |
| puts result |
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 | |
| trans = barrister.HttpTransport("http://localhost:3000/v1/todos") | |
| client = barrister.Client(trans) | |
| try: | |
| result = client.TodoManager.createTodo({ "title" : "Call Mom", "completed" : False }) | |
| print result | |
| except barrister.RpcException as e: |
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 php | |
| <?php | |
| include_once("./lib/barrister.php"); | |
| $barrister = new Barrister(); | |
| $client = $barrister->httpClient("http://localhost:3000/v1/todos"); | |
| $proxy = $client->proxy("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
| #!/usr/bin/env php | |
| <?php | |
| include_once("./lib/barrister.php"); | |
| $barrister = new Barrister(); | |
| $client = $barrister->httpClient("http://localhost:3000/v1/todos"); | |
| $proxy = $client->proxy("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
| #!/usr/bin/env php | |
| <?php | |
| include_once("./lib/barrister.php"); | |
| $barrister = new Barrister(); | |
| $client = $barrister->httpClient("http://localhost:3000/v1/todos"); | |
| $proxy = $client->proxy("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
| #!/usr/bin/env node | |
| var barrister = require('barrister'); | |
| var client = barrister.httpClient('http://localhost:3000/v1/todos'); | |
| client.loadContract(function(err) { | |
| var proxy = client.proxy('TodoManager'); | |
| var properties = { 'title' : 'Call Dad', 'completed' : false }; | |
| proxy.createTodo(properties, function(err, result) { |
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 client = Barrister.httpClient("/v1/todos"); | |
| client.loadContract(function() { | |
| var proxy = client.proxy('TodoManager'); | |
| var properties = { 'title' : 'Call Dad', 'completed' : false }; | |
| proxy.createTodo(properties, function(err, result) { | |
| if (err) { | |
| console.log(JSON.stringify(err)); | |
| } |
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 ( | |
| "fmt" | |
| "github.com/coopernurse/barrister-go" | |
| "todo_manager" | |
| ) | |
| func NewTodoManagerProxy(url string) todo_manager.TodoManager { | |
| trans := &barrister.HttpTransport{Url: url} |
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 client = Barrister.httpClient("/v1/todos"); | |
| client.loadContract(function() { | |
| var batch = client.startBatch(); | |
| var batchTodoManager = batch.proxy('TodoManager'); | |
| batchTodoManager.createTodo({ 'title' : 'Call Mom', 'completed' : false }) | |
| batchTodoManager.createTodo({ 'title' : 'Call Dad', 'completed' : false }) | |
| batchTodoManager.createTodo({ 'title' : 'Wash car', 'completed' : false }) | |
| batchTodoManager.createTodo({ 'title' : 'Eat Ham', 'completed' : false }) |