Skip to content

Commit

Permalink
fix: no api key in public Elevation constructors
Browse files Browse the repository at this point in the history
  • Loading branch information
DadiBit committed Jun 11, 2023
1 parent 2c1c69a commit 60d6109
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions lib/src/main/kotlin/com/openmeteo/api/Elevation.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,28 @@ object Elevation : Endpoint(
val longitude: String,
override val apikey: String? = null,
) : Q.CommercialLicense {
constructor(latitude: Float, longitude: Float) : this(
latitude.toString(),
longitude.toString()
)
constructor(latitudes: List<Float>, longitudes: List<Float>) : this(
constructor(latitude: Float, longitude: Float, apikey: String? = null)
: this(latitude.toString(), longitude.toString(), apikey)

constructor(latitudes: List<Float>, longitudes: List<Float>, apikey: String? = null)
: this(
latitudes.joinToString(","),
longitudes.joinToString(","),
apikey,
)
constructor(vararg coordinates: Coordinate) : this(

constructor(vararg coordinates: Coordinate, apikey: String? = null)
: this(
coordinates.map { it.latitude },
coordinates.map { it.longitude },
apikey,
)
constructor(vararg coordinates: Pair<Float, Float>) : this(

constructor(vararg coordinates: Pair<Float, Float>, apikey: String? = null)
: this(
coordinates.map { it.first },
coordinates.map { it.second },
apikey,
)

}
Expand Down

0 comments on commit 60d6109

Please sign in to comment.