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

package tangled

// schema: sh.tangled.repo.getDefaultBranch

import (
	"context"

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

const (
	RepoGetDefaultBranchNSID = "sh.tangled.repo.getDefaultBranch"
)

// RepoGetDefaultBranch_Output is the output of a sh.tangled.repo.getDefaultBranch call.
type RepoGetDefaultBranch_Output struct {
	Author *RepoGetDefaultBranch_Signature `json:"author,omitempty" cborgen:"author,omitempty"`
	// hash: Latest commit hash on default branch
	Hash string `json:"hash" cborgen:"hash"`
	// message: Latest commit message
	Message *string `json:"message,omitempty" cborgen:"message,omitempty"`
	// name: Default 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"`
}

// RepoGetDefaultBranch_Signature is a "signature" in the sh.tangled.repo.getDefaultBranch schema.
type RepoGetDefaultBranch_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"`
}

// RepoGetDefaultBranch calls the XRPC method "sh.tangled.repo.getDefaultBranch".
//
// repo: Repository identifier in format 'did:plc:.../repoName'
func RepoGetDefaultBranch(ctx context.Context, c util.LexClient, repo string) (*RepoGetDefaultBranch_Output, error) {
	var out RepoGetDefaultBranch_Output

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

	return &out, nil
}
