Skip to content
Translate a name written in English to Klingon and find out its species
Go
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
stapi
translate
.gitignore
.travis.yml
CODE_OF_CONDUCT.md
CONTRIBUTING.md
LICENSE
README.md
main.go

README.md

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

You can’t perform that action at this time.