Coder Social home page Coder Social logo

go-rest-api's Introduction

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 := client.Balance()
if err != nil {
  // messagebird.ErrResponse means custom JSON errors.
  if err == messagebird.ErrResponse {
    for _, mbError := range balance.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.

License

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

go-rest-api's People

Contributors

azmb avatar cooldarkdryplace avatar dirk94 avatar dysosmus avatar polyfloyd avatar prep avatar qiekai avatar samwierema avatar timchunght avatar

Watchers

 avatar  avatar

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.