mohamedattahri / enigma

A simple Go client for the Enigma.io API

Home Page:http://godoc.org/github.com/mohamedattahri/enigma

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Enigma Build Status GoDoc

Enigma.io lets you quickly search and analyze billions of public records published by governments, companies and organizations.

Enigma is a simple go client for the enigma.io API.

Documentation

Full documentation and examples are available in the godoc package index GoDoc

Examples

Client

package main

import (
	enigma "github.com/mohamedattahri/enigma"
)

func main() {
	client := enigma.NewClient("some_api_key")
}

Metadata

Parent

response, err := client.Meta().Parent("us.gov.whitehouse")
if err != nil {
	fmt.Println(err)
	return
}
fmt.Println(response.Info.ChildrenTablesTotal)

Table

response, err := client.Meta().Table("us.gov.whitehouse.visitor-list")
if err != nil {
	fmt.Println(err)
	return
}
fmt.Println(response.Result.DbBoundaryLabel)

Data

response, err := client.Data("us.gov.whitehouse.visitor-list").Select("namefull", "appt_made_date").Sort("namefirst", enigma.Desc).Results()
if err != nil {
	fmt.Println(err)
	return
}
fmt.Println(string(response.Result))

Stats

response, err := client.Stats("us.gov.whitehouse.visitor-list", "total_people").Operation(enigma.Sum).Results()
if err != nil {
	fmt.Println(err)
	return
}

var obj map[string]string
json.Unmarshal(response.Result, &obj)
fmt.Println(obj["sum"])

Export

url, err := client.Export("us.gov.whitehouse.visitor-list").FileURL(nil)
if err != nil {
	fmt.Println(err)
	return
}
fmt.Println(url)

TODO:

More tests.

About

A simple Go client for the Enigma.io API

http://godoc.org/github.com/mohamedattahri/enigma

License:MIT License


Languages

Language:Go 100.0%