Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 4 days 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 (about 1 year ago)
- Default Branch: master
- Last Pushed: 2024-10-19T04:15:14.000Z (29 days ago)
- Last Synced: 2024-11-10T05:25:31.743Z (7 days ago)
- Topics: catware, client, connector, driver, golang
- Language: Go
- Homepage:
- Size: 750 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# swis-nexus
[![Go Reference](https://pkg.go.dev/badge/go.vxn.dev/swis-nexus.svg)](https://pkg.go.dev/go.vxn.dev/swis-nexus)
[![Go Report Card](https://goreportcard.com/badge/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 mainimport (
"fmt""go.vxn.dev/swis-nexus/pkg/nexus"
)var (
client *nexus.ClientbaseURL = "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)
}
```