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

package tangled

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

import (
	"context"

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

const (
	GitTempGetEntryNSID = "sh.tangled.git.temp.getEntry"
)

// GitTempGetEntry_Output is the output of a sh.tangled.git.temp.getEntry call.
type GitTempGetEntry_Output struct {
	LastCommit *GitTempDefs_Commit `json:"lastCommit,omitempty" cborgen:"lastCommit,omitempty"`
	Mode       string              `json:"mode" cborgen:"mode"`
	// name: The file name
	Name string `json:"name" cborgen:"name"`
	Oid  string `json:"oid" cborgen:"oid"`
	// submodule: Submodule information if path is a submodule
	Submodule *GitTempDefs_Submodule `json:"submodule,omitempty" cborgen:"submodule,omitempty"`
}

// GitTempGetEntry calls the XRPC method "sh.tangled.git.temp.getEntry".
//
// path: path of the entity
// ref: Git revision (branch, tag, or commit id)
// repo: DID of the repository
func GitTempGetEntry(ctx context.Context, c util.LexClient, path string, ref string, repo string) (*GitTempGetEntry_Output, error) {
	var out GitTempGetEntry_Output

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

	return &out, nil
}
