Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gotify/go-api-client
A generated swagger client for making requests to gotify/server.
https://github.com/gotify/go-api-client
client golang gotify swagger
Last synced: about 2 months ago
JSON representation
A generated swagger client for making requests to gotify/server.
- Host: GitHub
- URL: https://github.com/gotify/go-api-client
- Owner: gotify
- License: mit
- Created: 2018-11-19T20:23:31.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-05-20T19:19:08.000Z (over 4 years ago)
- Last Synced: 2024-06-19T19:31:21.530Z (7 months ago)
- Topics: client, golang, gotify, swagger
- Language: Go
- Homepage:
- Size: 71.3 KB
- Stars: 18
- Watchers: 5
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Gotify Golang API-Client [![travis-badge]][travis]
Generated with [swagger-go](https://github.com/go-swagger/go-swagger).
## Example
```go
package mainimport (
"log"
"net/http"
"net/url""github.com/gotify/go-api-client/v2/auth"
"github.com/gotify/go-api-client/v2/client/message"
"github.com/gotify/go-api-client/v2/gotify"
"github.com/gotify/go-api-client/v2/models"
)const (
gotifyURL = "https://push.gotify.url"
applicationToken = "AxNVvRfx9.ZKCTj"
)func main() {
myURL, _ := url.Parse(gotifyURL)
client := gotify.NewClient(myURL, &http.Client{})
versionResponse, err := client.Version.GetVersion(nil)if err != nil {
log.Fatal("Could not request version ", err)
return
}
version := versionResponse.Payload
log.Println("Found version", *version)params := message.NewCreateMessageParams()
params.Body = &models.MessageExternal{
Title: "my title",
Message: "my message",
Priority: 5,
}
_, err = client.Message.CreateMessage(params, auth.TokenAuth(applicationToken))if err != nil {
log.Fatalf("Could not send message %v", err)
return
}
log.Println("Message Sent!")
}
```## Update Instructions
* Change version in [Makefile](Makefile).
* Run `make clean generate`
* Commit changes[travis]: https://travis-ci.org/gotify/go-api-client
[travis-badge]: https://travis-ci.org/gotify/go-api-client.svg?branch=master