changed the way we handle custom types
This commit is contained in:
parent
deacfad22d
commit
7690f83101
10
client.go
10
client.go
@ -14,9 +14,12 @@ import (
|
|||||||
"github.com/netbox-community/go-netbox/v3/netbox/client"
|
"github.com/netbox-community/go-netbox/v3/netbox/client"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NetBoxAPI is the type we use to add custom functions
|
// Client is the type we use to add custom functions
|
||||||
|
type Client client.NetBoxAPI
|
||||||
|
|
||||||
|
// NetBoxAPI is the struct we use to glue everything together
|
||||||
type NetBoxAPI struct {
|
type NetBoxAPI struct {
|
||||||
api client.NetBoxAPI
|
api Client
|
||||||
Token string
|
Token string
|
||||||
URL string
|
URL string
|
||||||
}
|
}
|
||||||
@ -43,8 +46,9 @@ func NewNetBoxClient(token string, url string) (NetBoxAPI, error) {
|
|||||||
n := client.New(t, nil)
|
n := client.New(t, nil)
|
||||||
|
|
||||||
// create a new variable for our custom functions
|
// create a new variable for our custom functions
|
||||||
|
api := Client(*n)
|
||||||
nb := NetBoxAPI{
|
nb := NetBoxAPI{
|
||||||
api: *n,
|
api: api,
|
||||||
Token: token,
|
Token: token,
|
||||||
URL: url,
|
URL: url,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user