Skip to content

Commit

Permalink
refactor: rename package to io.github.magonxesp
Browse files Browse the repository at this point in the history
  • Loading branch information
magonxesp committed Feb 16, 2024
1 parent bb716e3 commit 145c5a8
Show file tree
Hide file tree
Showing 43 changed files with 54 additions and 133 deletions.
7 changes: 2 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ build/
!**/src/test/**/build/

### IntelliJ IDEA ###
.idea/modules.xml
.idea/jarRepositories.xml
.idea/compiler.xml
.idea/libraries/
.idea
*.iws
*.iml
*.ipr
Expand Down Expand Up @@ -39,4 +36,4 @@ bin/
.vscode/

### Mac OS ###
.DS_Store
.DS_Store
8 changes: 0 additions & 8 deletions .idea/.gitignore

This file was deleted.

7 changes: 0 additions & 7 deletions .idea/discord.xml

This file was deleted.

16 changes: 0 additions & 16 deletions .idea/gradle.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/inspectionProfiles/Project_Default.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/jpa-buddy.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/kotlinc.xml

This file was deleted.

13 changes: 0 additions & 13 deletions .idea/misc.xml

This file was deleted.

12 changes: 0 additions & 12 deletions .idea/vcs.xml

This file was deleted.

12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ implementation("io.github.magonxesp:booru-client:0.1.0")
Search by tag on Konachan for example.

```kotlin
import com.magonxesp.booruclient.konachan.KonachanClient
import io.github.magonxesp.booruclient.konachan.KonachanClient
import kotlinx.coroutines.runBlocking

runBlocking {
Expand All @@ -43,8 +43,8 @@ The other clients have only the `tag` method for search.

### Available clients

* `com.magonxesp.booruclient.danbooru.DanbooruClient` The Danbooru client
* `com.magonxesp.booruclient.konachan.KonachanClient` The Konachan sfw client
* `com.magonxesp.booruclient.konachan.KonachanNsfwClient` The Konachan nsfw client
* `com.magonxesp.booruclient.yandere.YandereClient` The Yande.re client
* `com.magonxesp.booruclient.safebooru.SafebooruClient.kt` The Safebooru client
* `io.github.magonxesp.booruclient.danbooru.DanbooruClient` The Danbooru client
* `io.github.magonxesp.booruclient.konachan.KonachanClient` The Konachan sfw client
* `io.github.magonxesp.booruclient.konachan.KonachanNsfwClient` The Konachan nsfw client
* `io.github.magonxesp.booruclient.yandere.YandereClient` The Yande.re client
* `io.github.magonxesp.booruclient.safebooru.SafebooruClient.kt` The Safebooru client
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ plugins {
}

group = "io.github.magonxesp"
version = "0.1.0"
version = "1.0.0"

publishing {
publications {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.magonxesp.booruclient
package io.github.magonxesp.booruclient

import io.ktor.client.*
import io.ktor.client.engine.cio.*
Expand Down Expand Up @@ -28,7 +28,7 @@ abstract class Client {
val responseBody = response.bodyAsText()

if (!response.status.isSuccess()) {
throw ClientException.RequestFailed("Request to $url failed with status code ${response.status.value} and body: $responseBody")
throw io.github.magonxesp.booruclient.ClientException.RequestFailed("Request to $url failed with status code ${response.status.value} and body: $responseBody")
}

return responseBody
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package com.magonxesp.booruclient
package io.github.magonxesp.booruclient

sealed class ClientException(override val message: String? = null) : Exception(message) {
class InvalidTagFormat(override val message: String? = null) : ClientException(message)
class UnknownError(override val message: String? = null) : ClientException(message)
class RequestFailed(override val message: String? = null) : ClientException(message)
class InvalidLimit(override val message: String? = null) : ClientException(message)
class InvalidPage(override val message: String? = null) : ClientException(message)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.magonxesp.booruclient
package io.github.magonxesp.booruclient

fun String?.toIntOrDefault() =
if (!isNullOrBlank() && toIntOrNull() != null) toInt() else 0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.magonxesp.booruclient
package io.github.magonxesp.booruclient


class Tag(val value: String) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package com.magonxesp.booruclient.danbooru
package io.github.magonxesp.booruclient.danbooru

import com.magonxesp.booruclient.Tag
import io.github.magonxesp.booruclient.Client
import io.github.magonxesp.booruclient.Tag

class DanbooruClient : com.magonxesp.booruclient.Client() {
class DanbooruClient : Client() {
override val baseUrl: String = "https://danbooru.donmai.us/"

class Builder {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.magonxesp.booruclient.danbooru
package io.github.magonxesp.booruclient.danbooru

import kotlinx.serialization.Serializable
import kotlinx.serialization.SerialName
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.magonxesp.booruclient.danbooru
package io.github.magonxesp.booruclient.danbooru

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.magonxesp.booruclient.danbooru
package io.github.magonxesp.booruclient.danbooru

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.magonxesp.booruclient.konachan
package io.github.magonxesp.booruclient.konachan

import com.magonxesp.booruclient.Client
import com.magonxesp.booruclient.Tag
import io.github.magonxesp.booruclient.Client
import io.github.magonxesp.booruclient.Tag

open class KonachanClient : Client() {
override val baseUrl: String = "https://konachan.net"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.magonxesp.booruclient.konachan
package io.github.magonxesp.booruclient.konachan

class KonachanNsfwClient : KonachanClient() {
override val baseUrl: String = "https://konachan.com"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.magonxesp.booruclient.konachan
package io.github.magonxesp.booruclient.konachan

import kotlinx.serialization.Serializable
import kotlinx.serialization.SerialName
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.magonxesp.booruclient.konachan
package io.github.magonxesp.booruclient.konachan

enum class Order(val value: String) {
SCORE("score"),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.magonxesp.booruclient.konachan
package io.github.magonxesp.booruclient.konachan

enum class Rating(val value: String) {
SAFE("safe"),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.magonxesp.booruclient.konachan
package io.github.magonxesp.booruclient.konachan

data class Size(
val compare: SizeCompare,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.magonxesp.booruclient.konachan
package io.github.magonxesp.booruclient.konachan

enum class SizeCompare(val value: Int) {
BIGGER_THAN(1),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.magonxesp.booruclient.safebooru
package io.github.magonxesp.booruclient.safebooru

enum class Order(val value: String) {
DESC("desc"),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.magonxesp.booruclient.safebooru
package io.github.magonxesp.booruclient.safebooru

enum class Rating(val value: String) {
SAFE("safe"),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package com.magonxesp.booruclient.safebooru
package io.github.magonxesp.booruclient.safebooru

import com.magonxesp.booruclient.Client
import com.magonxesp.booruclient.ClientException
import com.magonxesp.booruclient.Tag
import org.w3c.dom.Element
import org.w3c.dom.Node
import io.github.magonxesp.booruclient.Client
import io.github.magonxesp.booruclient.ClientException
import io.github.magonxesp.booruclient.Tag
import org.xml.sax.InputSource
import java.io.StringReader
import java.net.URLEncoder
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.magonxesp.booruclient.safebooru
package io.github.magonxesp.booruclient.safebooru

data class SafebooruPost(
val height: Int,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.magonxesp.booruclient.safebooru
package io.github.magonxesp.booruclient.safebooru

data class SafebooruPostCollection(
val count: Int,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.magonxesp.booruclient.safebooru
package io.github.magonxesp.booruclient.safebooru

import com.magonxesp.booruclient.toIntOrDefault
import com.magonxesp.booruclient.toLongOrDefault
import io.github.magonxesp.booruclient.toIntOrDefault
import io.github.magonxesp.booruclient.toLongOrDefault
import org.w3c.dom.Element
import org.w3c.dom.Node

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.magonxesp.booruclient.safebooru
package io.github.magonxesp.booruclient.safebooru

class SafebooruResponse(
val success: Boolean,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.magonxesp.booruclient.safebooru
package io.github.magonxesp.booruclient.safebooru

import org.w3c.dom.Element

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.magonxesp.booruclient.safebooru
package io.github.magonxesp.booruclient.safebooru

enum class SortType(val value: String) {
ID("id"),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.magonxesp.booruclient.yandere
package io.github.magonxesp.booruclient.yandere

import com.magonxesp.booruclient.Client
import com.magonxesp.booruclient.Tag
import io.github.magonxesp.booruclient.Client
import io.github.magonxesp.booruclient.Tag

class YandereClient : Client() {
override val baseUrl: String = "https://yande.re/"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.magonxesp.booruclient.yandere
package io.github.magonxesp.booruclient.yandere

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.magonxesp.booruclient
package io.github.magonxesp.booruclient

import io.kotest.assertions.throwables.shouldThrowExactly
import io.kotest.core.spec.style.AnnotationSpec
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.magonxesp.booruclient.danbooru
package io.github.magonxesp.booruclient.danbooru

import io.kotest.core.spec.style.AnnotationSpec
import io.kotest.matchers.shouldBe
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.magonxesp.booruclient.konachan
package io.github.magonxesp.booruclient.konachan

import io.kotest.core.spec.style.AnnotationSpec
import io.kotest.matchers.shouldBe
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.magonxesp.booruclient.konachan
package io.github.magonxesp.booruclient.konachan

object KonachanPostMother {
fun createExisting() = KonachanPost(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.magonxesp.booruclient.safebooru
package io.github.magonxesp.booruclient.safebooru

import io.kotest.core.spec.style.AnnotationSpec
import io.kotest.matchers.shouldBe
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.magonxesp.booruclient.yandere
package io.github.magonxesp.booruclient.yandere

import io.kotest.core.spec.style.AnnotationSpec
import io.kotest.matchers.shouldBe
Expand Down

0 comments on commit 145c5a8

Please sign in to comment.