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

package tangled

// schema: org.tangled.temp.repo.listWebhooks

import (
	"context"

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

const (
	TempRepoListWebhooksNSID = "org.tangled.temp.repo.listWebhooks"
)

// TempRepoListWebhooks_Output is the output of a org.tangled.temp.repo.listWebhooks call.
type TempRepoListWebhooks_Output struct {
	Webhooks []*TempRepoListWebhooks_Webhook `json:"webhooks" cborgen:"webhooks"`
}

// TempRepoListWebhooks_Webhook is a "webhook" in the org.tangled.temp.repo.listWebhooks schema.
type TempRepoListWebhooks_Webhook struct {
	// active: Whether the webhook is currently enabled.
	Active    bool   `json:"active" cborgen:"active"`
	CreatedAt string `json:"createdAt" cborgen:"createdAt"`
	// events: Event types this webhook is subscribed to (e.g. 'push', 'repository:renamed').
	Events []string `json:"events" cborgen:"events"`
	// id: Webhook identifier.
	Id        int64   `json:"id" cborgen:"id"`
	UpdatedAt *string `json:"updatedAt,omitempty" cborgen:"updatedAt,omitempty"`
	// url: Endpoint URL that receives webhook payloads.
	Url string `json:"url" cborgen:"url"`
}

// TempRepoListWebhooks calls the XRPC method "org.tangled.temp.repo.listWebhooks".
//
// repoDid: DID of the repository as minted by the knot.
func TempRepoListWebhooks(ctx context.Context, c util.LexClient, repoDid string) (*TempRepoListWebhooks_Output, error) {
	var out TempRepoListWebhooks_Output

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

	return &out, nil
}
