greenhouse

package module
v0.0.0-...-eb55e4b Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2018 License: MIT Imports: 2 Imported by: 0

README

Greenhouse.io Go Client

GoDoc Go Report Card Build Status

Go client for the Greenhouse.io API as defined at: https://developers.greenhouse.io/job-board.html

Installation

go get -u github.com/escholtz/greenhouse

Usage

package main

import (
	"fmt"
	"os"

	"github.com/escholtz/greenhouse"
)

func main() {
	client := greenhouse.NewClient()

	// Get the company name
	board, err := client.Board("github")
	if err != nil {
		panic(err)
	}
	fmt.Println(board.Name)

	// Get all job openings including descriptions
	jobs, err := client.Jobs("github")
	if err != nil {
		panic(err)
	}
	for _, j := range jobs.Jobs {
		fmt.Println(j.Title, j.Location.Name)
	}
}

Documentation

Overview

Package greenhouse provides a wrapper around the greenhouse.io Job Board API. The API is defined at: https://developers.greenhouse.io/job-board.html

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Board

type Board struct {
	Name    string `json:"name"`
	Content string `json:"content"`
}

Board describes an organization's job board. Usually it includes a company name and sometimes a description of the organization as html.

type Client

type Client struct {
	// contains filtered or unexported fields
}

A Client manages communication with the Greenhouse API.

func NewClient

func NewClient() *Client

NewClient returns a new Greenhouse API client.

func (*Client) Board

func (c *Client) Board(boardToken string) (*Board, error)

Board returns the organization's name and optionally an html description of the organization.

func (*Client) Jobs

func (c *Client) Jobs(boardToken string) (*Jobs, error)

Jobs returns the job openings, including content, for the specified organization.

func (*Client) WithHTTPClient

func (c *Client) WithHTTPClient(client *http.Client) *Client

WithHTTPClient sets a custom http client to be used for all future requests.

type Jobs

type Jobs struct {
	Jobs []struct {
		ID            int    `json:"id"`
		InternalJobID int    `json:"internal_job_id"`
		Title         string `json:"title"`
		Education     string `json:"education,omitempty"`
		UpdatedAt     string `json:"updated_at"`
		Location      struct {
			Name string `json:"name"`
		} `json:"location"`
		AbsoluteURL string `json:"absolute_url"`
		// TODO: varies by company, some use []string for Value, some
		// use string
		// Metadata    []struct {
		// 	ID        int      `json:"id"`
		// 	Name      string   `json:"name"`
		// 	Value     []string `json:"value"`
		// 	ValueType string   `json:"value_type"`
		// } `json:"metadata"`
		Content     string `json:"content"`
		Departments []struct {
			ID       int    `json:"id"`
			Name     string `json:"name"`
			ChildIds []int  `json:"child_ids"`
			ParentID int    `json:"parent_id"`
		} `json:"departments"`
		Offices []struct {
			ID       int    `json:"id"`
			Name     string `json:"name"`
			Location string `json:"location"`
			ChildIds []int  `json:"child_ids"`
			ParentID int    `json:"parent_id"`
		} `json:"offices"`
	} `json:"jobs"`
	Meta struct {
		Total int `json:"total"`
	} `json:"meta"`
}

Jobs describes an organization's job listings.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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