Skip to content

carnegierobotics/greenhouse-client-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

greenhouse-client-go

Go Reference

This library provides a Go client for the Greenhouse Harvest and Job Board* APIs.

* The Job Board API has not yet been added to this library.

Installation

# Go Modules
require github.com/carnegierobotics/greenhouse-client-go/greenhouse

Usage

The functions included in this package are more or less 1:1 with the API specification. Below are some snippets demonstrating how to use this library to interact with the Greenhouse APIs.

Initializing the client

This library uses Resty to build the client. Additionally, all functions are context-aware, so be sure to include one in your calls.

import (
  "github.com/carnegierobotics/greenhouse-client-go/greenhouse"
)
client := greenhouse.Client{
  BaseUrl:      "https://boards-api.greenhouse.io", // Harvest API URL
  Token:        "abc123",                           // Harvest API token
  OnBehalfOf:   "12345",                            // On-Behalf-Of user ID
  RetryCount:   5,                                  // Number of retries per failed API call 
  RetryWait:    5,                                  // Minimum time to wait between retries
  RetryMaxWait: 30,                                 // Maximum time to wait between retries
}
client.BuildResty()

Initialize a context

import (
  "context"
)
ctx := context.TODO()

Examples

Below are some examples of how this package can be used. Note that not all functions are shown here; these are merely examples to get you started.

Get a candidate's activity feed

feed, err := greenhouse.GetActivityFeed(&client, ctx, candidateId)

Get all applications

list, err := greenhouse.GetAllApplications(&client, ctx)

Add an application to a candidate

var applicationObj greenhouse.Application
applicationId, err := greenhouse.AddApplicationToCandidate(&client, ctx, candidateId, &applicationObj)

Update an application

var applicationObj greenhouse.Application
err := greenhouse.UpdateApplication(&client, ctx, applicationId, &applicationObj)

Advance an application

err := greenhouse.AdvanceApplication(&client, ctx, applicationId, fromStageId)

Move an application to a different job

err := greenhouse.MoveApplicationDifferentJob(&client, ctx, applicationId, newJobId, newStageId)

Move an application between stages in a job

err := greenhouse.MoveApplicationSameJob(&client, ctx, applicationId, fromStageId, toStageId)

Add an attachment to an application

var attachmentObj greenhouse.Attachment
err := greenhouse.AddAttachmentToApplication(&client, ctx, applicationId, &attachmentObj)

Hire an application

var hireObj greenhouse.ApplicationHire
err := greenhouse.HireApplication(&client, ctx, applicationId, &hireObj)

Reject an application

var rejectObj greenhouse.ApplicationReject
err := greenhouse.RejectApplication(&client, ctx, applicationId, &rejectObj)

Update a rejection reason

err := greenhouse.UpdateRejectionReason(&client, ctx, applicationId, newReasonId)

Unreject an application

err := greenhouse.UnrejectApplication(&client, ctx, applicationId)

Links