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

package tangled

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

import (
	"context"

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

const (
	TempRepoListWebhookDeliveriesNSID = "org.tangled.temp.repo.listWebhookDeliveries"
)

// TempRepoListWebhookDeliveries_Delivery is a "delivery" in the org.tangled.temp.repo.listWebhookDeliveries schema.
type TempRepoListWebhookDeliveries_Delivery struct {
	CreatedAt string `json:"createdAt" cborgen:"createdAt"`
	// deliveryId: UUID for tracking this delivery attempt.
	DeliveryId string `json:"deliveryId" cborgen:"deliveryId"`
	// event: Event type that triggered the delivery.
	Event        string  `json:"event" cborgen:"event"`
	Id           int64   `json:"id" cborgen:"id"`
	RequestBody  *string `json:"requestBody,omitempty" cborgen:"requestBody,omitempty"`
	ResponseBody *string `json:"responseBody,omitempty" cborgen:"responseBody,omitempty"`
	ResponseCode *int64  `json:"responseCode,omitempty" cborgen:"responseCode,omitempty"`
	Success      bool    `json:"success" cborgen:"success"`
	Url          string  `json:"url" cborgen:"url"`
}

// TempRepoListWebhookDeliveries_Output is the output of a org.tangled.temp.repo.listWebhookDeliveries call.
type TempRepoListWebhookDeliveries_Output struct {
	Deliveries []*TempRepoListWebhookDeliveries_Delivery `json:"deliveries" cborgen:"deliveries"`
}

// TempRepoListWebhookDeliveries calls the XRPC method "org.tangled.temp.repo.listWebhookDeliveries".
//
// id: Webhook ID.
// repoDid: DID of the repository as minted by the knot.
func TempRepoListWebhookDeliveries(ctx context.Context, c util.LexClient, id int64, limit int64, repoDid string) (*TempRepoListWebhookDeliveries_Output, error) {
	var out TempRepoListWebhookDeliveries_Output

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

	return &out, nil
}
