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

package tangled

// schema: sh.tangled.repo.archive

import (
	"bytes"
	"context"

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

const (
	RepoArchiveNSID = "sh.tangled.repo.archive"
)

// RepoArchive calls the XRPC method "sh.tangled.repo.archive".
//
// format: Archive format
// prefix: Prefix for files in the archive
// ref: Git reference (branch, tag, or commit SHA)
// repo: Repository identifier in format 'did:plc:.../repoName'
func RepoArchive(ctx context.Context, c util.LexClient, format string, prefix string, ref string, repo string) ([]byte, error) {
	buf := new(bytes.Buffer)

	params := map[string]interface{}{}
	if format != "" {
		params["format"] = format
	}
	if prefix != "" {
		params["prefix"] = prefix
	}
	params["ref"] = ref
	params["repo"] = repo
	if err := c.LexDo(ctx, util.Query, "", "sh.tangled.repo.archive", params, nil, buf); err != nil {
		return nil, err
	}

	return buf.Bytes(), nil
}
