Beta Golang client library for the Context.IO Lite Email API
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Context.IO API Golang Library

This library is currently in BETA, and as such we make no promises; the use of this library is provided without warranty.


# For the LITE api
go get

CIO Lite Usage

package main

import (

func main() {
	// Key and Secret
	cioKey := os.Getenv("CONTEXTIO_API_KEY")
	cioSecret := os.Getenv("CONTEXTIO_API_SECRET")

	// Client Instance
	cioLiteClient := ciolite.NewCioLite(cioKey, cioSecret)
	// Can also use with a standard or custom logger:
	// ciolite.NewCioLiteWithLogger(cioKey, cioSecret, logrus.StandardLogger())

	// Discovery Call Parameters
	discoveryParams := ciolite.GetDiscoveryParams{Email: ""}

	// Actual Discovery Call
	discoveryResp, err := cioLiteClient.GetDiscovery(discoveryParams)
	if err != nil {
		log.Fatal("Error calling ContextIO: " + err.Error())

	// Responses are simple structs, all fields accessible. The following line prints:
	// { Type:gmail Documentation:[] Found:true
	// IMAP:{ UseSSL:true OAuth:true Port:993}}
	fmt.Printf("%+v", discoveryResp)

	// Get a slice of users
	users, _ := cioLiteClient.GetUsers(ciolite.GetUsersParams{})

	// Get a slice of emails in the Inbox of the first users's first email account


A testing interface/mock is provided via GoMock, and can be used in tests like so:

// mock cio
mockCtrl := gomock.NewController(t)
defer mockCtrl.Finish()
cioMock := ciolite.NewMockInterface(mockCtrl)

// mock discovery
discoveryReq := ciolite.GetDiscoveryParams{Email: ""}
discoveryRes := ciolite.GetDiscoveryResponse{
	Found: true,
	Type:  "gmail",
	IMAP: ciolite.GetDiscoveryIMAPResponse{
		Username: "",
		Server:   "",
		Port:     993,
		UseSSL:   true,
		OAuth:    true,

cioMock.EXPECT().GetDiscovery(discoveryReq).Return(discoveryRes, nil)

// use this mock in a test somewhere


If you want to open an issue or PR for this library - go ahead! We'd love to hear your feedback.

For API support please consult our support site and feel free to drop a line to