Skip to content

denizkilic/go-rest-api

This branch is 164 commits behind messagebird/go-rest-api:master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

12d131c · Jan 30, 2019
Jul 27, 2018
Jul 31, 2018
Sep 10, 2018
Jul 27, 2018
Aug 27, 2018
Aug 20, 2018
Jul 27, 2018
Jan 22, 2019
Jan 29, 2019
Sep 18, 2018
Jul 16, 2018
Jul 27, 2018
Mar 5, 2018
Jan 6, 2015
Jul 20, 2018
Jul 31, 2018
Sep 28, 2018
Jul 16, 2018
Oct 29, 2017

Repository files navigation

MessageBird's REST API for Go

This repository contains the open source Go client for MessageBird's REST API. Documentation can be found at: https://developers.messagebird.com.

Build Status GoDoc

Requirements

  • Sign up for a free MessageBird account
  • Create a new access key in the developers sections
  • An application written in Go to make use of this API

Installation

The easiest way to use the MessageBird API in your Go project is to install it using go get:

$ go get github.com/messagebird/go-rest-api

Examples

Here is a quick example on how to get started. Assuming the go get installation worked, you can import the messagebird package like this:

import "github.com/messagebird/go-rest-api"

Then, create an instance of messagebird.Client:

client := messagebird.New("test_gshuPaZoeEG6ovbc8M79w0QyM")

Now you can query the API for information or send data. For example, if we want to request our balance information you'd do something like this:

// Request the balance information, returned as a Balance object.
balance, err := balance.Read(client)
if err != nil {
	switch errResp := err.(type) {
	case messagebird.ErrorResponse:
		for _, mbError := range errResp.Errors {
			fmt.Printf("Error: %#v\n", mbError)
		}
	}

	return
}

fmt.Println("  payment :", balance.Payment)
fmt.Println("  type    :", balance.Type)
fmt.Println("  amount  :", balance.Amount)

This will give you something like:

$ go run example.go
  payment : prepaid
  type    : credits
  amount  : 9

Please see the other examples for a complete overview of all the available API calls.

Documentation

Complete documentation, instructions, and examples are available at: https://developers.messagebird.com.

Upgrading

If you're upgrading from older versions, please read the Messagebird go-rest-api uprading guide.

License

The MessageBird REST Client for Go is licensed under The BSD 2-Clause License. Copyright (c) 2014, 2015, MessageBird

About

MessageBird's REST API for Go

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 100.0%