# README
uptimerobotapi

A Go client for UptimeRobot API.
Usage
See the full API reference on Go.dev.
Client initialization
All API requests are made through uptimerobotapi.Client
. Make sure to include an API token:
package main
import (
"os"
"github.com/exileed/uptimerobotapi"
)
func main() {
client := uptimerobotapi.NewClient(os.Getenv("UPTIMEROBOT_API_TOKEN"))
...
}
Making API requests
Use an initialized client to make API requests:
package main
import (
"os"
"github.com/exileed/uptimerobotapi"
)
func main() {
client := uptimerobotapi.NewClient(os.Getenv("UPTIMEROBOT_API_TOKEN"))
accounts, err := client.Account.GetAccountDetails()
if err != nil {
panic(err)
}
...
}
API Error Responses
For cases where your request results in an error from the API, you can use the
errors.As()
function from the standard library to extract the
uptimerobotapi.APIError
error value and inspect more details about the error,
including the HTTP response code and UptimeRobot API Error Code.
package main
import (
"fmt"
"github.com/exileed/uptimerobotapi"
)
func main() {
client := uptimerobotapi.NewClient("")
account, err := client.Account.GetAccountDetails()
var apiErr uptimerobotapi.APIError
if errors.As(err, &apiErr){
if apiErr.RateLimited() {
fmt.Println("rate limited")
return
}
fmt.Println("unknown status code:", apiErr.StatusCode)
}
panic(err)
}
fmt.Println(account)
}
# Functions
NewClient returns a new UptimeRobot API client.
NewClientWithConfig returns a new UptimeRobot API client.
# Structs
Account returns basic information for the account making the API request,.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
APIError represents the error response received when an API call fails.
APIResponse is a response from the Uptime robot API.
A Client manages communication with the UptimeRobot API.
ClientConfig specifies configuration with which to initialize a UptimeRobot API client.
DeleteAlertContactWrapper are wrapper for DeleteAlertContact.
No description provided by the author
No description provided by the author
EditAlertContactParams are parameters for EditAlertContact.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
GetAlertContactsParams are parameters for GetAlertContacts.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
NewAlertContactParams are parameters for NewAlertContact.
No description provided by the author
No description provided by the author
Object contains the common fields of every resource in the UptimeRobot API.
No description provided by the author