https://github.com/thevxn/swis-nexus
minimal swis-api client/connector in Go
https://github.com/thevxn/swis-nexus
catware client connector driver golang
Last synced: 9 months ago
JSON representation
minimal swis-api client/connector in Go
- Host: GitHub
- URL: https://github.com/thevxn/swis-nexus
- Owner: thevxn
- License: mit
- Created: 2023-09-02T13:04:05.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2024-10-19T04:15:14.000Z (over 1 year ago)
- Last Synced: 2025-06-30T20:06:46.430Z (12 months ago)
- Topics: catware, client, connector, driver, golang
- Language: Go
- Homepage:
- Size: 750 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# swis-nexus
[](https://pkg.go.dev/go.vxn.dev/swis-nexus)
[](https://goreportcard.com/report/go.vxn.dev/swis-nexus)
A simple client/connector for [swis-api](https://github.com/thevxn/swis-api) RESTful JSON API.
A complete example implementation can be find in [cmd/swis-nexus/main.go](/cmd/swis-nexus/main.go) file.
### import a usage
```shell
go get go.vxn.dev/swis-nexus/pkg/nexus
```
```go
package main
import (
"fmt"
"go.vxn.dev/swis-nexus/pkg/nexus"
)
var (
client *nexus.Client
baseURL = "https://swapi.example.com"
token = "xxx"
verbose = true
)
func main() {
// Fetch a new nexus.Client instance.
client = nexus.NewClient(baseURL, token)
// Enable the verbose mode.
client.Verbose = true
// Compose a DTO-in object.
input := &nexus.Input{
Path: "/users",
Data: nil,
}
// Prepare a DTO-out object.
output := &nexus.Output{}
// Execute the API call.
if err := client.Get(input, output); err != nil {
fmt.Println(err)
}
// Print the response code and response message.
fmt.Printf("%4d: %s", output.Code, output.Message)
}
```