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

package org_tangled

// schema: org.tangled.temp.git.getBlob

import (
	"bytes"
	"context"

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

const (
	TempGitGetBlobNSID = "org.tangled.temp.git.getBlob"
)

// TempGitGetBlob calls the XRPC method "org.tangled.temp.git.getBlob".
//
// download: Serve the blob as an attachment named after the file
// path: Path within the repository tree
// ref: Git reference (branch, tag, or commit SHA)
// repo: DID of the repository
func TempGitGetBlob(ctx context.Context, c util.LexClient, download bool, path string, ref string, repo string) ([]byte, error) {
	buf := new(bytes.Buffer)

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

	return buf.Bytes(), nil
}
