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

package tangled

// schema: sh.tangled.repo.log

import (
	"bytes"
	"context"

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

const (
	RepoLogNSID = "sh.tangled.repo.log"
)

// RepoLog calls the XRPC method "sh.tangled.repo.log".
//
// cursor: Pagination cursor (commit SHA)
// limit: Maximum number of commits to return
// path: Path to filter commits by
// ref: Git reference (branch, tag, or commit SHA)
// repo: Repository identifier in format 'did:plc:.../repoName'
func RepoLog(ctx context.Context, c util.LexClient, cursor string, limit int64, path string, 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 path != "" {
		params["path"] = path
	}
	params["ref"] = ref
	params["repo"] = repo
	if err := c.LexDo(ctx, util.Query, "", "sh.tangled.repo.log", params, nil, buf); err != nil {
		return nil, err
	}

	return buf.Bytes(), nil
}
