[github] Include timeline item type

GitOrigin-RevId: c91d68265af403fb91e94b460fd870661ee5e6b6
This commit is contained in:
Ivan Semenov
2020-06-16 22:26:02 +03:00
committed by intellij-monorepo-bot
parent 338c082e83
commit a890701fc5
2 changed files with 5 additions and 4 deletions
@@ -1,4 +1,4 @@
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.plugins.github.api.data.pullrequest.timeline
import com.fasterxml.jackson.annotation.JsonSubTypes
@@ -47,7 +47,7 @@ SubscribedEvent | UnsubscribedEvent
MilestonedEvent | DemilestonedEvent
MentionedEvent | ReferencedEvent | CrossReferencedEvent
*/
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "__typename", visible = false,
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "__typename", visible = true,
defaultImpl = Unknown::class)
@JsonSubTypes(
JsonSubTypes.Type(name = "IssueComment", value = GHIssueComment::class),
@@ -79,5 +79,5 @@ MentionedEvent | ReferencedEvent | CrossReferencedEvent
JsonSubTypes.Type(name = "HeadRefRestoredEvent", value = GHPRHeadRefRestoredEvent::class)
)
interface GHPRTimelineItem {
class Unknown : GHPRTimelineItem
class Unknown(val __typename: String) : GHPRTimelineItem
}
@@ -49,7 +49,8 @@ class GHPRTimelineItemComponentFactory(private val reviewDataProvider: GHPRRevie
is GHPullRequestReview -> createComponent(item)
is GHPRTimelineEvent -> eventComponentFactory.createComponent(item)
else -> throw IllegalStateException("Unknown item type")
is GHPRTimelineItem.Unknown -> throw IllegalStateException("Unknown item type: " + item.__typename)
else -> error("Undefined item type")
}
}
catch (e: Exception) {