readme.md added

This commit is contained in:
2024-07-22 13:40:23 +01:00
parent 97773c7b01
commit 59c657eb05
15 changed files with 211 additions and 85 deletions

View File

@@ -0,0 +1,7 @@
package org.example.api
import java.util.*
fun createBasicAuthTokenForHeader(username: String, password: String) =
StringBuilder("Basic ").append(Base64.getEncoder().encodeToString("$username:$password".toByteArray()))
.toString()

View File

@@ -36,7 +36,6 @@ class BookerApi {
.setLenient()
.create()
private fun buildOkHttpClient(timeoutSeconds: Long = 30L): OkHttpClient {
val builder = OkHttpClient.Builder()

View File

@@ -33,20 +33,20 @@ interface RestfulBookerApi {
suspend fun updateBooking(
@Path("id") id: String,
@Body booking: BookingRequest,
@Header("Authorization") token: String
@Header("Authorization") basicHeaderToken: String
): Response<BookingResponse>
@Headers("Content-Type:application/json", "Accept: application/json")
@PATCH("booking/{id}")
suspend fun partialUpdateBooking(
@Path("id") id: String,
@Header("Authorization") token: String,
@Header("Authorization") basicHeaderToken: String,
@Body update: UpdateBookingRequest
): Response<BookingResponse>
@DELETE("booking/{id}")
suspend fun deleteBooking(
@Path("id") id: String,
@Header("Authorization") token: String
@Header("Authorization") basicHeaderToken: String
): Response<Any>
}

View File

@@ -7,5 +7,5 @@ data class BookingResponse(
var totalprice: Int,
var depositpaid: Boolean,
var bookingdates: Bookingdates,
var additionalneeds: String
var additionalneeds: String?
)

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="warn">
<Properties>
<Property name="basePath">Classpath</Property>
<Property name="basePath">./</Property>
</Properties>
<Appenders>
<RollingFile name="fileLogger" fileName="${basePath}/app-info.html"