github.com/schmorrison/Zoho@v1.1.4/recruit/interviews.go (about) 1 package recruit 2 3 import ( 4 "fmt" 5 "time" 6 7 zoho "github.com/schmorrison/Zoho" 8 ) 9 10 // GetInterviewsRecords returns a list of all records 11 // https://www.zoho.com/recruit/developer-guide/apiv2/get-records.html 12 // https://recruit.zoho.eu/recruit/v2/Interviews 13 func (c *API) GetInterviewsRecords( 14 params map[string]zoho.Parameter, 15 ) (data InterviewsRecordsResponse, err error) { 16 endpoint := zoho.Endpoint{ 17 Name: "GetInterviewsRecords", 18 URL: fmt.Sprintf( 19 "https://recruit.zoho.%s/recruit/v2/%s", 20 c.ZohoTLD, 21 InterviewsModule, 22 ), 23 Method: zoho.HTTPGet, 24 ResponseData: &InterviewsRecordsResponse{}, 25 URLParameters: map[string]zoho.Parameter{ 26 "fields": "", 27 "sort_order": "", 28 "sort_by": "", 29 "converted": "false", 30 "approved": "true", 31 "page": "1", 32 "per_page": "200", 33 "cvid": "", 34 "territory_id": "", 35 "include_child": "", 36 }, 37 } 38 39 if len(params) > 0 { 40 for k, v := range params { 41 endpoint.URLParameters[k] = v 42 } 43 } 44 45 err = c.Zoho.HTTPRequest(&endpoint) 46 if err != nil { 47 return InterviewsRecordsResponse{}, fmt.Errorf("failed to retrieve Interviews: %s", err) 48 } 49 50 if v, ok := endpoint.ResponseData.(*InterviewsRecordsResponse); ok { 51 return *v, nil 52 } 53 54 return InterviewsRecordsResponse{}, fmt.Errorf( 55 "data returned was not 'InterviewsRecordsResponse'", 56 ) 57 } 58 59 // GetInterviewsRecord returns the record specified by ID 60 // https://www.zoho.com/recruit/developer-guide/apiv2/get-records.html 61 // https://recruit.zoho.eu/recruit/v2/Interviews/{id} 62 func (c *API) GetInterviewsRecordById(id string) (data InterviewsRecordsResponse, err error) { 63 endpoint := zoho.Endpoint{ 64 Name: "GetInterviewsRecordById", 65 URL: fmt.Sprintf( 66 "https://recruit.zoho.%s/recruit/v2/%s/%s", 67 c.ZohoTLD, 68 InterviewsModule, 69 id, 70 ), 71 Method: zoho.HTTPGet, 72 ResponseData: &InterviewsRecordsResponse{}, 73 } 74 75 err = c.Zoho.HTTPRequest(&endpoint) 76 if err != nil { 77 return InterviewsRecordsResponse{}, fmt.Errorf( 78 "failed to retrieve JobOpening with id: %s", 79 err, 80 ) 81 } 82 83 if v, ok := endpoint.ResponseData.(*InterviewsRecordsResponse); ok { 84 return *v, nil 85 } 86 87 return InterviewsRecordsResponse{}, fmt.Errorf( 88 "data returned was not 'InterviewsRecordsResponse'", 89 ) 90 } 91 92 // InterviewsRecordsResponse is the data returned by GetInterviewsRecords & GetInterviewsRecordById 93 type InterviewsRecordsResponse struct { 94 Data []struct { 95 ClientName struct { 96 Name string `json:"name,omitempty"` 97 ID string `json:"id,omitempty"` 98 } `json:"Client_Name,omitempty"` 99 CurrencySymbol string `json:"$currency_symbol,omitempty"` 100 VideoInterviewIsReviewed bool `json:"$video_interview_isreviewed,omitempty"` 101 StartDateTime time.Time `json:"Start_DateTime,omitempty"` 102 InterviewDuration struct { 103 Mins int `json:"mins,omitempty"` 104 Hrs int `json:"hrs,omitempty"` 105 Days int `json:"days,omitempty"` 106 } `json:"$interview_duration,omitempty"` 107 InterviewEvaluationDone bool `json:"$interview_evaluationdone,omitempty"` 108 EndDateTime Time `json:"End_DateTime,omitempty"` 109 LastActivityTime Time `json:"Last_Activity_Time,omitempty"` 110 InterviewEnableEvaluation bool `json:"$interview_enableevaluation,omitempty"` 111 ModifiedBy struct { 112 Name string `json:"name,omitempty"` 113 ID string `json:"id,omitempty"` 114 } `json:"Modified_By,omitempty"` 115 CandidateName struct { 116 Name string `json:"name,omitempty"` 117 ID string `json:"id,omitempty"` 118 } `json:"Candidate_Name,omitempty"` 119 ProcessFlow bool `json:"$process_flow,omitempty"` 120 InterviewOwner struct { 121 Name string `json:"name,omitempty"` 122 ID string `json:"id,omitempty"` 123 } `json:"Interview_Owner,omitempty"` 124 Feedback string `json:"Feedback,omitempty"` 125 ScheduleComments string `json:"Schedule_Comments,omitempty"` 126 InterviewType int `json:"$interview_type,omitempty"` 127 ReviewedBy string `json:"Reviewed_By,omitempty"` 128 ID string `json:"id,omitempty"` 129 Approved bool `json:"$approved,omitempty"` 130 Approval struct { 131 Delegate bool `json:"delegate,omitempty"` 132 Approve bool `json:"approve,omitempty"` 133 Reject bool `json:"reject,omitempty"` 134 Resubmit bool `json:"resubmit,omitempty"` 135 } `json:"$approval,omitempty"` 136 IsStatusSplitDone bool `json:"isStatusSplitDone,omitempty"` 137 ModifiedTime Time `json:"Modified_Time,omitempty"` 138 Venue string `json:"Venue,omitempty"` 139 CreatedTime Time `json:"Created_Time,omitempty"` 140 Followed bool `json:"$followed,omitempty"` 141 Taxable bool `json:"$taxable,omitempty"` 142 Editable bool `json:"$editable,omitempty"` 143 IsLocked bool `json:"Is_Locked,omitempty"` 144 InterviewName string `json:"Interview_Name,omitempty"` 145 QuestionnaireName string `json:"Questionnaire_Name,omitempty"` 146 AssociatedTags []struct{} `json:"Associated_Tags,omitempty"` 147 InterviewStatus string `json:"Interview_Status,omitempty"` 148 JobOpeningName struct { 149 Name string `json:"name,omitempty"` 150 ID string `json:"id,omitempty"` 151 } `json:"Job_Opening_Name,omitempty"` 152 ReviewedTime string `json:"Reviewed_Time,omitempty"` 153 Interviewer []struct { 154 Name string `json:"name,omitempty"` 155 ID string `json:"id,omitempty"` 156 Email string `json:"email,omitempty"` 157 PhotoSrc string `json:"photoSrc,omitempty"` 158 } `json:"Interviewer,omitempty"` 159 Created_By struct { 160 Name string `json:"name,omitempty"` 161 ID string `json:"id,omitempty"` 162 } `json:"Created_By,omitempty"` 163 IsAttachmentPresent bool `json:"Is_Attachment_Present,omitempty"` 164 InterviewTimeTillReview struct{} `json:"$interview_timetillreview,omitempty"` 165 VideoInterviewIsSubmitted bool `json:"video_interview_issubmitted,omitempty"` 166 } `json:"data,omitempty"` 167 Info PageInfo `json:"info,omitempty"` 168 }