All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.ecwid.apiclient.v3.metric.MetricHelpers.kt Maven / Gradle / Ivy

There is a newer version: 0.347.0
Show newest version
package com.ecwid.apiclient.v3.metric

import com.ecwid.apiclient.v3.httptransport.HttpResponse
import com.ecwid.apiclient.v3.impl.RequestInfo

internal fun RequestInfo.getFirstPathSegment() = this
	.pathSegments
	.firstOrNull() ?: ""

internal fun extractStatusFromHttpResponse(result: HttpResponse): String {
	return when (result) {
		is HttpResponse.Error -> result.statusCode.toString()
		is HttpResponse.Success -> 200.toString()
		is HttpResponse.TransportError -> "transport_error"
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy