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

package atproto

// schema: com.atproto.sync.listRepos

import (
	"context"

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

// SyncListRepos_Output is the output of a com.atproto.sync.listRepos call.
type SyncListRepos_Output struct {
	Cursor *string               `json:"cursor,omitempty" cborgen:"cursor,omitempty"`
	Repos  []*SyncListRepos_Repo `json:"repos" cborgen:"repos"`
}

// SyncListRepos_Repo is a "repo" in the com.atproto.sync.listRepos schema.
type SyncListRepos_Repo struct {
	Active *bool  `json:"active,omitempty" cborgen:"active,omitempty"`
	Did    string `json:"did" cborgen:"did"`
	// head: Current repo commit CID
	Head string `json:"head" cborgen:"head"`
	Rev  string `json:"rev" cborgen:"rev"`
	// status: If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted.
	Status *string `json:"status,omitempty" cborgen:"status,omitempty"`
}

// SyncListRepos calls the XRPC method "com.atproto.sync.listRepos".
func SyncListRepos(ctx context.Context, c util.LexClient, cursor string, limit int64) (*SyncListRepos_Output, error) {
	var out SyncListRepos_Output

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

	return &out, nil
}
