Coder Social home page Coder Social logo

luiscib3r / retrofit_cli Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 0.0 37 KB

Dart Retrofit API Generator

Home Page: https://pub.dev/packages/retrofit_cli

License: MIT License

Dart 98.29% Makefile 1.71%
cli command-line dart mustache bricks dart-package flutter mason retrofit api-rest

retrofit_cli's Introduction

retrofit_cli

Dart Retrofit API Generator (๐Ÿšง under construction ๐Ÿšง)

Install

dart pub global activate retrofit_cli

Install from source

dart pub global activate --source=git https://github.com/luiscib3r/retrofit_cli.git

or

git clone https://github.com/luiscib3r/retrofit_cli.git
cd retrofit_cli
make install

Usage

1. Define your api using a yaml file

Example of api.yaml

name: Todos
endpoints:
  - name: getTodos
    method: GET
    url: /todos
    params:
      - name: String
      - description: String
      - count: int
    response: |
      [
        {
          "id": "idstring",
          "name": "todo name",
          "description": "todo description",
          "price": 2.5,
          "count": 3
        }
      ]
  - name: getTodo
    method: GET
    url: /todos/{id}
    paths:
      - id: String
    response: |
      {
        "id": "idstring",
        "name": "todo name",
        "description": "todo description",
        "price": 2.5,
        "count": 3
      }
  - name: saveTodo
    method: POST
    url: /todos
    headers:
      - Authorization
    payload: |
      {
        "name": "todo name",
        "description": "todo description"
      }
    response: |
      {
        "id": "idstring",
        "name": "todo",
        "description": "desc1",
        "price": 0.0,
        "count": 0
      }
  - name: updateTodo
    method: PUT
    url: /todos/{id}
    headers:
      - Authorization
    paths:
      - id: String
    payload: |
      {
        "name": "new todo name",
        "description": "new todo description"
      }
    response: |
      {
        "id": "idstring",
        "name": "new todo name",
        "description": "new todo description"
      }
  - name: deleteTodo
    method: DELETE
    url: /todos/{id}
    headers:
      - Authorization
    paths:
      - id: String
    response: |
      {}

2. Generate api package using retrofit_cli

Default

retrofit_cli api

Set output package folder (default is api)

retrofit_cli api -o api_package_name

Set input .yaml file (default is api.yaml)

retrofit_cli api -o api_package_name -i my_api.yaml

retrofit_cli's People

Contributors

luiscib3r avatar

Stargazers

 avatar  avatar  avatar

Watchers

 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.