-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapplication.go
More file actions
118 lines (96 loc) · 3.67 KB
/
application.go
File metadata and controls
118 lines (96 loc) · 3.67 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
package lever
import (
"context"
"fmt"
"net/url"
"github.com/corbaltcode/lever-data-api-go/model"
)
// Lever data application client interface
type ApplicationClientInterface interface {
ClientInterface
// Retrieve a single application.
//
// This method returns the full application record for a single application.
//
// WARNING: This endpoint is deprecated but maintained for backwards compatibility. Use the
// OpportunityClient GetOpportunity() method, specifying the expand parameter to include
// applications.
GetApplication(ctx context.Context, req *GetApplicationRequest) (*GetApplicationResponse, error)
// Lists all applications for a candidate.
//
// WARNING: This endpoint is deprecated but maintained for backwards compatibility. Use the
// OpportunityClient ListAllOpportunities() method, specifying the relevant contact UID in the
// contact_id parameter and specifying the expand parameter to include applications.
ListApplications(ctx context.Context, req *ListApplicationsRequest) (*ListApplicationsResponse, error)
}
// Parameters for retrieving a single application.
type GetApplicationRequest struct {
BaseRequest
// The opportunity id. This is required.
OpportunityId string
// The application id. This is required.
ApplicationId string
}
// Create a new GetApplicationRequest with the required fields.
func NewGetApplicationRequest(opportunityId, applicationId string) *GetApplicationRequest {
return &GetApplicationRequest{
OpportunityId: opportunityId,
ApplicationId: applicationId,
}
}
func (r *GetApplicationRequest) GetPath() string {
return fmt.Sprintf("opportunities/%s/applications/%s", url.PathEscape(r.OpportunityId), url.PathEscape(r.ApplicationId))
}
// Response for retrieving a single application.
type GetApplicationResponse struct {
BaseResponse
// The application record.
Application *model.Application `json:"data"`
}
// Parameters for listing applications for a candidate.
type ListApplicationsRequest struct {
BaseListRequest
// The opportunity id. This is required.
OpportunityId string
}
// Create a new ListApplications with the required fields.
func NewListApplicationsRequest(opportunityId string) *ListApplicationsRequest {
return &ListApplicationsRequest{
OpportunityId: opportunityId,
}
}
func (r *ListApplicationsRequest) GetPath() string {
return fmt.Sprintf("opportunities/%s/applications", url.PathEscape(r.OpportunityId))
}
// Response for listing applications for a candidate.
type ListApplicationsResponse struct {
BaseListResponse
// The application records.
Applications []*model.Application `json:"data"`
}
// Retrieve a single application.
//
// This method returns the full application record for a single application.
//
// WARNING: This endpoint is deprecated but maintained for backwards compatibility. Use the
// OpportunityClient GetOpportunity() method, specifying the expand parameter to include
// applications.
func (c *Client) GetApplication(ctx context.Context, req *GetApplicationRequest) (*GetApplicationResponse, error) {
var resp GetApplicationResponse
if err := c.exec(ctx, req, &resp); err != nil {
return nil, err
}
return &resp, nil
}
// Lists all applications for a candidate.
//
// WARNING: This endpoint is deprecated but maintained for backwards compatibility. Use the
// OpportunityClient ListAllOpportunities() method, specifying the relevant contact UID in the
// contact_id parameter and specifying the expand parameter to include applications.
func (c *Client) ListApplications(ctx context.Context, req *ListApplicationsRequest) (*ListApplicationsResponse, error) {
var resp ListApplicationsResponse
if err := c.exec(ctx, req, &resp); err != nil {
return nil, err
}
return &resp, nil
}