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

package tangled

// schema: sh.tangled.git.temp2.getCommitStats

import (
	"context"

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

const (
	GitTemp2GetCommitStatsNSID = "sh.tangled.git.temp2.getCommitStats"
)

// GitTemp2GetCommitStats_Month is a "month" in the sh.tangled.git.temp2.getCommitStats schema.
type GitTemp2GetCommitStats_Month struct {
	// commits: Commits attributed to the actor during this month.
	Commits int64 `json:"commits" cborgen:"commits"`
	// start: Start of this UTC calendar month.
	Start string `json:"start" cborgen:"start"`
}

// GitTemp2GetCommitStats_Output is the output of a sh.tangled.git.temp2.getCommitStats call.
type GitTemp2GetCommitStats_Output struct {
	Months []*GitTemp2GetCommitStats_Month `json:"months" cborgen:"months"`
}

// GitTemp2GetCommitStats calls the XRPC method "sh.tangled.git.temp2.getCommitStats".
//
// actor: Actor whose commits to count.
func GitTemp2GetCommitStats(ctx context.Context, c util.LexClient, actor string, months int64) (*GitTemp2GetCommitStats_Output, error) {
	var out GitTemp2GetCommitStats_Output

	params := map[string]interface{}{}
	params["actor"] = actor
	if months != 0 {
		params["months"] = months
	}
	if err := c.LexDo(ctx, util.Query, "", "sh.tangled.git.temp2.getCommitStats", params, nil, &out); err != nil {
		return nil, err
	}

	return &out, nil
}
