-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/its-me-debk007/kotlin-andro…
…id-mvvm-template # Conflicts: # app/src/main/java/com/debk007/template/presentation/viewmodel/HomeViewModel.kt
- Loading branch information
Showing
10 changed files
with
113 additions
and
20 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
15 changes: 15 additions & 0 deletions
15
app/src/main/java/com/debk007/template/model/Dimensions.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,15 @@ | ||
package com.debk007.template.model | ||
|
||
|
||
import com.squareup.moshi.Json | ||
import com.squareup.moshi.JsonClass | ||
|
||
@JsonClass(generateAdapter = true) | ||
data class Dimensions( | ||
@Json(name = "width") | ||
val width: Double, | ||
@Json(name = "height") | ||
val height: Double, | ||
@Json(name = "depth") | ||
val depth: Double | ||
) |
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,17 @@ | ||
package com.debk007.template.model | ||
|
||
|
||
import com.squareup.moshi.Json | ||
import com.squareup.moshi.JsonClass | ||
|
||
@JsonClass(generateAdapter = true) | ||
data class Meta( | ||
@Json(name = "createdAt") | ||
val createdAt: String, | ||
@Json(name = "updatedAt") | ||
val updatedAt: String, | ||
@Json(name = "barcode") | ||
val barcode: String, | ||
@Json(name = "qrCode") | ||
val qrCode: String | ||
) |
54 changes: 46 additions & 8 deletions
54
app/src/main/java/com/debk007/template/model/ProductDetailsDTO.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 |
---|---|---|
@@ -1,15 +1,53 @@ | ||
package com.debk007.template.model | ||
|
||
data class ProductDetailsDTO( | ||
val brand: String, | ||
val category: String, | ||
|
||
import com.squareup.moshi.Json | ||
import com.squareup.moshi.JsonClass | ||
|
||
@JsonClass(generateAdapter = true) | ||
data class ProductDetailsDto( | ||
@Json(name = "id") | ||
val id: Int, | ||
@Json(name = "title") | ||
val title: String, | ||
@Json(name = "description") | ||
val description: String, | ||
@Json(name = "category") | ||
val category: String, | ||
@Json(name = "price") | ||
val price: Double, | ||
@Json(name = "discountPercentage") | ||
val discountPercentage: Double, | ||
val id: Int, | ||
val images: List<String>, | ||
val price: Int, | ||
@Json(name = "rating") | ||
val rating: Double, | ||
@Json(name = "stock") | ||
val stock: Int, | ||
val thumbnail: String, | ||
val title: String | ||
@Json(name = "tags") | ||
val tags: List<String>, | ||
@Json(name = "brand") | ||
val brand: String, | ||
@Json(name = "sku") | ||
val sku: String, | ||
@Json(name = "weight") | ||
val weight: Int, | ||
@Json(name = "dimensions") | ||
val dimensions: Dimensions, | ||
@Json(name = "warrantyInformation") | ||
val warrantyInformation: String, | ||
@Json(name = "shippingInformation") | ||
val shippingInformation: String, | ||
@Json(name = "availabilityStatus") | ||
val availabilityStatus: String, | ||
@Json(name = "reviews") | ||
val reviews: List<Review>, | ||
@Json(name = "returnPolicy") | ||
val returnPolicy: String, | ||
@Json(name = "minimumOrderQuantity") | ||
val minimumOrderQuantity: Int, | ||
@Json(name = "meta") | ||
val meta: Meta, | ||
@Json(name = "images") | ||
val images: List<String>, | ||
@Json(name = "thumbnail") | ||
val thumbnail: String | ||
) |
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,19 @@ | ||
package com.debk007.template.model | ||
|
||
|
||
import com.squareup.moshi.Json | ||
import com.squareup.moshi.JsonClass | ||
|
||
@JsonClass(generateAdapter = true) | ||
data class Review( | ||
@Json(name = "rating") | ||
val rating: Int, | ||
@Json(name = "comment") | ||
val comment: String, | ||
@Json(name = "date") | ||
val date: String, | ||
@Json(name = "reviewerName") | ||
val reviewerName: String, | ||
@Json(name = "reviewerEmail") | ||
val reviewerEmail: String | ||
) |
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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
package com.debk007.template.network | ||
|
||
import com.debk007.template.model.ProductDetailsDTO | ||
import com.debk007.template.model.ProductDetailsDto | ||
import retrofit2.http.GET | ||
|
||
interface ApiService { | ||
|
||
@GET("products/1") // TODO: Set API Endpoint | ||
suspend fun getProductDetails(): ProductDetailsDTO // TODO: Set API Response | ||
suspend fun getProductDetails(): ProductDetailsDto // TODO: Set API Response | ||
} |
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
4 changes: 2 additions & 2 deletions
4
app/src/main/java/com/debk007/template/repository/Repository.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 |
---|---|---|
@@ -1,8 +1,8 @@ | ||
package com.debk007.template.repository | ||
|
||
import com.debk007.template.model.ProductDetailsDTO | ||
import com.debk007.template.model.ProductDetailsDto | ||
import com.debk007.template.util.ApiState | ||
|
||
interface Repository { | ||
suspend fun getProductDetails(): ApiState<ProductDetailsDTO> | ||
suspend fun getProductDetails(): ApiState<ProductDetailsDto> | ||
} |
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
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