-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
kotlin: Pull in change from latest codegen (#1775)
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
Showing
31 changed files
with
634 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
kotlin/lib/src/main/kotlin/models/ExpungeAllContentsOut.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
7
kotlin/lib/src/main/kotlin/models/IngestEndpointHeadersOut.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
Oops, something went wrong.