// this file is @generated
package com.svix.kotlin

import com.svix.kotlin.models.EndpointHeadersOut
import com.svix.kotlin.models.HttpSinkHeadersPatchIn

class Streaming(private val client: SvixHttpClient) {
    val eventType: StreamingEventType = StreamingEventType(client)

    val events: StreamingEvents = StreamingEvents(client)

    val sink: StreamingSink = StreamingSink(client)

    val stream: StreamingStream = StreamingStream(client)

    /**
     * Get the HTTP sink headers.
     *
     * Only valid for `http` or `otelTracing` sinks.
     */
    suspend fun sinkHeadersGet(streamId: String, sinkId: String): EndpointHeadersOut {
        val url =
            client.newUrlBuilder().encodedPath("/api/v1/stream/$streamId/sink/$sinkId/headers")
        return client.executeRequest<Any, EndpointHeadersOut>("GET", url.build())
    }

    /**
     * Updates the Sink's headers.
     *
     * Only valid for `http` or `otelTracing` sinks.
     */
    suspend fun sinkHeadersPatch(
        streamId: String,
        sinkId: String,
        httpSinkHeadersPatchIn: HttpSinkHeadersPatchIn,
    ): EndpointHeadersOut {
        val url =
            client.newUrlBuilder().encodedPath("/api/v1/stream/$streamId/sink/$sinkId/headers")

        return client.executeRequest<HttpSinkHeadersPatchIn, EndpointHeadersOut>(
            "PATCH",
            url.build(),
            reqBody = httpSinkHeadersPatchIn,
        )
    }
}
