// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.

package tangled

// schema: sh.tangled.git.temp.listCommits

import (
	"bytes"
	"context"

	"github.com/bluesky-social/indigo/lex/util"
)

const (
	GitTempListCommitsNSID = "sh.tangled.git.temp.listCommits"
)

// GitTempListCommits calls the XRPC method "sh.tangled.git.temp.listCommits".
//
// cursor: Pagination cursor (commit SHA)
// limit: Maximum number of commits to return
// ref: Git reference (branch, tag, or commit SHA)
// repo: DID of the repository
func GitTempListCommits(ctx context.Context, c util.LexClient, cursor string, limit int64, ref string, repo string) ([]byte, error) {
	buf := new(bytes.Buffer)

	params := map[string]interface{}{}
	if cursor != "" {
		params["cursor"] = cursor
	}
	if limit != 0 {
		params["limit"] = limit
	}
	if ref != "" {
		params["ref"] = ref
	}
	params["repo"] = repo
	if err := c.LexDo(ctx, util.Query, "", "sh.tangled.git.temp.listCommits", params, nil, buf); err != nil {
		return nil, err
	}

	return buf.Bytes(), nil
}
