Giter Site home page Giter Site logo

burrito's Introduction


A simple, easy to use command line API wrapper generator, that will bundle up your favourite JSON APIs and create a C# project out of it, and will automagically generate classes for the data that is sent back from the API. The most basic command usage for Burrito is including a single source file, like below:

burrito -s schema.json

Burrito also supports asynchronous methods using Task, and can include POST, GET and other HTTP methods, with custom URL parameters that are automatically added to API methods.

Getting Started

To get started using Burrito on Windows, all you'll need is .NET Framework 4.7.1 or later, and you can download one of the prebuilt binaries from the Releases tab on the main repository page.

If you're using Linux, however, you'll have to build the project using Mono and mkbundle. Make sure you have the following dependencies installed as a nuget packages before attempting to build with mkbundle:

  • Newtonsoft.Json 12.0.0.0 (version specific)
  • Microsoft.CodeAnalysis.CSharp
  • ILRepack

Once this is done, you can use a simple mkbundle command such as the example below to create a native executable for your distro:

mkbundle -o burrito --simple bin/Debug/burrito.exe --machine-config /etc/mono/4.5/machine.config --no-config --nodeps bin/Debug/*.dll

Usage

Basics

To create an API wrapper with Burrito, you first need to write an API schema. These are extremely simple representations of the routes that you're trying to add to the wrapper. A barebones simple example is below:

{
	"name": "ExampleAPI",
	"root": "https://www.example.com/",
	"sections": [
		{
			"name": "API",
			"routes": [
				{
					"route": "test/",
					"type": "GET",
					"returns": "TestData"
				}
			]
		}
	]
}

There are many parts about each route that you can customize, which are defined in the API Schema wiki page, as well as the manual.

Once you've created your API schema, you can simply feed it into Burrito and it will generate an API wrapper project.

burrito -s example.json

There are many console flags that you can apply for different outputs of project, such as only creating a .dll and no project files, or generating both asynchronous and synchronous methods. Those are shown on the Command Line Arguments wiki page.

Examples

As an example of how to set up and use a Burrito API, see the "DnD5e-cs" project, set up as an example of how an API wrapper can be implemented for NuGet.

burrito's People

Contributors

c272 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.