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

package org_tangled

// schema: org.tangled.temp.git.listCommitsByRef

import (
	"context"

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

const (
	TempGitListCommitsByRefNSID = "org.tangled.temp.git.listCommitsByRef"
)

// TempGitListCommitsByRef_Output is the output of a org.tangled.temp.git.listCommitsByRef call.
type TempGitListCommitsByRef_Output struct {
	Commits []*TempGitListCommits_Commit `json:"commits" cborgen:"commits"`
}

// TempGitListCommitsByRef calls the XRPC method "org.tangled.temp.git.listCommitsByRef".
//
// includeStats: Diff each commit against its first parent and include a line stat
// limit: Maximum number of commits to return
// repo: DID of the repository
// skip: Number of matching commits to skip. A poor man's pagination.
func TempGitListCommitsByRef(ctx context.Context, c util.LexClient, includeStats bool, limit int64, ranges []string, repo string, skip int64) (*TempGitListCommitsByRef_Output, error) {
	var out TempGitListCommitsByRef_Output

	params := map[string]interface{}{}
	if includeStats {
		params["includeStats"] = includeStats
	}
	if limit != 0 {
		params["limit"] = limit
	}
	if len(ranges) != 0 {
		params["ranges"] = ranges
	}
	params["repo"] = repo
	if skip != 0 {
		params["skip"] = skip
	}
	if err := c.LexDo(ctx, util.Query, "", "org.tangled.temp.git.listCommitsByRef", params, nil, &out); err != nil {
		return nil, err
	}

	return &out, nil
}
