You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: jobs.go
    path of file: ./repos/incubator-devlake/backend/plugins/jenkins/api
    
    the code of the file until where you have to start completion: /*
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements.  See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License.  You may obtain a copy of the License at

    http://www.
    
func GetJobsPage(apiClient plugin.ApiClient, path string, page int, pageSize int, callback func(job *models.Job) errors.Error) (int, errors.Error) {
	i := page * pageSize
	var data struct {
		Jobs []json.RawMessage `json:"jobs"`
	}
	// set query
	query := url.Values{}
	treeValue := fmt.Sprintf("jobs[fullName,name,class,url,color,base,jobs,upstreamProjects[name]]{%d,%d}", i, i+pageSize)
	query.Set("tree", treeValue)

	res, err := apiClient.Get(path+"/api/json", query, nil)
	if err != nil {
		return 0, err
	}

	err = helper.UnmarshalResponse(res, &data)
	if err != nil {
		// In some directories, after testing
		// it is found that if the second page is empty, a 500 error will be returned.
		// So we don't think it's an error to return 500 in this case
		if i > 0 && res.StatusCode == http.StatusInternalServerError {
			return 0, nil
		}
		return 0, err
	}
	for _, rawJobs := range data.Jobs {
		job := &models.Job{}
		err1 := json.Unmarshal(rawJobs, job)
		if err1 != nil {
			return len(data.Jobs), errors.Convert(err1)
		}

		err = callback(job)
		if err != nil {
			return len(data.Jobs), err
		}
	}
	return len(data.Jobs), nil
}