-
Notifications
You must be signed in to change notification settings - Fork 8
Feat/ccrama force sr_detail #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -240,6 +240,7 @@ interface RedditApi { | |
fun submission( | ||
@Query("id") submissionId: String, | ||
@Query("raw_json") rawJson: Int? = null, | ||
@Query("sr_detail") srDetail: Int = 1, | ||
@HeaderMap header: HashMap<String, String> | ||
): Call<EnvelopedSubmissionListing> | ||
|
||
|
@@ -297,6 +298,7 @@ interface RedditApi { | |
@Query("after") after: String? = null, | ||
@Query("before") before: String? = null, | ||
@Query("raw_json") rawJson: Int? = null, | ||
@Query("sr_detail") srDetail: Int = 1, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make the type nullable and the default null, please. |
||
@HeaderMap header: HashMap<String, String> | ||
): Call<EnvelopedSubmissionListing> | ||
|
||
|
@@ -310,6 +312,7 @@ interface RedditApi { | |
@Query("after") after: String? = null, | ||
@Query("before") before: String? = null, | ||
@Query("raw_json") rawJson: Int? = null, | ||
@Query("sr_detail") srDetail: Int = 1, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make the type nullable and the default null, please. |
||
@HeaderMap header: HashMap<String, String> | ||
): Call<EnvelopedSubmissionListing> | ||
|
||
|
@@ -322,6 +325,7 @@ interface RedditApi { | |
@Query("limit") limit: Long? = null, | ||
@Query("depth") depth: Int? = null, | ||
@Query("raw_json") rawJson: Int? = null, | ||
@Query("sr_detail") srDetail: Int = 1, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make the type nullable and the default null, please. |
||
@HeaderMap header: HashMap<String, String> | ||
): Call<List<EnvelopedContributionListing>> | ||
|
||
|
@@ -337,6 +341,7 @@ interface RedditApi { | |
@Query("after") after: String? = null, | ||
@Query("before") before: String? = null, | ||
@Query("raw_json") rawJson: Int? = null, | ||
@Query("sr_detail") srDetail: Int = 1, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make the type nullable and the default null, please. |
||
@HeaderMap header: HashMap<String, String> | ||
): Call<EnvelopedMessageListing> | ||
|
||
|
@@ -383,6 +388,7 @@ interface RedditApi { | |
@Query("after") after: String? = null, | ||
@Query("before") before: String? = null, | ||
@Query("raw_json") rawJson: Int? = null, | ||
@Query("sr_detail") srDetail: Int = 1, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make the type nullable and the default null, please. |
||
@HeaderMap header: HashMap<String, String> | ||
): Call<EnvelopedSubmissionListing> | ||
|
||
|
@@ -522,6 +528,7 @@ interface RedditApi { | |
@Query("after") after: String? = null, | ||
@Query("before") before: String? = null, | ||
@Query("raw_json") rawJson: Int? = null, | ||
@Query("sr_detail") srDetail: Int = 1, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make the type nullable and the default null, please. |
||
@HeaderMap header: HashMap<String, String> | ||
): Call<EnvelopedContributionListing> | ||
|
||
|
@@ -536,6 +543,7 @@ interface RedditApi { | |
@Query("after") after: String? = null, | ||
@Query("before") before: String? = null, | ||
@Query("raw_json") rawJson: Int? = null, | ||
@Query("sr_detail") srDetail: Int = 1, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make the type nullable and the default null, please. |
||
@HeaderMap header: HashMap<String, String> | ||
): Call<EnvelopedContributionListing> | ||
|
||
|
@@ -608,6 +616,7 @@ interface RedditApi { | |
@Query("after") after: String? = null, | ||
@Query("before") before: String? = null, | ||
@Query("raw_json") rawJson: Int? = null, | ||
@Query("sr_detail") srDetail: Int = 1, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make the type nullable and the default null, please. |
||
@HeaderMap header: HashMap<String, String> | ||
): Call<List<Listing<EnvelopedData>>> | ||
|
||
|
@@ -623,6 +632,7 @@ interface RedditApi { | |
@Query("before") before: String? = null, | ||
@Query("restrict_sr") restrictToSubreddit: Boolean? = null, | ||
@Query("raw_json") rawJson: Int? = null, | ||
@Query("sr_detail") srDetail: Int = 1, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make the type nullable and the default null, please. |
||
@HeaderMap header: HashMap<String, String> | ||
): Call<EnvelopedSubmissionListing> | ||
|
||
|
@@ -639,6 +649,7 @@ interface RedditApi { | |
@Query("before") before: String? = null, | ||
@Query("restrict_sr") restrictToSubreddit: Boolean? = null, | ||
@Query("raw_json") rawJson: Int? = null, | ||
@Query("sr_detail") srDetail: Int = 1, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make the type nullable and the default null, please. |
||
@HeaderMap header: HashMap<String, String> | ||
): Call<EnvelopedSubmissionListing> | ||
|
||
|
@@ -654,6 +665,7 @@ interface RedditApi { | |
@Query("after") after: String? = null, | ||
@Query("before") before: String? = null, | ||
@Query("raw_json") rawJson: Int? = null, | ||
@Query("sr_detail") srDetail: Int = 1, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make the type nullable and the default null, please. |
||
@HeaderMap header: HashMap<String, String> | ||
): Call<EnvelopedSubredditDataListing> | ||
|
||
|
@@ -669,6 +681,7 @@ interface RedditApi { | |
@Query("after") after: String? = null, | ||
@Query("before") before: String? = null, | ||
@Query("raw_json") rawJson: Int? = null, | ||
@Query("sr_detail") srDetail: Int = 1, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make the type nullable and the default null, please. |
||
@HeaderMap header: HashMap<String, String> | ||
): Call<EnvelopedSubmissionListing> | ||
|
||
|
@@ -684,6 +697,7 @@ interface RedditApi { | |
@Query("after") after: String? = null, | ||
@Query("before") before: String? = null, | ||
@Query("raw_json") rawJson: Int? = null, | ||
@Query("sr_detail") srDetail: Int = 1, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make the type nullable and the default null, please. |
||
@HeaderMap header: HashMap<String, String> | ||
): Call<EnvelopedRedditorDataListing> | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
package com.kirkbushman.araw.models | ||
|
||
import android.os.Parcelable | ||
import com.kirkbushman.araw.models.base.Thing | ||
import com.kirkbushman.araw.models.commons.ImageDetail | ||
import com.squareup.moshi.Json | ||
import com.squareup.moshi.JsonClass | ||
import kotlinx.parcelize.Parcelize | ||
import java.util.* | ||
|
||
@JsonClass(generateAdapter = true) | ||
@Parcelize | ||
data class SrDetail( | ||
|
||
@Json(name = "name") | ||
override val fullname: String, | ||
|
||
//sr_detail doesn't have an ID field, split the fullname | ||
override val id: String = fullname.split("_").last(), | ||
|
||
@Json(name = "default_set") | ||
val defaultSet: Boolean, | ||
|
||
@Json(name = "banner_img") | ||
val bannerImg: String?, | ||
|
||
@Json(name = "community_icon") | ||
val communityIcon: String?, | ||
|
||
@Json(name = "description") | ||
val description: String?, | ||
|
||
@Json(name = "user_is_muted") | ||
val userIsMuted: Boolean?, | ||
|
||
@Json(name = "display_name") | ||
val displayName: String, | ||
|
||
@Json(name = "header_img") | ||
val headerImg: String?, | ||
|
||
@Json(name = "title") | ||
val title: String?, | ||
|
||
@Json(name = "user_is_moderator") | ||
val userIsModerator: Boolean?, | ||
|
||
@Json(name = "over_18") | ||
val over18: Boolean, | ||
|
||
@Json(name = "icon_size") | ||
val iconSize: List<Long>?, | ||
|
||
@Json(name = "primary_color") | ||
val primaryColor: String?, | ||
|
||
@Json(name = "icon_img") | ||
val iconImg: String?, | ||
|
||
@Json(name = "icon_color") | ||
val iconColor: String?, | ||
|
||
@Json(name = "subscribers") | ||
val subscribers: Long, | ||
|
||
@Json(name = "display_name_prefixed") | ||
val displayNamePrefixed: String, | ||
|
||
@Json(name = "key_color") | ||
val keyColor: String?, | ||
|
||
@Json(name = "created_utc") | ||
val createdUTC: Long, | ||
|
||
@Json(name = "banner_size") | ||
val bannerSize: List<Long>?, | ||
|
||
@Json(name = "public_description") | ||
val publicDescription: String?, | ||
|
||
@Json(name = "user_is_subscriber") | ||
val userIsSubscriber: Boolean? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Convert the naming into isSubscriber, isMuted like the rest, please |
||
|
||
) : Thing, Parcelable |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -142,6 +142,9 @@ data class Submission( | |
@Json(name = "gildings") | ||
override val gildings: Gildings, | ||
|
||
@Json(name = "sr_detail") | ||
val sr_detail: SrDetail?, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use camel case for the variable name here, otherwise detekt will error the build in Travis. Move it to srDetail, please. |
||
|
||
@Json(name = "archived") | ||
val isArchived: Boolean, | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better if we make this field nullable, and the default parameter null. In this case Retrofit will not set this by default. And the user will opt-in if necessary.