go get github.com/jjideenschmiede/goerecht24
Here you will find all the functions for the clients.
If you want to read all clients of a token, you can do this with the following function. You can find the corresponding documentation here.
// Define request
r := goerecht24.Request{
ApiKey: "",
}
// List registered clients
clients, err := goerecht24.ListRegisteredClients(r)
if err != nil {
fmt.Println(err)
} else {
fmt.Println(clients)
}
If you want to create a new client, you can do this with the following function. You can find the corresponding documentation here.
// Define request
r := goerecht24.Request{
ApiKey: "",
}
// Define body
body := goerecht24.ClientBody{
ClientId: 0,
PushMethod: "GET",
PushUri: "https://domain.com/restapi/push-endpoint",
Cms: "WordPress",
CmsVersion: "5.0.3",
PluginName: "eRecht24.de Rechtstexte für WordPress",
AuthorMail: "info@jj-ideenschmiede.de",
}
// Register a new client
registerClient, err := goerecht24.RegisterClient(body, r)
if err != nil {
fmt.Println(err)
} else {
fmt.Println(registerClient)
}
If you want to update a registered client, you can do this with the following function. You can find the corresponding documentation here.
// Define request
r := goerecht24.Request{
ApiKey: "",
}
// Define body
body := goerecht24.ClientBody{
ClientId: 17828,
PushMethod: "GET",
PushUri: "https://domain2.com/restapi/push-endpoint",
Cms: "WordPress",
CmsVersion: "5.0.3",
PluginName: "eRecht24.de Rechtstexte für WordPress",
AuthorMail: "info@jj-ideenschmiede.de",
}
// Update a registered client
updateRegisteredClient, err := goerecht24.UpdateRegisteredClient(body, r)
if err != nil {
fmt.Println(err)
} else {
fmt.Println(updateRegisteredClient)
}
If you want to delete a registered client, you can do this with the following function. You can find the corresponding documentation here.
// Define request
r := goerecht24.Request{
ApiKey: "",
}
// Delete a registered client
deleteClient, err := DeleteClient(17828, r)
if err != nil {
fmt.Println(err)
} else {
fmt.Println(deleteClient)
}
If you want to send a test notification, you can do so using the following function.
Select which type of push notification you want to receive for testing.
Available values : ping, message, imprint, privacyPolicy, privacyPolicySocialMedia
You can find the corresponding documentation here.
// Define request
r := goerecht24.Request{
ApiKey: "",
}
// Send a test push
err := goerecht24.TestPush(17828, "ping", r)
if err != nil {
fmt.Println(err)
}
Here you will find all the information on how to extract the documents from the api.
If you want to read the imprint, you can do this with the following function. You can find the corresponding documentation here.
// Define request
r := goerecht24.Request{
ApiKey: "",
}
// Get imprint
imprint, err := goerecht24.ShowImprint(r)
if err != nil {
fmt.Println(err)
} else {
fmt.Println(imprint)
}
If you want to read the privacy policy from eRecht24, you can do this with the following function. You can find the corresponding documentation here.
// Define request
r := goerecht24.Request{
ApiKey: "",
}
// Get privacy policy
privacyPolicy, err := goerecht24.ShowPrivacyPolicy(r)
if err != nil {
fmt.Println(err)
} else {
fmt.Println(privacyPolicy)
}
If you want to read the privacy policy social media, you can do this with the following function. You can find the corresponding documentation here.
// Define request
r := goerecht24.Request{
ApiKey: "",
}
// Get privacy policy social media
privacyPolicySocialMedia, err := goerecht24.ShowPrivacyPolicySocialMedia(r)
if err != nil {
fmt.Println(err)
} else {
fmt.Println(privacyPolicySocialMedia)
}
Please only call this endpoint after receiving a push notification indicating to fetch a message.
To retrieve a message, you can use the following function. You can find the corresponding documentation here.
// Define request
r := goerecht24.Request{
ApiKey: "",
}
// Fetch message from eRecht24
message, err := goerecht24.FetchMessage(r)
if err != nil {
fmt.Println(err)
} else {
fmt.Println(message)
}
This endpoint will send a push notification to all clients, which are registered for this api key.
If you want to push a type, you can do so via this function. Select, which type of document you want to push.
Available values : imprint, privacyPolicy, privacyPolicySocialMedia, all
You can find the corresponding documentation here.
// Define request
r := goerecht24.Request{
ApiKey: "",
}
// Delete a registered client
err := goerecht24.SendPushNotification("all", r)
if err != nil {
fmt.Println(err)
}