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.
# Go Modules
require github.com/carnegierobotics/greenhouse-client-go/greenhouse
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.
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()
import (
"context"
)
ctx := context.TODO()
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.
feed, err := greenhouse.GetActivityFeed(&client, ctx, candidateId)
list, err := greenhouse.GetAllApplications(&client, ctx)
var applicationObj greenhouse.Application
applicationId, err := greenhouse.AddApplicationToCandidate(&client, ctx, candidateId, &applicationObj)
var applicationObj greenhouse.Application
err := greenhouse.UpdateApplication(&client, ctx, applicationId, &applicationObj)
err := greenhouse.AdvanceApplication(&client, ctx, applicationId, fromStageId)
err := greenhouse.MoveApplicationDifferentJob(&client, ctx, applicationId, newJobId, newStageId)
err := greenhouse.MoveApplicationSameJob(&client, ctx, applicationId, fromStageId, toStageId)
var attachmentObj greenhouse.Attachment
err := greenhouse.AddAttachmentToApplication(&client, ctx, applicationId, &attachmentObj)
var hireObj greenhouse.ApplicationHire
err := greenhouse.HireApplication(&client, ctx, applicationId, &hireObj)
var rejectObj greenhouse.ApplicationReject
err := greenhouse.RejectApplication(&client, ctx, applicationId, &rejectObj)
err := greenhouse.UpdateRejectionReason(&client, ctx, applicationId, newReasonId)
err := greenhouse.UnrejectApplication(&client, ctx, applicationId)