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: client_commit.go
    path of file: ./repos/cds/engine/vcs/bitbucketserver
    
    the code of the file until where you have to start completion: package bitbucketserver

import (
	"context"
	"fmt"
	"net/url"
	"strconv"

	"github.com/rockbears/log"

	"github.com/ovh/cds/engine/cache"
	"github.com/ovh/cds/sdk"
	"github.com/ovh/cds/sdk/telemetry"
)

func (b *bitbucketClient) Commits(ctx context.Context, repo, branch, since, until string) ([]sdk.VCSCommit, error) {
	ctx, end := telemetry.Span(ctx, "bitbucketserver.Branches", telemetry.Tag(telemetry.TagRepository, repo))
	defer end()
	commits := []sdk.VCSCommit{}
	project, slug, err := getRepo(repo)
	if err != nil {
		return nil, sdk.WithStack(err)
	}

	stashCommits := []Commit{}

	var stashCommitsKey = cache.Key("vcs", "bitbucket", b.consumer.URL, repo, "commits", "since@"+since, "until@"+until)

	find, err := b.consumer.cache.Get(stashCommitsKey, &stashCommits)
	if err != nil {
		log.Error(ctx, "cannot get from cache %s: %v", stashCommitsKey, err)
	}
	if !find {
		response := CommitsResponse{}
		path := fmt.Sprintf("/projects/%s/repos/%s/commits", project, slug)
		params := url.Values{}
		if since != "" {
			params.Add("since", since)
		}
		if until != "" {
			params.Add("until", until)
		}

		for {
			if ctx.Err() != nil {
				break
			}

			if response.NextPageStart != 0 {
				params.Set("start", fmt.Sprintf("%d", response.NextPageStart))
			}

			if err := b.do(ctx, "GET", "core", path, params, nil, &response); err != nil {
				if sdk.ErrorIs(err, sdk.ErrNotFound) {
					return nil, nil
				}
				return nil, sdk.WrapError(err, "Unable to get commits %s", path)
			}

			stashCommits = append(stashCommits, response.Values...)
			if response.IsLastPage {
				break
			}
		}
		//3 hours
		if err := b.consumer.cache.SetWithTTL(stashCommitsKey, stashCommits, 3*60*60); err != nil {
			log.Error(ctx, "cannot SetWithTTL: %s: %v", stashCommitsKey, err)
		}
	}

	urlCommit := b.consumer.URL + "/projects/" + project + "/repos/" + slug + "/commits/"
	for _, sc := range stashCommits {
		c := sdk.VCSCommit{
			Hash:      sc.Hash,
			Timestamp: sc.Timestamp,
			Message:   sc.Message,
			Author: sdk.VCSAuthor{
				Name:       
    
func (b *bitbucketClient) Commits(ctx context.Context, repo, branch, since, until string) ([]sdk.VCSCommit, error) {
	ctx, end := telemetry.Span(ctx, "bitbucketserver.Branches", telemetry.Tag(telemetry.TagRepository, repo))
	defer end()
	commits := []sdk.VCSCommit{}
	project, slug, err := getRepo(repo)
	if err != nil {
		return nil, sdk.WithStack(err)
	}

	stashCommits := []Commit{}

	var stashCommitsKey = cache.Key("vcs", "bitbucket", b.consumer.URL, repo, "commits", "since@"+since, "until@"+until)

	find, err := b.consumer.cache.Get(stashCommitsKey, &stashCommits)
	if err != nil {
		log.Error(ctx, "cannot get from cache %s: %v", stashCommitsKey, err)
	}
	if !find {
		response := CommitsResponse{}
		path := fmt.Sprintf("/projects/%s/repos/%s/commits", project, slug)
		params := url.Values{}
		if since != "" {
			params.Add("since", since)
		}
		if until != "" {
			params.Add("until", until)
		}

		for {
			if ctx.Err() != nil {
				break
			}

			if response.NextPageStart != 0 {
				params.Set("start", fmt.Sprintf("%d", response.NextPageStart))
			}

			if err := b.do(ctx, "GET", "core", path, params, nil, &response); err != nil {
				if sdk.ErrorIs(err, sdk.ErrNotFound) {
					return nil, nil
				}
				return nil, sdk.WrapError(err, "Unable to get commits %s", path)
			}

			stashCommits = append(stashCommits, response.Values...)
			if response.IsLastPage {
				break
			}
		}
		//3 hours
		if err := b.consumer.cache.SetWithTTL(stashCommitsKey, stashCommits, 3*60*60); err != nil {
			log.Error(ctx, "cannot SetWithTTL: %s: %v", stashCommitsKey, err)
		}
	}

	urlCommit := b.consumer.URL + "/projects/" + project + "/repos/" + slug + "/commits/"
	for _, sc := range stashCommits {
		c := sdk.VCSCommit{
			Hash:      sc.Hash,
			Timestamp: sc.Timestamp,
			Message:   sc.Message,
			Author: sdk.VCSAuthor{
				Name:        sc.Author.Name,
				Email:       sc.Author.Email,
				DisplayName: sc.Author.DisplayName,
				Slug:        sc.Author.Slug,
				ID:          strconv.Itoa(sc.Author.ID),
			},
			Committer: sdk.VCSAuthor{
				Name:        sc.Committer.Name,
				Email:       sc.Committer.Email,
				DisplayName: sc.Committer.DisplayName,
				Slug:        sc.Committer.Slug,
				ID:          strconv.Itoa(sc.Committer.ID),
			},
			URL: urlCommit + sc.Hash,
		}
		if sc.Author.Slug != "" && sc.Author.Slug != "unknownSlug" {
			c.Author.Avatar = fmt.Sprintf("%s/users/%s/avatar.png", b.consumer.URL, sc.Author.Slug)
		}
		commits = append(commits, c)
	}
	return commits, nil
}