Skip to content

Commit

Permalink
Rename project to linodego
Browse files Browse the repository at this point in the history
  • Loading branch information
chiefy committed May 23, 2018
1 parent ff004bb commit 6226d3d
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 17 deletions.
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,10 @@ test/fixtures.yaml:
go run test/main.go
@sed -i "s/$(LINODE_TOKEN)/awesometokenawesometokenawesometoken/" $@

.PHONY: test
test: vendor test/fixtures.yaml
@go test

.PHONY: godoc
godoc:
@godoc -http=:6060
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# go-linode
# linodego

[![Build Status](https://travis-ci.org/chiefy/go-linode.svg?branch=master)](https://travis-ci.org/chiefy/go-linode)
[![Build Status](https://travis-ci.org/chiefy/linodego.svg?branch=master)](https://travis-ci.org/chiefy/linodego)

Go client for [Linode REST v4 API](https://developers.linode.com/v4/introduction)

## Installation

```
$ go get -u github.com/chiefy/go-linode
$ go get -u github.com/chiefy/linodego
```

## API Support
Expand All @@ -19,7 +19,7 @@ Check [API_SUPPORT.md](API_SUPPORT.md) for current support of the Linode `v4` AP

## Documentation

See [https://godoc.org/github.com/chiefy/go-linode](godoc.org) for a complete reference.
See [https://godoc.org/github.com/chiefylinodego](godoc.org) for a complete reference.

The API generally follows the naming patterns prescribed in the [https://developers.linode.com/api/v4](OpenAPIv3 document for Linode APIv4).

Expand All @@ -39,15 +39,15 @@ import (
"log"
"os"

golinode "github.com/chiefy/go-linode"
"github.com/chiefy/linodego"
)

func main() {
apiKey, ok := os.LookupEnv("LINODE_TOKEN")
if !ok {
log.Fatal("Could not find LINODE_TOKEN, please assert it is set.")
}
linodeClient, err := golinode.NewClient(apiKey)
linodeClient, err := linodego.NewClient(apiKey)
if err != nil {
log.Fatal(err)
}
Expand All @@ -65,7 +65,7 @@ func main() {
#### Auto-Pagination Requests

```go
kernels, err := golinode.ListKernels(nil)
kernels, err := linodego.ListKernels(nil)
// len(kernels) == 218
```

Expand All @@ -74,7 +74,7 @@ kernels, err := golinode.ListKernels(nil)
```go
opts := NewListOptions(2,"")
// or opts := ListOptions{PageOptions: &PageOptions: {Page: 2 }}
kernels, err := golinode.ListKernels(opts)
kernels, err := linodego.ListKernels(opts)
// len(kernels) == 100
// opts.Results == 218
```
Expand All @@ -84,14 +84,14 @@ kernels, err := golinode.ListKernels(opts)
```go
opts := ListOptions{Filter: "{\"mine\":true}"}
// or opts := NewListOptions(0, "{\"mine\":true}")
stackscripts, err := golinode.ListStackscripts(opts)
stackscripts, err := linodego.ListStackscripts(opts)
```

### Error Handling
#### Getting Single Entities

```go
linode, err := golinode.GetLinode(555) // any Linode ID that does not exist or is not yours
linode, err := linodego.GetLinode(555) // any Linode ID that does not exist or is not yours
// linode == nil: true
// err.Error() == "[404] Not Found"
// err.Code == "404"
Expand All @@ -103,15 +103,15 @@ linode, err := golinode.GetLinode(555) // any Linode ID that does not exist or i
For lists, the list is still returned as `[]`, but `err` works the same way as on the `Get` request.

```go
linodes, err := golinode.ListLinodes(NewListOptions(0, "{\"foo\":bar}"))
linodes, err := linodego.ListLinodes(NewListOptions(0, "{\"foo\":bar}"))
// linodes == []
// err.Error() == "[400] [X-Filter] Cannot filter on foo"
```

Otherwise sane requests beyond the last page do not trigger an error, just an empty result:

```go
linodes, err := golinode.ListLinodes(NewListOptions(9999, ""))
linodes, err := linodego.ListLinodes(NewListOptions(9999, ""))
// linodes == []
// err = nil
```
Expand All @@ -128,7 +128,7 @@ When performing a `POST` or `PUT` request, multiple field related errors will be

## Discussion / Help

Join us at [#go-linode](https://gophers.slack.com/messages/CAG93EB2S) on the [gophers slack](https://gophers.slack.com)
Join us at [#linodego](https://gophers.slack.com/messages/CAG93EB2S) on the [gophers slack](https://gophers.slack.com)

## License

Expand Down
2 changes: 1 addition & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const (
APIEnvVar = "LINODE_TOKEN"
)

var userAgent = fmt.Sprintf("go-linode %s https://github.com/chiefy/go-linode", Version)
var userAgent = fmt.Sprintf("linodego %s https://github.com/chiefy/linodego", Version)

// Client is a wrapper around the Resty client
type Client struct {
Expand Down
2 changes: 1 addition & 1 deletion example/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"log"
"strings"

golinode "github.com/chiefy/go-linode"
"github.com/chiefy/linodego"
)

func ExampleListTypes_all() {
Expand Down
2 changes: 1 addition & 1 deletion example/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"os"

golinode "github.com/chiefy/go-linode"
"github.com/chiefy/linodego"
)

var linodeClient = golinode.NewClient(nil, nil)
Expand Down
2 changes: 1 addition & 1 deletion test/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"os"
"strconv"

golinode "github.com/chiefy/go-linode"
"github.com/chiefy/linodego"
"github.com/dnaeon/go-vcr/recorder"
)

Expand Down

0 comments on commit 6226d3d

Please sign in to comment.