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

package tangled

// schema: sh.tangled.knot.listKeys

import (
	"context"

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

const (
	KnotListKeysNSID = "sh.tangled.knot.listKeys"
)

// KnotListKeys_Output is the output of a sh.tangled.knot.listKeys call.
type KnotListKeys_Output struct {
	// cursor: Pagination cursor for next page
	Cursor *string                   `json:"cursor,omitempty" cborgen:"cursor,omitempty"`
	Keys   []*KnotListKeys_PublicKey `json:"keys" cborgen:"keys"`
}

// KnotListKeys_PublicKey is a "publicKey" in the sh.tangled.knot.listKeys schema.
type KnotListKeys_PublicKey struct {
	// createdAt: Key upload timestamp
	CreatedAt string `json:"createdAt" cborgen:"createdAt"`
	// did: DID associated with the public key
	Did string `json:"did" cborgen:"did"`
	// key: Public key contents
	Key string `json:"key" cborgen:"key"`
}

// KnotListKeys calls the XRPC method "sh.tangled.knot.listKeys".
//
// cursor: Pagination cursor
// limit: Maximum number of keys to return
func KnotListKeys(ctx context.Context, c util.LexClient, cursor string, limit int64) (*KnotListKeys_Output, error) {
	var out KnotListKeys_Output

	params := map[string]interface{}{}
	if cursor != "" {
		params["cursor"] = cursor
	}
	if limit != 0 {
		params["limit"] = limit
	}
	if err := c.LexDo(ctx, util.Query, "", "sh.tangled.knot.listKeys", params, nil, &out); err != nil {
		return nil, err
	}

	return &out, nil
}
