Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
Mirai
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
Mirai
Commits
f7ab3b26
Commit
f7ab3b26
authored
Feb 20, 2020
by
ryoii
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
http api fix Polymorphic
parent
3a458322
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
21 deletions
+12
-21
mirai-api-http/src/main/kotlin/net/mamoe/mirai/api/http/data/common/BotEventDTO.kt
...otlin/net/mamoe/mirai/api/http/data/common/BotEventDTO.kt
+1
-1
mirai-api-http/src/main/kotlin/net/mamoe/mirai/api/http/data/common/DTO.kt
...c/main/kotlin/net/mamoe/mirai/api/http/data/common/DTO.kt
+1
-1
mirai-api-http/src/main/kotlin/net/mamoe/mirai/api/http/util/Json.kt
...ttp/src/main/kotlin/net/mamoe/mirai/api/http/util/Json.kt
+10
-19
No files found.
mirai-api-http/src/main/kotlin/net/mamoe/mirai/api/http/data/common/BotEventDTO.kt
View file @
f7ab3b26
...
...
@@ -9,7 +9,7 @@ import net.mamoe.mirai.message.MessagePacket
import
net.mamoe.mirai.utils.MiraiExperimentalAPI
@Serializable
open
class
BotEventDTO
:
EventDTO
()
sealed
class
BotEventDTO
:
EventDTO
()
@UseExperimental
(
MiraiExperimentalAPI
::
class
)
fun
BotEvent
.
toDTO
()
=
when
(
this
)
{
...
...
mirai-api-http/src/main/kotlin/net/mamoe/mirai/api/http/data/common/DTO.kt
View file @
f7ab3b26
...
...
@@ -17,6 +17,6 @@ abstract class VerifyDTO : DTO {
}
@Serializable
open
class
EventDTO
:
DTO
abstract
class
EventDTO
:
DTO
object
IgnoreEventDTO
:
EventDTO
()
\ No newline at end of file
mirai-api-http/src/main/kotlin/net/mamoe/mirai/api/http/util/Json.kt
View file @
f7ab3b26
...
...
@@ -46,19 +46,10 @@ object MiraiJson {
val
json
=
Json
(
context
=
SerializersModule
{
polymorphic
(
EventDTO
.
serializer
())
{
BotEventDTO
::
class
with
BotEventDTO
.
serializer
()
MessagePacketDTO
::
class
with
MessagePacketDTO
.
serializer
()
}
polymorphic
(
MessagePacketDTO
.
serializer
())
{
GroupMessagePacketDTO
::
class
with
GroupMessagePacketDTO
.
serializer
()
FriendMessagePacketDTO
::
class
with
FriendMessagePacketDTO
.
serializer
()
UnKnownMessagePacketDTO
::
class
with
UnKnownMessagePacketDTO
.
serializer
()
}
// Bot Event Polymorphic
polymorphic
(
BotEventDTO
.
serializer
())
{
BotOnlineEventDTO
::
class
with
BotOnlineEventDTO
.
serializer
()
BotOfflineEventActiveDTO
::
class
with
BotOfflineEventActiveDTO
.
serializer
()
BotOfflineEventForceDTO
::
class
with
BotOfflineEventForceDTO
.
serializer
()
...
...
@@ -85,15 +76,15 @@ object MiraiJson {
}
// Message Polymorphic
polymorphic
(
MessageDTO
.
serializer
())
{
MessageSourceDTO
::
class
with
MessageSourceDTO
.
serializer
()
AtDTO
::
class
with
AtDTO
.
serializer
()
AtAllDTO
::
class
with
AtAllDTO
.
serializer
()
FaceDTO
::
class
with
FaceDTO
.
serializer
()
PlainDTO
::
class
with
PlainDTO
.
serializer
()
ImageDTO
::
class
with
ImageDTO
.
serializer
()
XmlDTO
::
class
with
XmlDTO
.
serializer
()
UnknownMessageDTO
::
class
with
UnknownMessageDTO
.
serializer
()
}
//
polymorphic(MessageDTO.serializer()) {
//
MessageSourceDTO::class with MessageSourceDTO.serializer()
//
AtDTO::class with AtDTO.serializer()
//
AtAllDTO::class with AtAllDTO.serializer()
//
FaceDTO::class with FaceDTO.serializer()
//
PlainDTO::class with PlainDTO.serializer()
//
ImageDTO::class with ImageDTO.serializer()
//
XmlDTO::class with XmlDTO.serializer()
//
UnknownMessageDTO::class with UnknownMessageDTO.serializer()
//
}
})
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment