diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/ScienceQuest.iml b/.idea/ScienceQuest.iml new file mode 100644 index 0000000..d6ebd48 --- /dev/null +++ b/.idea/ScienceQuest.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..b589d56 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml new file mode 100644 index 0000000..0c0c338 --- /dev/null +++ b/.idea/deploymentTargetDropDown.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 0000000..ce56490 --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,19 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml new file mode 100644 index 0000000..fdf8d99 --- /dev/null +++ b/.idea/kotlinc.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/migrations.xml b/.idea/migrations.xml new file mode 100644 index 0000000..848eaa5 --- /dev/null +++ b/.idea/migrations.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..ac801d8 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/android/.idea/.name b/android/.idea/.name new file mode 100644 index 0000000..7c66ae3 --- /dev/null +++ b/android/.idea/.name @@ -0,0 +1 @@ +ScienceQuest \ No newline at end of file diff --git a/android/.idea/deploymentTargetDropDown.xml b/android/.idea/deploymentTargetDropDown.xml index 81d842f..3d7ae4a 100644 --- a/android/.idea/deploymentTargetDropDown.xml +++ b/android/.idea/deploymentTargetDropDown.xml @@ -2,6 +2,9 @@ + + + @@ -10,12 +13,12 @@ - + - + diff --git a/android/app/src/main/java/fr/iut/sciencequest/model/RequestService.kt b/android/app/src/main/java/fr/iut/sciencequest/model/RequestService.kt new file mode 100644 index 0000000..f302816 --- /dev/null +++ b/android/app/src/main/java/fr/iut/sciencequest/model/RequestService.kt @@ -0,0 +1,31 @@ +package fr.iut.sciencequest.model + +import com.jakewharton.retrofit2.converter.kotlinx.serialization.asConverterFactory +import fr.iut.sciencequest.model.dto.ScientifiqueDTO +import kotlinx.serialization.json.Json +import okhttp3.MediaType +import okhttp3.OkHttpClient +import retrofit2.Call +import retrofit2.Retrofit +import retrofit2.http.GET +import retrofit2.http.Path + +// a remplir +private const val API_BASE_URL = "" + +val httpClient = OkHttpClient() + +interface RequestService { + @GET("scientifiques/{index}/{count}") + fun getScientifiques(@Path("index") index: Int, @Path("count") count: Int): Call> + + @GET("scientifiques/{id}") + fun getScientifique(@Path("id") id: Int) +} + +fun createRequestService(): Retrofit = + Retrofit.Builder() + .baseUrl(API_BASE_URL) + .addConverterFactory(Json { ignoreUnknownKeys = true }.asConverterFactory(MediaType.get("application/json"))) + .client(httpClient) + .build() \ No newline at end of file