Skip to content

Commit

Permalink
kotlin: Pull in change from latest codegen (#1775)
Browse files Browse the repository at this point in the history
Pull in kotlin templates from the `openapi-codegen` repo
Also pull in latest changes from `lib-openapi.json`

For now `regen_openapi.sh` for kotlin is disabled in CI
  • Loading branch information
svix-jplatte authored Mar 3, 2025
2 parents 9982680 + d6e34a5 commit 452b3a6
Show file tree
Hide file tree
Showing 31 changed files with 634 additions and 13 deletions.
1 change: 0 additions & 1 deletion kotlin/lib/src/main/kotlin/Application.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ data class ApplicationListOptions(
data class ApplicationCreateOptions(val idempotencyKey: String? = null)

class Application(private val client: SvixHttpClient) {

/** List of all the organization's applications. */
suspend fun list(
options: ApplicationListOptions = ApplicationListOptions()
Expand Down
1 change: 0 additions & 1 deletion kotlin/lib/src/main/kotlin/Authentication.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ data class AuthenticationDashboardAccessOptions(val idempotencyKey: String? = nu
data class AuthenticationLogoutOptions(val idempotencyKey: String? = null)

class Authentication(private val client: SvixHttpClient) {

/**
* Use this function to get magic links (and authentication codes) for connecting your users to
* the Consumer Application Portal.
Expand Down
1 change: 0 additions & 1 deletion kotlin/lib/src/main/kotlin/BackgroundTask.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ data class BackgroundTaskListOptions(
)

class BackgroundTask(private val client: SvixHttpClient) {

/** List background tasks executed in the past 90 days. */
suspend fun list(
options: BackgroundTaskListOptions = BackgroundTaskListOptions()
Expand Down
1 change: 0 additions & 1 deletion kotlin/lib/src/main/kotlin/Endpoint.kt
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ data class EndpointGetStatsOptions(
)

class Endpoint(private val client: SvixHttpClient) {

/** List the application's endpoints. */
suspend fun list(
appId: String,
Expand Down
46 changes: 46 additions & 0 deletions kotlin/lib/src/main/kotlin/Environment.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// this file is @generated
package com.svix.kotlin

import com.svix.kotlin.models.EnvironmentIn
import com.svix.kotlin.models.EnvironmentOut
import okhttp3.Headers

data class EnvironmentExportOptions(val idempotencyKey: String? = null)

data class EnvironmentImportOptions(val idempotencyKey: String? = null)

class Environment(private val client: SvixHttpClient) {
/** Download a JSON file containing all org-settings and event types. */
suspend fun export(
options: EnvironmentExportOptions = EnvironmentExportOptions()
): EnvironmentOut {
val url = client.newUrlBuilder().encodedPath("/api/v1/environment/export")
val headers = Headers.Builder()
options.idempotencyKey?.let { headers.add("idempotency-key", it) }
return client.executeRequest<Any, EnvironmentOut>(
"POST",
url.build(),
headers = headers.build(),
)
}

/**
* Import a configuration into the active organization. It doesn't delete anything, only
* adds/updates what was passed to it.
*/
suspend fun import(
environmentIn: EnvironmentIn,
options: EnvironmentImportOptions = EnvironmentImportOptions(),
) {
val url = client.newUrlBuilder().encodedPath("/api/v1/environment/import")
val headers = Headers.Builder()
options.idempotencyKey?.let { headers.add("idempotency-key", it) }

client.executeRequest<EnvironmentIn, Boolean>(
"POST",
url.build(),
headers = headers.build(),
reqBody = environmentIn,
)
}
}
1 change: 0 additions & 1 deletion kotlin/lib/src/main/kotlin/EventType.kt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ data class EventTypeDeleteOptions(
)

class EventType(private val client: SvixHttpClient) {

/** Return the list of event types. */
suspend fun list(
options: EventTypeListOptions = EventTypeListOptions()
Expand Down
10 changes: 10 additions & 0 deletions kotlin/lib/src/main/kotlin/Health.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// this file is @generated
package com.svix.kotlin

class Health(private val client: SvixHttpClient) {
/** Verify the API server is up and running. */
suspend fun get() {
val url = client.newUrlBuilder().encodedPath("/api/v1/health")
client.executeRequest<Any, Boolean>("GET", url.build())
}
}
156 changes: 156 additions & 0 deletions kotlin/lib/src/main/kotlin/IngestEndpoint.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
// this file is @generated
package com.svix.kotlin

import com.svix.kotlin.models.IngestEndpointHeadersIn
import com.svix.kotlin.models.IngestEndpointHeadersOut
import com.svix.kotlin.models.IngestEndpointIn
import com.svix.kotlin.models.IngestEndpointOut
import com.svix.kotlin.models.IngestEndpointSecretIn
import com.svix.kotlin.models.IngestEndpointSecretOut
import com.svix.kotlin.models.IngestEndpointUpdate
import com.svix.kotlin.models.ListResponseIngestEndpointOut
import com.svix.kotlin.models.Ordering
import okhttp3.Headers

data class IngestEndpointListOptions(
/** Limit the number of returned items */
val limit: ULong? = null,
/** The iterator returned from a prior invocation */
val iterator: String? = null,
/** The sorting order of the returned items */
val order: Ordering? = null,
)

data class IngestEndpointCreateOptions(val idempotencyKey: String? = null)

data class IngestEndpointRotateSecretOptions(val idempotencyKey: String? = null)

class IngestEndpoint(private val client: SvixHttpClient) {
/** List ingest endpoints. */
suspend fun list(
options: IngestEndpointListOptions = IngestEndpointListOptions()
): ListResponseIngestEndpointOut {
val url = client.newUrlBuilder().encodedPath("/ingest/api/v1/source/{source_id}/endpoint")
options.limit?.let { url.addQueryParameter("limit", serializeQueryParam(it)) }
options.iterator?.let { url.addQueryParameter("iterator", it) }
options.order?.let { url.addQueryParameter("order", serializeQueryParam(it)) }
return client.executeRequest<Any, ListResponseIngestEndpointOut>("GET", url.build())
}

/** Create an ingest endpoint. */
suspend fun create(
ingestEndpointIn: IngestEndpointIn,
options: IngestEndpointCreateOptions = IngestEndpointCreateOptions(),
): IngestEndpointOut {
val url = client.newUrlBuilder().encodedPath("/ingest/api/v1/source/{source_id}/endpoint")
val headers = Headers.Builder()
options.idempotencyKey?.let { headers.add("idempotency-key", it) }

return client.executeRequest<IngestEndpointIn, IngestEndpointOut>(
"POST",
url.build(),
headers = headers.build(),
reqBody = ingestEndpointIn,
)
}

/** Get an ingest endpoint. */
suspend fun get(endpointId: String): IngestEndpointOut {
val url =
client
.newUrlBuilder()
.encodedPath("/ingest/api/v1/source/{source_id}/endpoint/$endpointId")
return client.executeRequest<Any, IngestEndpointOut>("GET", url.build())
}

/** Update an ingest endpoint. */
suspend fun update(
endpointId: String,
ingestEndpointUpdate: IngestEndpointUpdate,
): IngestEndpointOut {
val url =
client
.newUrlBuilder()
.encodedPath("/ingest/api/v1/source/{source_id}/endpoint/$endpointId")

return client.executeRequest<IngestEndpointUpdate, IngestEndpointOut>(
"PUT",
url.build(),
reqBody = ingestEndpointUpdate,
)
}

/** Delete an ingest endpoint. */
suspend fun delete(endpointId: String) {
val url =
client
.newUrlBuilder()
.encodedPath("/ingest/api/v1/source/{source_id}/endpoint/$endpointId")
client.executeRequest<Any, Boolean>("DELETE", url.build())
}

/** Get the additional headers to be sent with the ingest. */
suspend fun getHeaders(endpointId: String): IngestEndpointHeadersOut {
val url =
client
.newUrlBuilder()
.encodedPath("/ingest/api/v1/source/{source_id}/endpoint/$endpointId/headers")
return client.executeRequest<Any, IngestEndpointHeadersOut>("GET", url.build())
}

/** Set the additional headers to be sent to the endpoint. */
suspend fun updateHeaders(
endpointId: String,
ingestEndpointHeadersIn: IngestEndpointHeadersIn,
) {
val url =
client
.newUrlBuilder()
.encodedPath("/ingest/api/v1/source/{source_id}/endpoint/$endpointId/headers")

client.executeRequest<IngestEndpointHeadersIn, Boolean>(
"PUT",
url.build(),
reqBody = ingestEndpointHeadersIn,
)
}

/**
* Get an ingest endpoint's signing secret.
*
* This is used to verify the authenticity of the webhook. For more information please refer to
* [the consuming webhooks docs](https://docs.svix.com/consuming-webhooks/).
*/
suspend fun getSecret(endpointId: String): IngestEndpointSecretOut {
val url =
client
.newUrlBuilder()
.encodedPath("/ingest/api/v1/source/{source_id}/endpoint/$endpointId/secret")
return client.executeRequest<Any, IngestEndpointSecretOut>("GET", url.build())
}

/**
* Rotates an ingest endpoint's signing secret.
*
* The previous secret will remain valid for the next 24 hours.
*/
suspend fun rotateSecret(
endpointId: String,
ingestEndpointSecretIn: IngestEndpointSecretIn,
options: IngestEndpointRotateSecretOptions = IngestEndpointRotateSecretOptions(),
) {
val url =
client
.newUrlBuilder()
.encodedPath("/ingest/api/v1/source/{source_id}/endpoint/$endpointId/secret/rotate")
val headers = Headers.Builder()
options.idempotencyKey?.let { headers.add("idempotency-key", it) }

client.executeRequest<IngestEndpointSecretIn, Boolean>(
"POST",
url.build(),
headers = headers.build(),
reqBody = ingestEndpointSecretIn,
)
}
}
1 change: 0 additions & 1 deletion kotlin/lib/src/main/kotlin/Integration.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ data class IntegrationCreateOptions(val idempotencyKey: String? = null)
data class IntegrationRotateKeyOptions(val idempotencyKey: String? = null)

class Integration(private val client: SvixHttpClient) {

/** List the application's integrations. */
suspend fun list(
appId: String,
Expand Down
7 changes: 3 additions & 4 deletions kotlin/lib/src/main/kotlin/Message.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
package com.svix.kotlin

import com.svix.kotlin.models.ApplicationIn
import com.svix.kotlin.models.ExpungAllContentsOut
import com.svix.kotlin.models.ExpungeAllContentsOut
import com.svix.kotlin.models.ListResponseMessageOut
import com.svix.kotlin.models.MessageIn
import com.svix.kotlin.models.MessageOut
Expand Down Expand Up @@ -45,7 +45,6 @@ data class MessageGetOptions(
)

class Message(private val client: SvixHttpClient) {

/**
* List all of the application's messages.
*
Expand Down Expand Up @@ -117,11 +116,11 @@ class Message(private val client: SvixHttpClient) {
suspend fun expungeAllContents(
appId: String,
options: MessageExpungeAllContentsOptions = MessageExpungeAllContentsOptions(),
): ExpungAllContentsOut {
): ExpungeAllContentsOut {
val url = client.newUrlBuilder().encodedPath("/api/v1/app/$appId/msg/expunge-all-contents")
val headers = Headers.Builder()
options.idempotencyKey?.let { headers.add("idempotency-key", it) }
return client.executeRequest<Any, ExpungAllContentsOut>(
return client.executeRequest<Any, ExpungeAllContentsOut>(
"POST",
url.build(),
headers = headers.build(),
Expand Down
1 change: 0 additions & 1 deletion kotlin/lib/src/main/kotlin/MessageAttempt.kt
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ data class MessageAttemptListAttemptedDestinationsOptions(
data class MessageAttemptResendOptions(val idempotencyKey: String? = null)

class MessageAttempt(private val client: SvixHttpClient) {

/**
* List attempts by endpoint id
*
Expand Down
1 change: 0 additions & 1 deletion kotlin/lib/src/main/kotlin/OperationalWebhookEndpoint.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ data class OperationalWebhookEndpointCreateOptions(val idempotencyKey: String? =
data class OperationalWebhookEndpointRotateSecretOptions(val idempotencyKey: String? = null)

class OperationalWebhookEndpoint(private val client: SvixHttpClient) {

/** List operational webhook endpoints. */
suspend fun list(
options: OperationalWebhookEndpointListOptions = OperationalWebhookEndpointListOptions()
Expand Down
1 change: 0 additions & 1 deletion kotlin/lib/src/main/kotlin/Statistics.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import okhttp3.Headers
data class StatisticsAggregateAppStatsOptions(val idempotencyKey: String? = null)

class Statistics(private val client: SvixHttpClient) {

/**
* Creates a background task to calculate the message destinations for all applications in the
* environment.
Expand Down
1 change: 1 addition & 0 deletions kotlin/lib/src/main/kotlin/models/EndpointIn.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ data class EndpointIn(
val description: String? = null,
val disabled: Boolean? = null,
val filterTypes: Set<String>? = null,
val headers: Map<String, String>? = null,
val metadata: Map<String, String>? = null,
val rateLimit: UShort? = null,
val secret: String? = null,
Expand Down
11 changes: 11 additions & 0 deletions kotlin/lib/src/main/kotlin/models/ExpungeAllContentsOut.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// This file is @generated
package com.svix.kotlin.models

import kotlinx.serialization.Serializable

@Serializable
data class ExpungeAllContentsOut(
val id: String,
val status: BackgroundTaskStatus,
val task: BackgroundTaskType,
)
6 changes: 6 additions & 0 deletions kotlin/lib/src/main/kotlin/models/IngestEndpointHeadersIn.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// This file is @generated
package com.svix.kotlin.models

import kotlinx.serialization.Serializable

@Serializable data class IngestEndpointHeadersIn(val headers: Map<String, String>)
7 changes: 7 additions & 0 deletions kotlin/lib/src/main/kotlin/models/IngestEndpointHeadersOut.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// This file is @generated
package com.svix.kotlin.models

import kotlinx.serialization.Serializable

@Serializable
data class IngestEndpointHeadersOut(val headers: Map<String, String>, val sensitive: Set<String>)
15 changes: 15 additions & 0 deletions kotlin/lib/src/main/kotlin/models/IngestEndpointIn.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// This file is @generated
package com.svix.kotlin.models

import kotlinx.serialization.Serializable

@Serializable
data class IngestEndpointIn(
val description: String? = null,
val disabled: Boolean? = null,
val metadata: Map<String, String>? = null,
val rateLimit: UShort? = null,
val secret: String? = null,
val uid: String? = null,
val url: String,
)
18 changes: 18 additions & 0 deletions kotlin/lib/src/main/kotlin/models/IngestEndpointOut.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// This file is @generated
package com.svix.kotlin.models

import kotlinx.datetime.Instant
import kotlinx.serialization.Serializable

@Serializable
data class IngestEndpointOut(
val createdAt: Instant,
val description: String,
val disabled: Boolean? = null,
val id: String,
val metadata: Map<String, String>,
val rateLimit: UShort? = null,
val uid: String? = null,
val updatedAt: Instant,
val url: String,
)
6 changes: 6 additions & 0 deletions kotlin/lib/src/main/kotlin/models/IngestEndpointSecretIn.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// This file is @generated
package com.svix.kotlin.models

import kotlinx.serialization.Serializable

@Serializable data class IngestEndpointSecretIn(val key: String? = null)
Loading

0 comments on commit 452b3a6

Please sign in to comment.