Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/**
* Svix API
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.1.1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package com.svix.kotlin.internal.apis
import com.svix.kotlin.models.AggregateEventTypesOut
import com.svix.kotlin.models.AppUsageStatsIn
import com.svix.kotlin.models.AppUsageStatsOut
import com.svix.kotlin.models.AttemptStatisticsResponse
import com.svix.kotlin.models.HTTPValidationError
import com.svix.kotlin.models.HttpErrorOut
import com.svix.kotlin.internal.infrastructure.ApiClient
import com.svix.kotlin.internal.infrastructure.ClientException
import com.svix.kotlin.internal.infrastructure.ClientError
import com.svix.kotlin.internal.infrastructure.ServerException
import com.svix.kotlin.internal.infrastructure.ServerError
import com.svix.kotlin.internal.infrastructure.MultiValueMap
import com.svix.kotlin.internal.infrastructure.RequestConfig
import com.svix.kotlin.internal.infrastructure.RequestMethod
import com.svix.kotlin.internal.infrastructure.ResponseType
import com.svix.kotlin.internal.infrastructure.Success
import com.svix.kotlin.internal.infrastructure.toMultiValue
class StatisticsApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
companion object {
@JvmStatic
val defaultBasePath: String by lazy {
System.getProperties().getProperty("com.svix.kotlin.internal.baseUrl", "https://api.eu.svix.com")
}
}
/**
* Aggregate App Stats
* Creates a background task to calculate the message destinations for all applications in the environment. Note that this endpoint is asynchronous. You will need to poll the `Get Background Task` endpoint to retrieve the results of the operation.
* @param appUsageStatsIn
* @param idempotencyKey The request's idempotency key (optional)
* @return AppUsageStatsOut
* @throws UnsupportedOperationException If the API returns an informational or redirection response
* @throws ClientException If the API returns a client error response
* @throws ServerException If the API returns a server error response
*/
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
suspend fun v1StatisticsAggregateAppStats(appUsageStatsIn: AppUsageStatsIn, idempotencyKey: kotlin.String?) : AppUsageStatsOut {
val localVariableConfig = v1StatisticsAggregateAppStatsRequestConfig(appUsageStatsIn = appUsageStatsIn, idempotencyKey = idempotencyKey)
val localVarResponse = request(
localVariableConfig
)
return when (localVarResponse.responseType) {
ResponseType.Success -> (localVarResponse as Success<*>).data as AppUsageStatsOut
ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
ResponseType.ClientError -> {
val localVarError = localVarResponse as ClientError<*>
throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
}
ResponseType.ServerError -> {
val localVarError = localVarResponse as ServerError<*>
throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
}
}
}
/**
* To obtain the request config of the operation v1StatisticsAggregateAppStats
*
* @param appUsageStatsIn
* @param idempotencyKey The request's idempotency key (optional)
* @return RequestConfig
*/
fun v1StatisticsAggregateAppStatsRequestConfig(appUsageStatsIn: AppUsageStatsIn, idempotencyKey: kotlin.String?) : RequestConfig {
val localVariableBody = appUsageStatsIn
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap = mutableMapOf()
idempotencyKey?.apply { localVariableHeaders["idempotency-key"] = this.toString() }
return RequestConfig(
method = RequestMethod.POST,
path = "/api/v1/stats/usage/app",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
}
/**
* Aggregate Event Types
* Creates a background task to calculate the listed event types for all apps in the organization. Note that this endpoint is asynchronous. You will need to poll the `Get Background Task` endpoint to retrieve the results of the operation.
* @return AggregateEventTypesOut
* @throws UnsupportedOperationException If the API returns an informational or redirection response
* @throws ClientException If the API returns a client error response
* @throws ServerException If the API returns a server error response
*/
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
suspend fun v1StatisticsAggregateEventTypes() : AggregateEventTypesOut {
val localVariableConfig = v1StatisticsAggregateEventTypesRequestConfig()
val localVarResponse = request(
localVariableConfig
)
return when (localVarResponse.responseType) {
ResponseType.Success -> (localVarResponse as Success<*>).data as AggregateEventTypesOut
ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
ResponseType.ClientError -> {
val localVarError = localVarResponse as ClientError<*>
throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
}
ResponseType.ServerError -> {
val localVarError = localVarResponse as ServerError<*>
throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
}
}
}
/**
* To obtain the request config of the operation v1StatisticsAggregateEventTypes
*
* @return RequestConfig
*/
fun v1StatisticsAggregateEventTypesRequestConfig() : RequestConfig {
val localVariableBody = null
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap = mutableMapOf()
return RequestConfig(
method = RequestMethod.PUT,
path = "/api/v1/stats/usage/event-types",
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
}
/**
* Get App Attempt Stats
* Returns application-level statistics on message attempts
* @param appId The app's ID or UID
* @param startDate Filter the range to data starting from this date (optional)
* @param endDate Filter the range to data ending by this date (optional)
* @return AttemptStatisticsResponse
* @throws UnsupportedOperationException If the API returns an informational or redirection response
* @throws ClientException If the API returns a client error response
* @throws ServerException If the API returns a server error response
*/
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
suspend fun v1StatsAppAttempts(appId: kotlin.String, startDate: java.time.OffsetDateTime?, endDate: java.time.OffsetDateTime?) : AttemptStatisticsResponse {
val localVariableConfig = v1StatsAppAttemptsRequestConfig(appId = appId, startDate = startDate, endDate = endDate)
val localVarResponse = request(
localVariableConfig
)
return when (localVarResponse.responseType) {
ResponseType.Success -> (localVarResponse as Success<*>).data as AttemptStatisticsResponse
ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
ResponseType.ClientError -> {
val localVarError = localVarResponse as ClientError<*>
throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
}
ResponseType.ServerError -> {
val localVarError = localVarResponse as ServerError<*>
throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
}
}
}
/**
* To obtain the request config of the operation v1StatsAppAttempts
*
* @param appId The app's ID or UID
* @param startDate Filter the range to data starting from this date (optional)
* @param endDate Filter the range to data ending by this date (optional)
* @return RequestConfig
*/
fun v1StatsAppAttemptsRequestConfig(appId: kotlin.String, startDate: java.time.OffsetDateTime?, endDate: java.time.OffsetDateTime?) : RequestConfig {
val localVariableBody = null
val localVariableQuery: MultiValueMap = mutableMapOf>()
.apply {
if (startDate != null) {
put("startDate", listOf(parseDateToQueryString(startDate)))
}
if (endDate != null) {
put("endDate", listOf(parseDateToQueryString(endDate)))
}
}
val localVariableHeaders: MutableMap = mutableMapOf()
return RequestConfig(
method = RequestMethod.GET,
path = "/api/v1/stats/app/{app_id}/attempt".replace("{"+"app_id"+"}", "$appId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
}
/**
* Get Ep Stats
* Returns endpoint-level statistics on message attempts
* @param appId The app's ID or UID
* @param endpointId The ep's ID or UID
* @param startDate Filter the range to data starting from this date (optional)
* @param endDate Filter the range to data ending by this date (optional)
* @return AttemptStatisticsResponse
* @throws UnsupportedOperationException If the API returns an informational or redirection response
* @throws ClientException If the API returns a client error response
* @throws ServerException If the API returns a server error response
*/
@Suppress("UNCHECKED_CAST")
@Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
suspend fun v1StatsEndpointAttempts(appId: kotlin.String, endpointId: kotlin.String, startDate: java.time.OffsetDateTime?, endDate: java.time.OffsetDateTime?) : AttemptStatisticsResponse {
val localVariableConfig = v1StatsEndpointAttemptsRequestConfig(appId = appId, endpointId = endpointId, startDate = startDate, endDate = endDate)
val localVarResponse = request(
localVariableConfig
)
return when (localVarResponse.responseType) {
ResponseType.Success -> (localVarResponse as Success<*>).data as AttemptStatisticsResponse
ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
ResponseType.ClientError -> {
val localVarError = localVarResponse as ClientError<*>
throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
}
ResponseType.ServerError -> {
val localVarError = localVarResponse as ServerError<*>
throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
}
}
}
/**
* To obtain the request config of the operation v1StatsEndpointAttempts
*
* @param appId The app's ID or UID
* @param endpointId The ep's ID or UID
* @param startDate Filter the range to data starting from this date (optional)
* @param endDate Filter the range to data ending by this date (optional)
* @return RequestConfig
*/
fun v1StatsEndpointAttemptsRequestConfig(appId: kotlin.String, endpointId: kotlin.String, startDate: java.time.OffsetDateTime?, endDate: java.time.OffsetDateTime?) : RequestConfig {
val localVariableBody = null
val localVariableQuery: MultiValueMap = mutableMapOf>()
.apply {
if (startDate != null) {
put("startDate", listOf(parseDateToQueryString(startDate)))
}
if (endDate != null) {
put("endDate", listOf(parseDateToQueryString(endDate)))
}
}
val localVariableHeaders: MutableMap = mutableMapOf()
return RequestConfig(
method = RequestMethod.GET,
path = "/api/v1/stats/app/{app_id}/ep/{endpoint_id}/attempt".replace("{"+"app_id"+"}", "$appId").replace("{"+"endpoint_id"+"}", "$endpointId"),
query = localVariableQuery,
headers = localVariableHeaders,
body = localVariableBody
)
}
}