Add MicrosoftService

pull/2003/head
Alex Baker 2 years ago
parent 23bd8ba914
commit 1299bce67f

@ -225,6 +225,8 @@ dependencies {
implementation("com.github.QuadFlask:colorpicker:0.0.15")
implementation("net.openid:appauth:0.11.1")
implementation("org.osmdroid:osmdroid-android:6.1.11@aar")
implementation("com.squareup.retrofit2:retrofit:${Versions.retrofit}")
implementation("com.squareup.retrofit2:converter-moshi:${Versions.retrofit}")
implementation("androidx.compose.ui:ui:${Versions.compose}")
implementation("androidx.compose.foundation:foundation:${Versions.compose}")

@ -0,0 +1,51 @@
package org.tasks.sync.microsoft
import okhttp3.RequestBody
import okhttp3.ResponseBody
import retrofit2.Response
import retrofit2.http.*
interface MicrosoftService {
@GET("/v1.0/me/todo/lists")
suspend fun getLists(): Response<TaskLists>
@GET
suspend fun paginateLists(@Url nextPage: String): Response<TaskLists>
@POST("/v1.0/me/todo/lists")
suspend fun createList(@Body body: RequestBody): Response<TaskLists.TaskList>
@PATCH("/v1.0/me/todo/lists/{listId}")
suspend fun updateList(
@Path("listId") listId: String,
@Body body: RequestBody
): Response<TaskLists.TaskList>
@DELETE("/v1.0/me/todo/lists/{listId}")
suspend fun deleteList(@Path("listId") listId: String)
@GET("/v1.0/me/todo/lists/{listId}/tasks/delta")
suspend fun getTasks(@Path("listId") listId: String): Response<Tasks>
@GET
suspend fun paginateTasks(@Url nextPage: String): Response<Tasks>
@POST("/v1.0/me/todo/lists/{listId}/tasks")
suspend fun createTask(
@Path("listId") listId: String,
@Body body: RequestBody
): Response<Tasks.Task>
@PATCH("/v1.0/me/todo/lists/{listId}/tasks/{taskId}")
suspend fun updateTask(
@Path("listId") listId: String,
@Path("taskId") taskId: String,
@Body body: RequestBody
): Response<Tasks.Task>
@DELETE("/v1.0/me/todo/lists/{listId}/tasks/{taskId}")
suspend fun deleteTask(
@Path("listId") listId: String,
@Path("taskId") taskId: String
): Response<ResponseBody>
}

@ -0,0 +1,18 @@
package org.tasks.sync.microsoft
import com.squareup.moshi.Json
data class TaskLists(
@field:Json(name = "@odata.context") val context: String,
val value: List<TaskList>,
@field:Json(name = "@odata.nextLink") val nextPage: String?,
) {
data class TaskList(
@Json(name = "@odata.etag") val etag: String,
val displayName: String,
val isOwner: Boolean,
val isShared: Boolean,
val wellknownListName: String,
val id: String,
)
}

@ -0,0 +1,59 @@
package org.tasks.sync.microsoft
import com.squareup.moshi.Json
data class Tasks(
val value: List<Task>,
@field:Json(name = "@odata.nextLink") val nextPage: String?,
@field:Json(name = "@odata.deltaLink") val nextDelta: String?,
) {
data class Task(
@field:Json(name = "@odata.etag") val etag: String? = null,
val id: String? = null,
val title: String? = null,
val body: Body? = null,
val importance: Importance = Importance.low,
val status: Status = Status.notStarted,
val categories: List<String>? = null,
val isReminderOn: Boolean = false,
val createdDateTime: String? = null,
val lastModifiedDateTime: String? = null,
val completedDateTime: CompletedDateTime? = null,
val linkedResources: List<LinkedResource>? = null,
@field:Json(name = "@removed") val removed: Removed? = null,
) {
data class Body(
val content: String,
val contentType: String,
)
data class LinkedResource(
val applicationName: String,
val displayName: String,
val externalId: String,
val id: String,
)
data class Removed(
val reason: String,
)
data class CompletedDateTime(
val dateTime: String,
val timeZone: String,
)
enum class Importance {
low,
normal,
high,
}
enum class Status {
notStarted,
inProgress,
completed,
waitingOnOthers,
deferred,
}
}
}

@ -23,4 +23,5 @@ object Versions {
const val compose_theme_adapter = "1.1.11"
const val accompanist = "0.24.12-rc"
const val coil = "2.2.0"
const val retrofit = "2.9.0"
}

@ -432,6 +432,12 @@
+| +--- androidx.annotation:annotation:1.1.0 -> 1.4.0 (*)
+| \--- com.google.guava:listenablefuture:1.0 -> 9999.0-empty-to-avoid-conflict-with-guava
++--- org.osmdroid:osmdroid-android:6.1.11
++--- com.squareup.retrofit2:retrofit:2.9.0
+| \--- com.squareup.okhttp3:okhttp:3.14.9 -> 4.10.0 (*)
++--- com.squareup.retrofit2:converter-moshi:2.9.0
+| +--- com.squareup.retrofit2:retrofit:2.9.0 (*)
+| \--- com.squareup.moshi:moshi:1.8.0
+| \--- com.squareup.okio:okio:1.16.0 -> 3.2.0 (*)
++--- androidx.compose.ui:ui:1.2.1
+| +--- androidx.annotation:annotation:1.1.0 -> 1.4.0 (*)
+| +--- androidx.autofill:autofill:1.0.0

@ -568,6 +568,12 @@
+| +--- androidx.annotation:annotation:1.1.0 -> 1.4.0 (*)
+| \--- com.google.guava:listenablefuture:1.0 -> 9999.0-empty-to-avoid-conflict-with-guava
++--- org.osmdroid:osmdroid-android:6.1.11
++--- com.squareup.retrofit2:retrofit:2.9.0
+| \--- com.squareup.okhttp3:okhttp:3.14.9 -> 4.10.0 (*)
++--- com.squareup.retrofit2:converter-moshi:2.9.0
+| +--- com.squareup.retrofit2:retrofit:2.9.0 (*)
+| \--- com.squareup.moshi:moshi:1.8.0
+| \--- com.squareup.okio:okio:1.16.0 -> 3.2.0 (*)
++--- androidx.compose.ui:ui:1.2.1
+| +--- androidx.annotation:annotation:1.1.0 -> 1.4.0 (*)
+| +--- androidx.autofill:autofill:1.0.0

Loading…
Cancel
Save