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

package bsky

// schema: app.bsky.graph.getListsWithMembership

import (
	"context"

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

// GraphGetListsWithMembership_ListWithMembership is a "listWithMembership" in the app.bsky.graph.getListsWithMembership schema.
//
// A list and an optional list item indicating membership of a target user to that list.
type GraphGetListsWithMembership_ListWithMembership struct {
	List     *GraphDefs_ListView     `json:"list" cborgen:"list"`
	ListItem *GraphDefs_ListItemView `json:"listItem,omitempty" cborgen:"listItem,omitempty"`
}

// GraphGetListsWithMembership_Output is the output of a app.bsky.graph.getListsWithMembership call.
type GraphGetListsWithMembership_Output struct {
	Cursor              *string                                           `json:"cursor,omitempty" cborgen:"cursor,omitempty"`
	ListsWithMembership []*GraphGetListsWithMembership_ListWithMembership `json:"listsWithMembership" cborgen:"listsWithMembership"`
}

// GraphGetListsWithMembership calls the XRPC method "app.bsky.graph.getListsWithMembership".
//
// actor: The account (actor) to check for membership.
// purposes: Optional filter by list purpose. If not specified, all supported types are returned.
func GraphGetListsWithMembership(ctx context.Context, c util.LexClient, actor string, cursor string, limit int64, purposes []string) (*GraphGetListsWithMembership_Output, error) {
	var out GraphGetListsWithMembership_Output

	params := map[string]interface{}{}
	params["actor"] = actor
	if cursor != "" {
		params["cursor"] = cursor
	}
	if limit != 0 {
		params["limit"] = limit
	}
	if len(purposes) != 0 {
		params["purposes"] = purposes
	}
	if err := c.LexDo(ctx, util.Query, "", "app.bsky.graph.getListsWithMembership", params, nil, &out); err != nil {
		return nil, err
	}

	return &out, nil
}
