-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from nurigo/impr/get-message-list
Release Nurigo Java SDK 4.2.5:
- Loading branch information
Showing
10 changed files
with
315 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 0 additions & 26 deletions
26
src/main/java/net/nurigo/sdk/message/extension/DataClassMapperExtension.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package net.nurigo.sdk.message.lib | ||
|
||
import kotlinx.serialization.json.* | ||
|
||
class MapHelper { | ||
|
||
companion object { | ||
inline fun <reified T> toMap(obj: T): Map<String, Any?> { | ||
return jsonObjectToMap(Json.encodeToJsonElement(obj).jsonObject) | ||
} | ||
|
||
fun jsonObjectToMap(element: JsonObject): Map<String, Any?> { | ||
return element.entries.associate { | ||
it.key to extractValue(it.value) | ||
} | ||
} | ||
|
||
private fun extractValue(element: JsonElement): Any? { | ||
return when (element) { | ||
is JsonNull -> null | ||
is JsonPrimitive -> element.content | ||
is JsonArray -> element.map { extractValue(it) } | ||
is JsonObject -> jsonObjectToMap(element) | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/main/java/net/nurigo/sdk/message/model/MessageStatusType.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package net.nurigo.sdk.message.model | ||
|
||
/** | ||
* 메시지 조회를 위한 Custom Message Status. | ||
* 실제 메시지 발송 API 규격에 따르지 않아 주의가 필요합니다. | ||
* Message 모델의 status와는 다른 값입니다! | ||
*/ | ||
enum class MessageStatusType { | ||
/** | ||
* 대기 상태, 상태코드 2000 | ||
*/ | ||
PENDING, | ||
|
||
/** | ||
* 발송 중 상태, 상태코드 3000 | ||
*/ | ||
SENDING, | ||
|
||
/** | ||
* 발송 완료 상태, 상태코드 4000 | ||
*/ | ||
COMPLETE, | ||
|
||
/** | ||
* 발송 실패(접수 실패 포함) 상태, 상태코드가 2000, 3000, 4000번이 아닌 모든 상태코드 | ||
*/ | ||
FAILED | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
src/main/java/net/nurigo/sdk/message/request/MessageListBaseRequest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package net.nurigo.sdk.message.request | ||
|
||
import kotlinx.datetime.Instant | ||
import kotlinx.serialization.Serializable | ||
import net.nurigo.sdk.message.model.CommonMessageProperty | ||
|
||
@Serializable | ||
data class MessageListBaseRequest( | ||
override var to: String? = null, | ||
override var from: String? = null, | ||
var startKey: String? = null, | ||
var limit: Int? = null, | ||
var startDate: Instant? = null, | ||
var endDate: Instant? = null, | ||
var messageId: String? = null, | ||
var groupId: String? = null, | ||
var type: String? = null, | ||
var statusCode: String? = null, | ||
var criteria: String? = null, | ||
var cond: String? = null, | ||
var value: String? = null | ||
) : CommonMessageProperty { | ||
|
||
override fun equals(other: Any?): Boolean { | ||
if (this === other) return true | ||
if (javaClass != other?.javaClass) return false | ||
|
||
other as MessageListBaseRequest | ||
|
||
if (to != other.to) return false | ||
if (from != other.from) return false | ||
if (startKey != other.startKey) return false | ||
if (limit != other.limit) return false | ||
if (startDate != other.startDate) return false | ||
if (endDate != other.endDate) return false | ||
if (messageId != other.messageId) return false | ||
if (groupId != other.groupId) return false | ||
if (type != other.type) return false | ||
if (statusCode != other.statusCode) return false | ||
|
||
return true | ||
} | ||
|
||
override fun hashCode(): Int { | ||
var result = to?.hashCode() ?: 0 | ||
result = 31 * result + (from?.hashCode() ?: 0) | ||
result = 31 * result + (startKey?.hashCode() ?: 0) | ||
result = 31 * result + (limit ?: 0) | ||
result = 31 * result + (startDate?.hashCode() ?: 0) | ||
result = 31 * result + (endDate?.hashCode() ?: 0) | ||
result = 31 * result + (messageId?.hashCode() ?: 0) | ||
result = 31 * result + (groupId?.hashCode() ?: 0) | ||
result = 31 * result + (type?.hashCode() ?: 0) | ||
result = 31 * result + (statusCode?.hashCode() ?: 0) | ||
return result | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.