//GetJobs just make the http request func GetJobs(server string) ([]*format.Job, error) { req := &format.Request{List: &format.ListRequest{}} c := format.NewClient(server) resp, err := c.Proto(req) if err != nil { return nil, err } return resp.GetList().GetJobs(), nil }
//GetRemoteExecution makes the query on the ci server to get refresh and build information. // It transforms them into RemoteExecution func GetRemoteExecution(remoteurl string, req *format.Request) (b, r *RemoteExecution) { c := format.NewClient(remoteurl) resp, err := c.Proto(req) if err != nil { log.Fatal(err.Error()) } job := resp.GetLog().GetJob() // now present the resp // r = NewRemoteExecution(job.GetRefresh(), "refresh") b = NewRemoteExecution(job.GetBuild(), "build") return }
func NewClient(server string) Client { return Client{format.NewClient(server)} }