feat(api/model): initial Shiori API

This commit is contained in:
Harsh Shandilya 2023-10-23 21:01:38 +05:30
parent f55d89b17e
commit f39bf0b043
No known key found for this signature in database
9 changed files with 212 additions and 0 deletions

View file

@ -0,0 +1,18 @@
/*
* Copyright © 2021-2023 Harsh Shandilya.
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
*/
package dev.msfjarvis.claw.model.shiori
import dev.drewhamilton.poko.Poko
import kotlinx.serialization.Serializable
@Serializable
@Poko
class Account(
val id: Int,
val username: String,
val owner: Boolean,
)

View file

@ -0,0 +1,19 @@
/*
* Copyright © 2021-2023 Harsh Shandilya.
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
*/
package dev.msfjarvis.claw.model.shiori
import dev.drewhamilton.poko.Poko
import kotlinx.serialization.Serializable
@Serializable
@Poko
class AuthRequest(
val username: String,
val password: String,
val remember: Boolean = true,
val owner: Boolean = false,
)

View file

@ -0,0 +1,18 @@
/*
* Copyright © 2022-2023 Harsh Shandilya.
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
*/
package dev.msfjarvis.claw.model.shiori
import dev.drewhamilton.poko.Poko
import kotlinx.serialization.Serializable
@Serializable
@Poko
class AuthResponse(
val session: String,
val expires: String,
val account: Account,
)

View file

@ -0,0 +1,27 @@
/*
* Copyright © 2021-2023 Harsh Shandilya.
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
*/
package dev.msfjarvis.claw.model.shiori
import dev.drewhamilton.poko.Poko
import kotlinx.serialization.Serializable
@Serializable
@Poko
class Bookmark(
val id: Int,
val url: String,
val title: String,
val excerpt: String,
val author: String,
val public: Int,
val modified: String,
val imageURL: String,
val hasContent: Boolean,
val hasArchive: Boolean,
val tags: List<Tag>,
val createArchive: Boolean,
)

View file

@ -0,0 +1,21 @@
/*
* Copyright © 2021-2023 Harsh Shandilya.
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
*/
package dev.msfjarvis.claw.model.shiori
import dev.drewhamilton.poko.Poko
import kotlinx.serialization.Serializable
@Serializable
@Poko
class BookmarkRequest(
val url: String,
val createArchive: Boolean,
val public: Int,
val tags: List<Tag>,
val title: String,
val excerpt: String,
)

View file

@ -0,0 +1,18 @@
/*
* Copyright © 2022-2023 Harsh Shandilya.
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
*/
package dev.msfjarvis.claw.model.shiori
import dev.drewhamilton.poko.Poko
import kotlinx.serialization.Serializable
@Serializable
@Poko
class BookmarksResponse(
val bookmarks: List<Bookmark>,
val maxPage: Int,
val page: Int,
)

View file

@ -0,0 +1,27 @@
/*
* Copyright © 2023 Harsh Shandilya.
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
*/
package dev.msfjarvis.claw.model.shiori
import dev.drewhamilton.poko.Poko
import kotlinx.serialization.Serializable
@Serializable
@Poko
class EditedBookmark(
val id: Int,
val url: String? = null,
val title: String? = null,
val excerpt: String? = null,
val author: String? = null,
val public: Int? = null,
val modified: String? = null,
val imageURL: String? = null,
val hasContent: Boolean? = null,
val hasArchive: Boolean? = null,
val tags: List<Tag>? = null,
val createArchive: Boolean? = null,
)

View file

@ -0,0 +1,12 @@
/*
* Copyright © 2022-2023 Harsh Shandilya.
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
*/
package dev.msfjarvis.claw.model.shiori
import dev.drewhamilton.poko.Poko
import kotlinx.serialization.Serializable
@Serializable @Poko class Tag(val name: String)