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

package tangled

// schema: sh.tangled.repo.checkPushAllowed

import (
	"context"

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

const (
	RepoCheckPushAllowedNSID = "sh.tangled.repo.checkPushAllowed"
)

// RepoCheckPushAllowed_Output is the output of a sh.tangled.repo.checkPushAllowed call.
type RepoCheckPushAllowed_Output struct {
	// allowed: Whether the key's owner may push to the repo.
	Allowed bool `json:"allowed" cborgen:"allowed"`
	// did: DID the key resolved to, if a match was found.
	Did *string `json:"did,omitempty" cborgen:"did,omitempty"`
}

// RepoCheckPushAllowed calls the XRPC method "sh.tangled.repo.checkPushAllowed".
//
// key: Public key in OpenSSH authorized_keys format.
// repo: A repo DID.
func RepoCheckPushAllowed(ctx context.Context, c util.LexClient, key string, repo string) (*RepoCheckPushAllowed_Output, error) {
	var out RepoCheckPushAllowed_Output

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

	return &out, nil
}
