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

package atproto

// schema: com.atproto.admin.searchAccounts

import (
	"context"

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

// AdminSearchAccounts_Output is the output of a com.atproto.admin.searchAccounts call.
type AdminSearchAccounts_Output struct {
	Accounts []*AdminDefs_AccountView `json:"accounts" cborgen:"accounts"`
	Cursor   *string                  `json:"cursor,omitempty" cborgen:"cursor,omitempty"`
}

// AdminSearchAccounts calls the XRPC method "com.atproto.admin.searchAccounts".
func AdminSearchAccounts(ctx context.Context, c util.LexClient, cursor string, email string, limit int64) (*AdminSearchAccounts_Output, error) {
	var out AdminSearchAccounts_Output

	params := map[string]interface{}{}
	if cursor != "" {
		params["cursor"] = cursor
	}
	if email != "" {
		params["email"] = email
	}
	if limit != 0 {
		params["limit"] = limit
	}
	if err := c.LexDo(ctx, util.Query, "", "com.atproto.admin.searchAccounts", params, nil, &out); err != nil {
		return nil, err
	}

	return &out, nil
}
