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

package org_tangled

// schema: org.tangled.repo.countIssues

import (
	"context"

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

const (
	RepoCountIssuesNSID = "org.tangled.repo.countIssues"
)

// RepoCountIssues_Output is the output of a org.tangled.repo.countIssues call.
type RepoCountIssues_Output struct {
	// count: Total number of matching records.
	Count int64 `json:"count" cborgen:"count"`
	// distinctAuthors: Number of distinct authors among the matching records.
	DistinctAuthors int64 `json:"distinctAuthors" cborgen:"distinctAuthors"`
}

// RepoCountIssues calls the XRPC method "org.tangled.repo.countIssues".
//
// author: Restrict to issues authored by this user DID.
// state: Restrict to issues whose latest derived state matches.
// subject: Repo DID to list issues for
func RepoCountIssues(ctx context.Context, c util.LexClient, author string, state string, subject string) (*RepoCountIssues_Output, error) {
	var out RepoCountIssues_Output

	params := map[string]interface{}{}
	if author != "" {
		params["author"] = author
	}
	if state != "" {
		params["state"] = state
	}
	params["subject"] = subject
	if err := c.LexDo(ctx, util.Query, "", "org.tangled.repo.countIssues", params, nil, &out); err != nil {
		return nil, err
	}

	return &out, nil
}
