Code Monkey home page Code Monkey logo

cvtool-cli-api's Introduction

Swagger generated server

Overview

This server was generated by the swagger-codegen project. By using the OpenAPI-Spec from a remote server, you can easily generate a server stub. This is an example of building a swagger-enabled Flask server.

This example uses the Connexion library on top of Flask.

Requirements

Python 3.5.2+

Usage

To run the server, please execute the following from the root directory:

pip3 install -r requirements.txt
python3 -m kingpick

and open your browser to here:

http://localhost:8080/v1/ui/

Your Swagger definition lives here:

http://localhost:8080/v1/swagger.json

To launch the integration tests, use tox:

sudo pip install tox
tox

Running with Docker

To run the server on a Docker container, please execute the following from the root directory:

# building the image
docker build -t kingpick .

# starting up a container
docker run -p 8080:8080 kingpick

Running with docker-compose

 export GCP_PROJECT_ID=proj && docker-compose up

Tenants

# new tenant
curl -X POST localhost:5000/v1/tenants -H "Content-Type:application/json" -d '{ 
    "id":"acme", 
    "name":"Acme Inc.", 
    "description":"The supper acme tenant", 
    "settings": { 
        "sourceBucket":"buck1", 
        "targetBucket":"targBuck2",
        "serviceAccountCredentials": "asdfasfasdfdasfdasfdasfdasf"
    } 
}'

# get tenant by id
curl localhost:8081/v1/tenants/acme

# get all tenants
curl localhost:8081/v1/tenants

# create project
curl -X POST localhost:5000/v1/projects?tenant_id=acme -H "Content-Type:application/json" -d '{ 
    "id":"project-x", 
    "name":"Project X", 
    "description":"The supper project-x",         
    "settings": { 
        "prop1":"value1", 
        "prop2":"v2" 
    } 
}'

# create image hash
curl -X POST "localhost:8082/v1/image-hashes?tenant_id=acme&project_id=project-x" -H "Content-Type:application/json" -d '{ 
    "filepath":"project-x", 
    "url":"https://lh3.googleusercontent.com/P1-JR5ZNo5TBo3ZlwFR-WsgxFZn6UiLlaRdzSlJuvah5PpcyOKOR8QgZlx6xRRMH7jMVFcH-IdLpQ0EQ5rk50GY=s0"
}'

curl -X POST "localhost:8082/v1/image-hashes/search?tenant_id=acme&project_id=project-x" -H "Content-Type:application/json" -d '{ 
    "url":"https://lh3.googleusercontent.com/P1-JR5ZNo5TBo3ZlwFR-WsgxFZn6UiLlaRdzSlJuvah5PpcyOKOR8QgZlx6xRRMH7jMVFcH-IdLpQ0EQ5rk50GY=s0"
}'

curl -X POST "localhost:8082/v1/image-hashes/search?tenant_id=acme&project_id=project-x" -H "Content-Type:application/json" -d '{
    "url":"https://lh3.googleusercontent.com/P1-JR5ZNo5TBo3ZlwFR-WsgxFZn6UiLlaRdzSlJuvah5PpcyOKOR8QgZlx6xRRMH7jMVFcH-IdLpQ0EQ5rk50GY=s0-fv",
    "all_orientations": true
}'

curl -X POST "localhost:8082/v1/image-hashes/search?tenant_id=acme&project_id=project-x" -H "Content-Type:application/json" -d '{
    "url":"https://lh3.googleusercontent.com/P1-JR5ZNo5TBo3ZlwFR-WsgxFZn6UiLlaRdzSlJuvah5PpcyOKOR8QgZlx6xRRMH7jMVFcH-IdLpQ0EQ5rk50GY=s0-r90",
    "all_orientations": true
}'

curl -X POST "localhost:5000/v1/jobs?tenant_id=acme&project_id=project-x" -H "Content-Type:application/json" -d '{
    "type": "csv",
    "auto_start": true
}'


curl -X POST "localhost:8082/v1/image-hashes/search?tenant_id=acme&project_id=project-x" -H "Content-Type:application/json" -d '{
    "url": "https://lh3.googleusercontent.com/P1-JR5ZNo5TBo3ZlwFR-WsgxFZn6UiLlaRdzSlJuvah5PpcyOKOR8QgZlx6xRRMH7jMVFcH-IdLpQ0EQ5rk50GY=c0xffff0000-b20-r90",
    "all_orientations": true
}'

https://lh3.googleusercontent.com/4NGm0B7yk0G40s01axI34vgfvbcd8zgYvzlfFuFDn8VepfLH8exethu5x_qTZEB4RlFObwbiF8ZH7DvW_3dLU70

https://lh3.googleusercontent.com/DB4KC-nkr7RfcrOBESe_miI-tSMNxZd1_OfrgR7fPZL8L-xQ4VD5iA8SejyZEUigqIEfJf_qSEkx_S6pT3UxlQ=w272-v1-e365


cvtool-cli-api's People

Contributors

dnicoletti avatar fabito avatar gabrielgbim avatar ltung-cit avatar tung-hl avatar

Watchers

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