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

package tangled

// schema: sh.tangled.repo.branch

import (
	"context"

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

const (
	RepoBranchNSID = "sh.tangled.repo.branch"
)

// RepoBranch_Output is the output of a sh.tangled.repo.branch call.
type RepoBranch_Output struct {
	Author *RepoBranch_Signature `json:"author,omitempty" cborgen:"author,omitempty"`
	// hash: Latest commit hash on this branch
	Hash string `json:"hash" cborgen:"hash"`
	// isDefault: Whether this is the default branch
	IsDefault *bool `json:"isDefault,omitempty" cborgen:"isDefault,omitempty"`
	// message: Latest commit message
	Message *string `json:"message,omitempty" cborgen:"message,omitempty"`
	// name: Branch name
	Name string `json:"name" cborgen:"name"`
	// shortHash: Short commit hash
	ShortHash *string `json:"shortHash,omitempty" cborgen:"shortHash,omitempty"`
	// when: Timestamp of latest commit
	When string `json:"when" cborgen:"when"`
}

// RepoBranch_Signature is a "signature" in the sh.tangled.repo.branch schema.
type RepoBranch_Signature struct {
	// email: Author email
	Email string `json:"email" cborgen:"email"`
	// name: Author name
	Name string `json:"name" cborgen:"name"`
	// when: Author timestamp
	When string `json:"when" cborgen:"when"`
}

// RepoBranch calls the XRPC method "sh.tangled.repo.branch".
//
// name: Branch name to get information for
// repo: Repository identifier in format 'did:plc:.../repoName'
func RepoBranch(ctx context.Context, c util.LexClient, name string, repo string) (*RepoBranch_Output, error) {
	var out RepoBranch_Output

	params := map[string]interface{}{}
	params["name"] = name
	params["repo"] = repo
	if err := c.LexDo(ctx, util.Query, "", "sh.tangled.repo.branch", params, nil, &out); err != nil {
		return nil, err
	}

	return &out, nil
}
