1
0
mirror of https://github.com/KokaKiwi/BarInsta synced 2024-11-12 17:57:29 +00:00

new story models

This commit is contained in:
Austin Huang 2021-05-25 22:47:27 -04:00
parent af8111edad
commit b26cdb3d68
No known key found for this signature in database
GPG Key ID: 84C23AA04587A91F
13 changed files with 210 additions and 0 deletions

View File

@ -0,0 +1,15 @@
package awais.instagrabber.repositories.responses.stories
import java.io.Serializable
import awais.instagrabber.repositories.responses.User
data class Broadcast(
val id: Long?,
val dashPlaybackUrl: String?,
val dashAbrPlaybackUrl: String?, // adaptive quality
val viewerCount: Double?, // always .0
val muted: Boolean?,
val coverFrameUrl: String?,
val broadcastOwner: User?,
val publishedTime: Long?
) : Serializable

View File

@ -0,0 +1,13 @@
package awais.instagrabber.repositories.responses.stories
import java.io.Serializable
import awais.instagrabber.repositories.responses.Hashtag
import awais.instagrabber.repositories.responses.Location
import awais.instagrabber.repositories.responses.User
data class PollSticker(
val pollId: Long?,
val question: String?,
val tallies: List<Tally>?,
val viewerVote: Int?
) : Serializable

View File

@ -0,0 +1,12 @@
package awais.instagrabber.repositories.responses.stories
import java.io.Serializable
import awais.instagrabber.repositories.responses.Hashtag
import awais.instagrabber.repositories.responses.Location
import awais.instagrabber.repositories.responses.User
data class QuestionSticker(
val questionType: String?,
val questionId: Long?,
val question: String?
) : Serializable

View File

@ -0,0 +1,14 @@
package awais.instagrabber.repositories.responses.stories
import java.io.Serializable
import awais.instagrabber.repositories.responses.Hashtag
import awais.instagrabber.repositories.responses.Location
import awais.instagrabber.repositories.responses.User
data class QuizSticker(
val quizId: Long?,
val question: String?,
val tallies: List<Tally>?,
val viewerAnswer: Int?,
val correctAnswer: Int?
) : Serializable

View File

@ -0,0 +1,9 @@
package awais.instagrabber.repositories.responses.stories
import java.io.Serializable
data class ReelsResponse(
val status: String?,
val reel: Story?,
val broadcast: Broadcast?
) : Serializable

View File

@ -0,0 +1,9 @@
package awais.instagrabber.repositories.responses.stories
import java.io.Serializable
data class ReelsTrayResponse(
val status: String?,
val tray: List<Story>?,
val broadcasts: List<Broadcast>?
) : Serializable

View File

@ -0,0 +1,16 @@
package awais.instagrabber.repositories.responses.stories
import java.io.Serializable
import awais.instagrabber.repositories.responses.Hashtag
import awais.instagrabber.repositories.responses.Location
import awais.instagrabber.repositories.responses.User
data class SliderSticker(
val sliderId: Long?,
val question: String?,
val emoji: String?,
val viewerCanVote: Boolean?,
val viewerVote: Double?,
val sliderVoteAverage: Double?,
val sliderVoteCount: Int?,
) : Serializable

View File

@ -0,0 +1,16 @@
package awais.instagrabber.repositories.responses.stories
import java.io.Serializable
import awais.instagrabber.repositories.responses.Media
import awais.instagrabber.repositories.responses.User
data class Story(
val id: Long?,
val latestReelMedia: Long?, // = timestamp
val seen: Long?,
val user: User?,
val muted: Boolean?,
val hasBestiesMedia: Boolean?,
val mediaCount: Int?,
val items: List<Media>? // may be null
) : Serializable

View File

@ -0,0 +1,9 @@
package awais.instagrabber.repositories.responses.stories
import java.io.Serializable
// https://github.com/austinhuang0131/barinsta/issues/1151
data class StoryAppAttribution(
val name: String?, // use name instead of app_action_text for button label
val contentUrl: String?
) : Serializable

View File

@ -0,0 +1,10 @@
package awais.instagrabber.repositories.responses.stories
import java.io.Serializable
import awais.instagrabber.repositories.responses.Hashtag
import awais.instagrabber.repositories.responses.Location
import awais.instagrabber.repositories.responses.User
data class StoryCta(
val webUri: String?
) : Serializable

View File

@ -0,0 +1,57 @@
package awais.instagrabber.repositories.responses.stories
import awais.instagrabber.models.enums.MediaItemType
import awais.instagrabber.utils.TextUtils
import awais.instagrabber.repositories.responses.ImageVersions2
import awais.instagrabber.repositories.responses.User
import awais.instagrabber.repositories.responses.VideoVersion
import java.io.Serializable
import java.util.*
data class StoryMedia(
// inherited from Media
val pk: String? = null,
val id: String? = null,
val takenAt: Long = -1,
val user: User? = null,
val canReshare: Boolean = false,
val imageVersions2: ImageVersions2? = null,
val originalWidth: Int = 0,
val originalHeight: Int = 0,
val mediaType: MediaItemType? = null,
val isReelMedia: Boolean = false,
val videoVersions: List<VideoVersion>? = null,
val hasAudio: Boolean = false,
val videoDuration: Double = 0.0,
val viewCount: Long = 0,
val title: String? = null,
// story-specific
val canReply: Boolean = false,
val linkText: String? = null, // required for story_cta
// stickers
val reelMentions: List<StorySticker>? = null,
val storyHashtags: List<StorySticker>? = null,
val storyLocations: List<StorySticker>? = null,
val storyFeedMedia: List<StorySticker>? = null,
val storyPolls: List<StorySticker>? = null,
val storyQuestions: List<StorySticker>? = null,
val storyQuizs: List<StorySticker>? = null,
val storyCta: List<StorySticker>? = null,
val storySliders: List<StorySticker>? = null,
// spotify/soundcloud button, not a sticker
val storyAppAttribution: StoryAppAttribution? = null
) : Serializable {
private var dateString: String? = null
// TODO use extension once all usages are converted to kotlin
// val date: String by lazy {
// if (takenAt <= 0) "" else Utils.datetimeParser.format(Date(takenAt * 1000L))
// }
val date: String
get() {
if (takenAt <= 0) return ""
if (dateString != null) return dateString ?: ""
dateString = TextUtils.epochSecondToString(takenAt)
return dateString ?: ""
}
}

View File

@ -0,0 +1,19 @@
package awais.instagrabber.repositories.responses.stories
import java.io.Serializable
import awais.instagrabber.repositories.responses.Hashtag
import awais.instagrabber.repositories.responses.Location
import awais.instagrabber.repositories.responses.User
data class StorySticker(
// only ONE object should exist
val user: User?, // reel_mentions
val hashtag: Hashtag?, // story_hashtags
val location: Location?, // story_locations
val mediaId: String?, // story_feed_media
val pollSticker: PollSticker?, // story_polls
val questionSticker: QuestionSticker?, // story_questions
val quizSticker: QuizSticker?, // story_quizs
val links: StoryCta?, // story_cta, requires link_text from the story
val sliderSticker: SliderSticker? // story_sliders
) : Serializable

View File

@ -0,0 +1,11 @@
package awais.instagrabber.repositories.responses.stories
import java.io.Serializable
import awais.instagrabber.repositories.responses.Hashtag
import awais.instagrabber.repositories.responses.Location
import awais.instagrabber.repositories.responses.User
data class Tally(
val text: String?,
val count: Int?
) : Serializable