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

package tangled

// schema: sh.tangled.git.temp.getBranch

import (
	"context"

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

const (
	GitTempGetBranchNSID = "sh.tangled.git.temp.getBranch"
)

// GitTempGetBranch_Output is the output of a sh.tangled.git.temp.getBranch call.
type GitTempGetBranch_Output struct {
	Author *GitTempDefs_Signature `json:"author,omitempty" cborgen:"author,omitempty"`
	// hash: Latest commit hash on this branch
	Hash string `json:"hash" cborgen:"hash"`
	// message: Latest commit message
	Message *string `json:"message,omitempty" cborgen:"message,omitempty"`
	// name: Branch name
	Name string `json:"name" cborgen:"name"`
	// when: Timestamp of latest commit
	When string `json:"when" cborgen:"when"`
}

// GitTempGetBranch calls the XRPC method "sh.tangled.git.temp.getBranch".
//
// name: Branch name to get information for
// repo: AT-URI of the repository
func GitTempGetBranch(ctx context.Context, c util.LexClient, name string, repo string) (*GitTempGetBranch_Output, error) {
	var out GitTempGetBranch_Output

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

	return &out, nil
}
