-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
goals.go
64 lines (47 loc) · 2.18 KB
/
goals.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
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)
}
// BBHRListAvailableGoalSharingOptionsInput is used as input for the ListAvailableGoalSharingOptions function
type BBHRListAvailableGoalSharingOptionsInput struct {
EmployeeID string
Search string
Limit string
}
// ListAvailableGoalSharingOptions lists the employees with whom the specified employees goals can be shared
func (b *Client) ListAvailableGoalSharingOptions(args BBHRListAvailableGoalSharingOptionsInput) ([]byte, error) {
if args.EmployeeID == "" {
return []byte{}, fmt.Errorf("missing arg: EmployeeID")
}
endpointURL := fmt.Sprintf("%s/performance/employees/%s/goals/sharedOptions", b.APIEndpoint, args.EmployeeID)
if args.Search != "" {
endpointURL += fmt.Sprintf("&search=%s", args.Search)
}
if args.Limit != "" {
endpointURL += fmt.Sprintf("&limit=%s", args.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)
}