angel

package module
v0.0.0-...-7dcf5c8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 15, 2013 License: MIT Imports: 9 Imported by: 0

README

GoAngel
=========

GoAngel is a simple Go client library for interfacing with the AngelList API. The results of API queries are deserialized into static structs for convenience, so that a successful API call should yield a predictable, known type with no need for type assertions.


The current release implements most endpoints, though it is not yet complete.


Installation
-------------

````
    > go get github.com/ChimeraCoder/goangel
````

Authentication
---------


````go

c := new(angel.AngelClient)
c.Client_id = "your-angel-client-id"
c.Client_secret = "your-angel-client-secret"

//You can now perform unauthenticated queries against the AngelList APi
//To perform authenticated queries (which includes any PUT/POST/DELETE queries)
//you need an access token

url := c.AuthorizeUri()

//Redirect users to url, and record the code sent in the callback

result, err := c.RequestAccessToken(code)

//You can now perform authenticated queries against the AngelList API

````




License
--------

GoAngel is free software released under the MIT license.

Documentation

Overview

Package angel provides functions for interacting with the AngelList API

Index

Constants

View Source
const (
	UserId    = iota
	StartupId = iota
)
View Source
const (
	GET    = iota
	HEAD   = iota
	POST   = iota
	PUT    = iota
	DELETE = iota
)
View Source
const (
	DIRECTION_INCOMING = iota
	DIRECTION_OUTGOING = iota
)
View Source
const (
	DESC       = iota
	ASC        = iota
	POPULARITY = iota
)
View Source
const API_BASE = "https://api.angel.co/1"

Variables

View Source
var SECONDS_PER_QUERY = time.Duration(10 * time.Second)

SECONDS_PER_QUERY sets the number of seconds that must elapse between queries By default, execute at most one query every ten seconds Set to 0 to turn off throttling

Functions

func GetQuery

func GetQuery(endpoint_path string, keyVals map[string]string) ([]byte, error)

GetQuery issues a GET request to the specified endpoint

func PostQuery

func PostQuery(endpoint_path string, keyVals map[string]string) ([]byte, error)

PostQuery issues a POST request to the specified endpoint

func Query

func Query(endpoint_path string, method int, keyVals map[string]string) (bts []byte, err error)

Query issues a query to the AngelList API Like GetQuery and PostQuery, this function exists for the convenience of the automatically-throttled queries

func QueryUsersBatch

func QueryUsersBatch(ids ...int64) (results interface{}, err error)

QueryUsersBatch queries /users/batch for up to 50 users at a time, given a comma-separated list of IDs

Types

type AngelClient

type AngelClient struct {
	Client_id     string
	Client_secret string
	Access_token  string
}

func (AngelClient) AuthorizeUri

func (c AngelClient) AuthorizeUri() string

AuthorizeUri generates a URI which users should be redirected to in order to authorize the application

func (AngelClient) Follow

func (c AngelClient) Follow(id int64, id_type int) (result interface{}, err error)

Follow issues a POST query to /follows to follow the user/startup with the specified id Will throw an error (400) if the client's user is already following the specified user/startup

func (AngelClient) GetUsersId

func (c AngelClient) GetUsersId(id int64, details string) (user AngelUser, err error)

GetUsersId implements /users/:id

func (AngelClient) QueryFollowsBatch

func (c AngelClient) QueryFollowsBatch(ids ...int64) (results interface{}, err error)

QueryFollowsBatch queries follows/batch for the followers of several users Returns the follower and followed information

func (AngelClient) QueryStartupIdRoles

func (c AngelClient) QueryStartupIdRoles(id int64, direction int) (startuproles []StartupRole, err error)

QueryStartupIdRoles queries /startups/:id/roles

func (AngelClient) QueryStartupRoles

func (c AngelClient) QueryStartupRoles(id int64, id_type int, v map[string]string) (startuproles []StartupRole, err error)

QueryStartupRoles queries the /startup_roles&v=1 endpoint for all startup roles associated with the user with the given id

func (AngelClient) QueryStartupRolesDeprecated

func (c AngelClient) QueryStartupRolesDeprecated(id int64, id_type int) (startuproles []StartupRole, err error)

QueryStartupRoles queries the now-deprecated /startup_roles for all startup roles associated with the user with the given id

func (AngelClient) QueryStartupsBatch

func (c AngelClient) QueryStartupsBatch(ids ...int64) (startups []Startup, err error)

Query /startups/batch for the followers of several users

func (AngelClient) QueryStartupsFollowers

func (c AngelClient) QueryStartupsFollowers(user_id int64) (users []AngelUser, err error)

QueryStartupsFollowers queries /startups/:id/followers for a startup's followers

func (AngelClient) QueryStartupsFollowersIds

func (c AngelClient) QueryStartupsFollowersIds(user_id int64) (ids []int64, err error)

QueryStartupsFollowersIds queries /startups/:id/followers/ids for a startup's followers

func (AngelClient) QueryStartupsId

func (c AngelClient) QueryStartupsId(startup_id int64) (startup Startup, err error)

QueryStartupsId queries /startups/:id for a startup, given its id

func (AngelClient) QueryStartupsIdComments

func (c AngelClient) QueryStartupsIdComments(startup_id int64) (comments []Comment, err error)

QueryStartupsIdComments queries /startups/:id/comments for a startup's comments, given its id

func (AngelClient) QueryStartupsIdUsers

func (c AngelClient) QueryStartupsIdUsers(startup_id int64) (users []AngelUser, err error)

QueryStartupsIdUsers queries /startups/:id/users for a startup's tagged users, given its id

func (AngelClient) QueryStartupsSearch

func (c AngelClient) QueryStartupsSearch(slug string) (startup Startup, err error)

Query /startups/search for the followers of several users TODO implement domain

func (AngelClient) QueryTagsStartups

func (c AngelClient) QueryTagsStartups(startup_id int64, order int) (startups []Startup, err error)

Query /tags/:id/startups for startups tagged with the given tag or a child of the given tag TODO implement pagination

func (AngelClient) QueryUsersFollowers

func (c AngelClient) QueryUsersFollowers(user_id int64) (users []AngelUser, err error)

QueryUsersFollowers queries /users/:id/followers for a user's followers

func (AngelClient) QueryUsersFollowersIds

func (c AngelClient) QueryUsersFollowersIds(user_id int64) (ids []int64, err error)

QueryUsersFollowersIds queries /users/:id/followers/ids for a user's followers Returns ids only

func (AngelClient) QueryUsersFollowingStartups

func (c AngelClient) QueryUsersFollowingStartups(user_id int64) (startups []Startup, err error)

QueryUsersFollowingStartups queries /users/:id/following for a user's followers (return startups only)

func (AngelClient) QueryUsersFollowingStartupsIds

func (c AngelClient) QueryUsersFollowingStartupsIds(user_id int64) (ids []int64, err error)

QueryUsersFollowingStartupsIds queries /users/:id/following/ids for all startups that the given user is following (return startups only)

func (AngelClient) QueryUsersFollowingUsers

func (c AngelClient) QueryUsersFollowingUsers(user_id int64) (users []AngelUser, err error)

QueryUsersFollowingUsers queries /users/:id/following for a user's followers (return users only)

func (AngelClient) QueryUsersFollowingUsersIds

func (c AngelClient) QueryUsersFollowingUsersIds(user_id int64) (ids []int64, err error)

QueryUsersFollowingUsersIds queries /users/:id/following/ids for all users that the given user is following (return users only)

func (AngelClient) RequestAccessToken

func (c AngelClient) RequestAccessToken(code string) (access_token string, err error)

RequestAccessToken exchanges the code from an OAuth callback for an access token

func (AngelClient) Unfollow

func (c AngelClient) Unfollow(id int64, id_type int) (result interface{}, err error)

Unfollow issues a DELETE query to /follows to stop following the user/startup with the specified id

type AngelUser

type AngelUser struct {
	Angellist_url *string
	Id            int64
	Name          *string

	Roles []struct {
		Angellist_url *string
		Display_name  *string
		Id            int
		Name          *string
		Tag_type      *string
	}

	Linkedin_url     *string
	Bio              *string
	Twitter_url      *string
	Follower_count   float64
	Image            *string
	Facebook_url     *string
	Locations        []Location
	Investor         bool
	Investor_details *struct {
		Startups_per_year string
		Average_amount    string
		Accreditation     string
		Markets           []Market
		Investments       []struct {
			Id      int64
			Name    string
			Quality int
		}
	}
}

func QueryUsers

func QueryUsers(id int64) (user AngelUser, err error)

QueryUsers queries /users/:id for a user's information given an id

func QueryUsersSearch

func QueryUsersSearch(slug string) (user AngelUser, err error)

QueryUsersSearch queries /users/search for a user with the specified slug

func (AngelUser) MarketNames

func (u AngelUser) MarketNames() []string

type Comment

type Comment struct {
	Created_at *string
	Id         float64
	User       *struct {
		Angellist_url  *string
		Bio            *string
		Follower_count *float64
		Image          *string
		Name           *string
		Id             *float64
	}
	Comment *string
}

type IdsResponse

type IdsResponse struct {
	Total     int64
	Per_page  int64
	Page      int64
	Last_page int64
	Ids       []int64
}

type Location

type Location struct {
	Id            int64
	Tag_type      string
	Name          string
	Display_name  string
	Angellist_url string
}

type Market

type Market struct {
	Id            int64
	Tag_type      string
	Name          string
	Display_name  string
	Angellist_url string
}

type Startup

type Startup struct {
	Id            int64          //Id refers to the AngelList ID
	Name          *string        ",omitempty"
	Company_url   *string        ",omitempty"
	Angellist_url *string        ",omitempty"
	StartupRoles  *[]StartupRole //People associated with the startup

	Product_desc      *string
	Community_profile bool
	Twitter_url       *string
	Follower_count    float64
	//Markets           []*Market
	//Locations         []Location
	//Screenshots       []*Screenshot
	Logo_url  *string
	Blog_url  *string
	Video_url *string
	Hidden    bool
	Status    *struct {
		Created_at *string
		Message    *string
	}
}

type StartupRole

type StartupRole struct {
	Id        int64
	Confirmed bool
	User      *struct {
		Follower_count int64
		Image          string
		Name           string
		Id             int64
		Angellist_url  string
		Bio            string
	}
	Role       string
	Created_at string
	Startup    *struct {
		Id   int64
		Name string
	}

	Tagged struct {
		Type           string
		Name           string
		Id             int64
		Bio            string
		Follower_count int64
		Angellist_url  string
		Image          string
	}
}

func QueryUsersStartups

func QueryUsersStartups(id int64) ([]StartupRole, error)

QueryUsersStartups queries /users/:id/startups for a user's startup roles

type Tag

type Tag struct {
	Angellist_url *string
	Statistics    *struct {
		Direct *struct {
			Investor_followers float64
			Users              float64
			Followers          float64
			Startups           float64
		}
		All *struct {
			Followers          float64
			Startups           float64
			Investor_followers float64
			Users              float64
		}
	}
	Name         *string
	Display_name *string
	Id           float64
	Tag_type     *string
}

func QueryTags

func QueryTags(id int64) (tag Tag, err error)

QueryTags queries /tags/:id for information on a given tag This endpoint is currently giving trouble on AngelList

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL