API

A simple one-liner:

    $ curl "http://thriftify.org/api/v1/generate?gen=java" -d "thriftcontent=struct A{}" > java.zip
  

A complete example:

    # Create a simple thrift file
    $ echo struct A {} > file.thrift
    # Generate the thrift bindings using thriftify
    $ curl "http://thriftify.org/api/v1/generate?gen=java" -F "file1=@file.thrift" > java.zip
    # Validate, read the code
    $ unzip -c java.zip
  

Parameters

name value comments
&thriftversion Generate a binding based on specific Thrift compiler version Optional. If not provided it will use version 0.9.1
0.9.1
1.0.0-dev
0.9.0
0.8.0
&url url to download the thrift file from Optional. If not provided then the thrift file must be posted with the request
&download_zip off to get a json
Exclude or set to on to get a zip
Optional. equals to off then a json response with the files is returned. If missing or set to anything else then a zip file is returned
&thriftcontent thrift code. Optional. This is the thrift code to compile.
Example: curl "http://thriftify.org/api/v1/generate?gen=java" -d "thriftcontent=struct A{}" > java.zip
If missing then you have to provide a file upload (use curl "http://thriftify.org/api/v1/generate?gen=java" -F "file1=@file.thrift" > java.zip)
&gen Output bindings language See examples and possible valuesbelow
as3 ActionScript 3
as3:bindable ActionScript 3: Add [bindable] metadata to all the struct classes.
c_glib C, using GLib
cocoa Cocoa
cocoa:log_unexpected Cocoa: Log every time an unexpected field ID or type is encountered.
cpp C++
cpp:templates C++: Generate templatized reader/writer methods.
cpp:purse_enums C++: Generate pure enums instead of wrapper classes.
cpp:dense C++: Generate type specifications for the dense protocol.
cpp:include_prefix C++: Use full include paths in generated files.
cpp:no_client_completion C++: Omit calls to completion__() in CobClient class.
cpp:cob_style C++: Generate "Continuation OBject"-style classes.
csharp C#
csharp:async C#: Adds Async CTP support.
csharp:wcf C#: Adds bindings for WCF to generated classes.
d D
delphi Delphi
delphi:ansistr_binary Delphi: Use AnsiString as binary properties.
erl Erlang
go Go
hs Haskell
html HTML
java Java
java:java5 Java: Generate Java 1.5 compliant code (includes android_legacy flag).
java:nocamel Java: Do not use CamelCase field accessors with beans
java:hashcode Java: Generate quality hashCode methods.
java:private-members Java: Members will be private, but setter methods will return 'this' like usual.
java:android_legacy Java: Do not use java.io.IOException(throwable) (available for Android 2.3 and above).
java:beans Java: Members will be private, and setter methods will return void.
javame Java ME
js Javascript
js:jquery Javascript: Generate jQuery compatible code.
js:node Javascript: Generate node.js compatible code.
ocaml OCaml
perl Perl
php PHP
php:namespace PHP: Generate PHP namespaces as defined in PHP >= 5.3
php:autoload PHP: Generate PHP with autoload
php:rest PHP: Generate PHP REST processors
php:server PHP: Generate PHP server stubs
php:oop PHP: Generate PHP with object oriented subclasses
php:inlined PHP: Generate PHP inlined files
py Python
py:slots Python: Generate code using slots for instance members.
py:dynbase=(.*) Python: Derive generated classes from class CLS instead of TBase.
py:new_style Python: Generate new-style classes.
py:dynimport='(.*)' Python: Add an import line to generated code to find the dynbase class.
py:dynexc=(.*) Python: Derive generated exceptions from CLS instead of TExceptionBase.
py:utf8strings Python: Encode/decode strings using utf8 in the generated code.
py:dynamic Python: Generate dynamic code, less code generated but slower.
py:twisted Python: Generate Twisted-friendly RPC services.
rb Ruby
rb:rubygems Ruby: Add a "require 'rubygems'" line to the top of each generated file.
st Smalltalk
xsd XML Schema (XSD)

Real Time Web Analytics