Git Product home page Git Product logo

kbcli's Introduction

Kill Bill go client library and kill bill command line

This repository contains killbill go client library (kbclient) and killbill command line tool (kbcmd)

Kill bill go client library

Kill bill go client library is a go package that can be used to connect to kill bill.

Install

go get -u github.com/killbill/kbcli

Creating new client

    trp := httptransport.New("127.0.0.1:8080", "", nil)
    // Add text/xml producer which is not handled by openapi runtime.
    trp.Producers["text/xml"] = runtime.TextProducer()
    // Set this to true to dump http messages
    trp.Debug = false
    // Authentication
    authWriter := runtime.ClientAuthInfoWriterFunc(func(r runtime.ClientRequest, _ strfmt.Registry) error {
        encoded := base64.StdEncoding.EncodeToString([]byte("admin"/*username*/ + ":" + "password" /**password*/))
        if err := r.SetHeaderParam("Authorization", "Basic "+encoded); err != nil {
            return err
        }
        if err := r.SetHeaderParam("X-KillBill-ApiKey", apiKey); err != nil {
            return err
        }
        if err := r.SetHeaderParam("X-KillBill-ApiSecret", apiSecret); err != nil {
            return err
        }
        return nil
    })
    client := kbclient.New(trp, strfmt.Default, authWriter, kbclient.KillbillDefaults{})

Look at the complete example here. For more examples, look at kbcmd tool.

Client code generation

This client code was generated by the go-swagger tool. We use modified template to generate the client, and the sources are here.

To generate,

# Update swagger.json
curl http://localhost:8080/swagger.json | jq "." >swagger.json

# Install swagger tool
go get github.com/go-swagger/go-swagger
go install github.com/go-swagger/go-swagger/cmd/swagger

# Regenerate the tool
swagger generate client -f swagger.json -m kbmodel -c kbclient --default-scheme=http

Generating dev extensions

We also have dev extension APIs (like clock etc), that are in swagger-dev.json. To generate, run the following.

# Regenerate the tool
swagger generate client -f swagger-dev.json -m kbmodel -c kbclient --default-scheme=http

# Delete the client file.
rm kbclient/kill_bill_dev_client.go

Kill bill command line tool (kbcmd)

kbcmd is a command line tool that uses the go client library. This tool can do many of the kill bill operations. More details are available here in README.

kbcli's People

Contributors

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