mirror of https://github.com/tasks/tasks
Add MicrosoftService
parent
23bd8ba914
commit
1299bce67f
@ -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,
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue