go-klingon

command module
v0.0.0-...-6825f6c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2019 License: MIT Imports: 6 Imported by: 0

README

go-klingon

Translate a name written in English to Klingon and find out its species

Build Status Go Report Card License MIT

Note: The STAPI library does not have implementations of all STAPI REST resources[WIP]. PRs for new resources and endpoints are welcome, or you can simply implement some yourself as-you-go.

Use it as cli tool

go get github.com/MarinX/go-klingon

Usage:

Usage: ./go-klingon [OPTIONS] argument
  -apikey string
        stapi api key

Use it as a library

Translate
go get github.com/MarinX/go-klingon/translate

Example:

package main

import (
	"fmt"
	"github.com/MarinX/go-klingon/translate"
)

func main() {
    n := "Uhura"
    val, err := translate.New(n).Klingon()
	if err != nil {
        fmt.Println(err)
        return
    }
    fmt.Println("hex value:", val)
}
STAPI
go get github.com/MarinX/go-klingon/stapi

Example:

package main

import (
	"fmt"
	"github.com/MarinX/go-klingon/stapi"
)

func main() {
    client := stapi.New("", nil)
    ch, err :=client.Character.Search(struct{
        Name string `url:"name"`
    }{"uhura"})
    if err != nil {
        fmt.Println(err)
        return
    }
    fmt.Printf("%#v\n", ch)
}

Not all endpoints are implemented right now. In those case, you can use Get/Post method and point your model

path := "books"
resource := new(string)
options := struct {
    Name string `url:"name"`
}{"book1"}

err := client.Get(path, options, resource)
if err != nil {
	fmt.Println(err)
	return
}

Contributing

PR's are welcome. Please read CONTRIBUTING.md for more info

License

MIT

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL