GithubHelp home page GithubHelp logo

updown's Introduction

Travis CI Software License GoDoc Coverage Status

Updown Go client

This is a Go client for updown.io. Updown lets you monitor websites and online services for an affordable price.

Installation

Once you have a working Go installation locally, you can grab this package with the following command:

go get github.com/antoineaugusti/updown

Documentation

Head over to the Go documentation to see available methods and models and to https://updown.io/api for the Updown API.

Creating a client

The client will be required to perform all actions against the API.

package main

import (
    "github.com/antoineaugusti/updown"
)

func main() {
    // Your API key can be retrieved at https://updown.io/settings/edit
    // You can give a custom HTTP client
    client := updown.NewClient("your-api-key", nil)
}

Listing all checks

result, HTTPResponse, err := client.Check.List()

Getting an Updown token for a check's alias

name := "Google"
token, err := client.Check.TokenForAlias(name)

This method returns results from a memory cache by default if it's available. The first time, a request against the API will be performed.

Getting a check by its token

token := "foo"
result, HTTPResponse, err := client.Check.Get(token)

Getting downtimes for a check

token, page := "foo", 1 // 100 results per page
result, HTTPResponse, err := client.Downtime.List(token, page)

Adding a new check

// See the struct for additional parameters
item := updown.CheckItem{URL: "https://google.fr"}
result, HTTPResponse, err := client.Check.Add(item)

Updating a check

token := "foo"
// See the struct for additional parameters
updated := updown.CheckItem{URL: "https://google.com"}
result, HTTPResponse, err := client.Check.Update(token, updated)

Removing a check

token := "foo"
result, HTTPResponse, err := client.Check.Remove(token)

Getting metrics for a check

token, group := "foo", "host"
from, to := "2016-04-01 00:00:00 +0200", "2016-04-15 00:00:00 +0200"
result, HTTPResponse, err := client.Metric.List(token, group, from, to)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.