Skip to content

Commit

Permalink
Adding functionality for goals
Browse files Browse the repository at this point in the history
Bugfix in accountinfo and benefits
  • Loading branch information
HelixSpiral committed Oct 16, 2021
1 parent fe92ede commit e75fe04
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 2 deletions.
2 changes: 1 addition & 1 deletion accountinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

// ListFields lists all the metadata fields your account has
func (b *Client) ListFields() ([]byte, error) {
endpointURL := fmt.Sprintf("%s/meta/field", b.APIEndpoint)
endpointURL := fmt.Sprintf("%s/meta/fields", b.APIEndpoint)

return b.getRequest(endpointURL)
}
Expand Down
2 changes: 1 addition & 1 deletion benefits.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func (b *Client) ListBenefitCoverage() ([]byte, error) {

// GetBenefitCoverage gets the benefit coverage for a specific employee
func (b *Client) GetBenefitCoverage(id string) ([]byte, error) {
endpointURL := fmt.Sprintf("%s/benefitcoverage/%s", b.APIEndpoint, id)
endpointURL := fmt.Sprintf("%s/benefitcoverages/%s", b.APIEndpoint, id)

return b.getRequest(endpointURL)
}
Expand Down
53 changes: 53 additions & 0 deletions goals.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package bamboohr

import "fmt"

// GetGoalStatusCount gets the number of goals per status for an employee
func (b *Client) GetGoalStatusCount(id string) ([]byte, error) {
endpointURL := fmt.Sprintf("%s/performance/employees/%s/goals/filters", b.APIEndpoint, id)

return b.getRequest(endpointURL)
}

// GetCanCreateGoal returns if the API user can create a goal for the employee
func (b *Client) GetCanCreateGoal(id string) ([]byte, error) {
endpointURL := fmt.Sprintf("%s/performance/employees/%s/goals/canCreateGoals", b.APIEndpoint, id)

return b.getRequest(endpointURL)
}

// ListGoalsForEmployee lists the goals for an employee
func (b *Client) ListGoalsForEmployee(id string) ([]byte, error) {
endpointURL := fmt.Sprintf("%s/performance/employees/%s/goals", b.APIEndpoint, id)

return b.getRequest(endpointURL)
}

// ListAvailableGoalSharingOptions lists the employees with whom the specified employees goals can be shared
func (b *Client) ListAvailableGoalSharingOptions(id string, args map[string]string) ([]byte, error) {
endpointURL := fmt.Sprintf("%s/performance/employees/%s/goals/sharedOptions", b.APIEndpoint, id)

if searchOptions, ok := args["search"]; ok {
endpointURL += fmt.Sprintf("&search=%s", searchOptions)
}

if limit, ok := args["limit"]; ok {
endpointURL += fmt.Sprintf("&limit=%s", limit)
}

return b.getRequest(endpointURL)
}

// GetAlignableGoalOptions gets the alignable goal options for an employee
func (b *Client) GetAlignableGoalOptions(id string) ([]byte, error) {
endpointURL := fmt.Sprintf("%s/performance/employees/%s/goals/alignmentOptions", b.APIEndpoint, id)

return b.getRequest(endpointURL)
}

// GetGoalComments gets the comments for a specific goal
func (b *Client) GetGoalComments(id, goalid string) ([]byte, error) {
endpointURL := fmt.Sprintf("%s/performance/employees/%s/goals/%s/comments", b.APIEndpoint, id, goalid)

return b.getRequest(endpointURL)
}

0 comments on commit e75fe04

Please sign in to comment.