Skip to content
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

ECWID-146553: Change the Category ID type from Int to Long. #433

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,14 @@ data class OrderForCalculate(

data class DiscountCouponCatalogLimit(
val products: List<Int>? = null,
val categories: List<Int>? = null
val categories: List<Long>? = null
)

data class OrderItem(
val id: Int? = null,

val productId: Int? = null,
val categoryId: Int? = null,
val categoryId: Long? = null,

val price: Double? = null,
val productPrice: Double? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,14 @@ data class CalculateOrderDetailsResult(

data class DiscountCouponCatalogLimit(
val products: List<Int>? = null,
val categories: List<Int>? = null
val categories: List<Long>? = null
)

data class OrderItem(
val id: Int? = null,

val productId: Int? = null,
val categoryId: Int? = null,
val categoryId: Long? = null,

val price: Double? = null,
val productPrice: Double? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,14 @@ data class FetchedCart(

data class DiscountCouponCatalogLimit(
val products: List<Int>? = null,
val categories: List<Int>? = null
val categories: List<Long>? = null
)

data class OrderItem(
val id: Int? = null,

val productId: Int? = null,
val categoryId: Int? = null,
val categoryId: Long? = null,

val price: Double? = null,
val productPrice: Double? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import com.ecwid.apiclient.v3.httptransport.HttpBody
import com.ecwid.apiclient.v3.impl.RequestInfo

data class AssignProductsToCategoryRequest(
val categoryId: Int = 0,
val categoryId: Long = 0L,
val productIds: List<Int> = emptyList()
) : ApiRequest {
override fun toRequestInfo() = RequestInfo.createPostRequest(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import com.ecwid.apiclient.v3.responsefields.ResponseFields
data class CategoriesSearchRequest(
val keyword: String? = null,
val parentCategoryId: ParentCategory = ParentCategory.Any,
val categoryIds: List<Int>? = null,
val categoryIds: List<Long>? = null,
val hiddenCategories: Boolean? = null,
val returnProductIds: Boolean? = null,
val baseUrl: String? = null,
Expand All @@ -31,7 +31,7 @@ data class CategoriesSearchRequest(
sealed class ParentCategory {
object Any : ParentCategory()
object Root : ParentCategory()
data class WithId(val id: Int = 0) : ParentCategory()
data class WithId(val id: Long = 0L) : ParentCategory()
}

private fun toParams(): Map<String, String> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import com.ecwid.apiclient.v3.dto.ApiRequest
import com.ecwid.apiclient.v3.impl.RequestInfo

data class CategoryDeleteRequest(
val categoryId: Int = 0
val categoryId: Long = 0L
) : ApiRequest {
override fun toRequestInfo() = RequestInfo.createDeleteRequest(
pathSegments = listOf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import com.ecwid.apiclient.v3.impl.RequestInfo
import com.ecwid.apiclient.v3.responsefields.ResponseFields

data class CategoryDetailsRequest(
val categoryId: Int = 0,
val categoryId: Long = 0L,
val baseUrl: String? = null,
val cleanUrls: Boolean? = null,
val slugsWithoutIds: Boolean? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import com.ecwid.apiclient.v3.httptransport.HttpBody
import com.ecwid.apiclient.v3.impl.RequestInfo

data class CategoryImageAsyncUploadRequest(
val categoryId: Int = 0,
val categoryId: Long = 0L,
val asyncPictureData: AsyncPictureData = AsyncPictureData()

) : ApiRequest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import com.ecwid.apiclient.v3.dto.ApiRequest
import com.ecwid.apiclient.v3.impl.RequestInfo

data class CategoryImageDeleteRequest(
val categoryId: Int = 0
val categoryId: Long = 0L
) : ApiRequest {
override fun toRequestInfo() = RequestInfo.createDeleteRequest(
pathSegments = listOf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import com.ecwid.apiclient.v3.impl.MIME_TYPE_OCTET_STREAM
import com.ecwid.apiclient.v3.impl.RequestInfo

data class CategoryImageUploadRequest(
val categoryId: Int = 0,
val categoryId: Long = 0L,
val fileData: UploadFileData = UploadFileData.ExternalUrlData("")
) : ApiRequest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import com.ecwid.apiclient.v3.httptransport.HttpBody
import com.ecwid.apiclient.v3.impl.RequestInfo

data class CategoryUpdateRequest(
val categoryId: Int = 0,
val categoryId: Long = 0L,
val updatedCategory: UpdatedCategory = UpdatedCategory()
) : ApiRequest {
override fun toRequestInfo() = RequestInfo.createPutRequest(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import com.ecwid.apiclient.v3.httptransport.HttpBody
import com.ecwid.apiclient.v3.impl.RequestInfo

data class UnassignProductsFromCategoryRequest(
val categoryId: Int = 0,
val categoryId: Long = 0L,
val productIds: List<Int> = emptyList()
) : ApiRequest {
override fun toRequestInfo() = RequestInfo.createPostRequest(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import com.ecwid.apiclient.v3.dto.common.LocalizedValueMap
import com.ecwid.apiclient.v3.dto.common.UpdatedAlt

data class UpdatedCategory(
val parentId: Int? = null,
val parentId: Long? = null,
val orderBy: Int? = null,
val name: String? = null,
val isSampleCategory: Boolean? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ package com.ecwid.apiclient.v3.dto.category.result
import com.ecwid.apiclient.v3.dto.common.ApiResultDTO

data class CategoryCreateResult(
val id: Int = 0
val id: Long = 0L
) : ApiResultDTO
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import com.ecwid.apiclient.v3.dto.common.LocalizedValueMap
import com.ecwid.apiclient.v3.dto.common.PictureInfo

data class FetchedCategory(
val id: Int = 0,
val parentId: Int? = null,
val id: Long = 0L,
val parentId: Long? = null,
val orderBy: Int? = null,
val name: String = "",
val isSampleCategory: Boolean? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ data class UpdatedCoupon(

data class DiscountCouponCatalogLimit(
val products: List<Int>? = null,
val categories: List<Int>? = null
val categories: List<Long>? = null
)

override fun getModifyKind() = ModifyKind.ReadWrite(FetchedCoupon::class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ data class FetchedCoupon(

data class DiscountCouponCatalogLimit(
val products: List<Int>? = null,
val categories: List<Int>? = null
val categories: List<Long>? = null
)

override fun getModifyKind() = ModifyKind.ReadWrite(UpdatedCoupon::class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ data class CustomAppRequest(
val productId: Int? = null,
val combinationId: Long? = null,
val name: String? = null,
val categoryId: Int? = null,
val categoryId: Long? = null,
val sku: String? = null,
val selectedOptions: List<OrderItemOption>? = null,
val dimensions: ProductDimensions? = null,
val productPrice: Double? = null,
val categoryIds: List<Int>? = null,
val categoryIds: List<Long>? = null,
val categories: List<Category>? = null,
val quantity: Int? = null,
val unlimited: Boolean? = null,
Expand Down Expand Up @@ -91,7 +91,7 @@ data class CustomAppRequest(
val originalImage: PictureInfo? = null,
val borderInfo: BorderInfo? = null,
val galleryImages: List<GalleryImage>? = null,
val defaultCategoryId: Int? = null,
val defaultCategoryId: Long? = null,
val seoTitle: String? = null,
val seoDescription: String? = null,
val favorites: FavoritesInfo? = null,
Expand All @@ -104,7 +104,7 @@ data class CustomAppRequest(
)

data class Category(
val id: Int? = null,
val id: Long? = null,
val enabled: Boolean? = null
)

Expand Down Expand Up @@ -155,7 +155,7 @@ data class CustomAppRequest(

data class RelatedCategory(
val enabled: Boolean? = null,
val categoryId: Int? = null,
val categoryId: Long? = null,
val productCount: Int? = null
)

Expand Down Expand Up @@ -241,7 +241,7 @@ data class CustomAppRequest(

data class DiscountCouponCatalogLimit(
val products: List<Int>? = null,
val categories: List<Int>? = null
val categories: List<Long>? = null
)

data class HandlingFeeInfo(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ data class UpdatedOrder(
data class OrderItem(
val id: Long? = null,
val productId: Int? = null,
val categoryId: Int? = null,
val categoryId: Long? = null,

val price: Double? = null,
val productPrice: Double? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,14 @@ data class FetchedOrder(

data class DiscountCouponCatalogLimit(
val products: List<Int>? = null,
val categories: List<Int>? = null
val categories: List<Long>? = null
)

data class OrderItem(
val id: Long? = null, // TODO Figure out how to test

val productId: Int? = null,
val categoryId: Int? = null,
val categoryId: Long? = null,

val price: Double? = null,
val productPrice: Double? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ sealed class ProductsSearchRequest : ApiRequest {
val externalReferenceId: String? = null,
val priceFrom: Double? = null,
val priceTo: Double? = null,
val categories: List<Int>? = null,
val categories: List<Long>? = null,
val includeProductsFromSubcategories: Boolean? = null,
val sortBy: SortOrder? = null,
val createdFrom: Date? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ data class UpdatedProduct(
val unlimited: Boolean? = null,
val warningLimit: Int? = null,

val categoryIds: List<Int>? = null,
val defaultCategoryId: Int? = null,
val categoryIds: List<Long>? = null,
val defaultCategoryId: Long? = null,
val showOnFrontpage: Int? = null,

val price: Double? = null,
Expand Down Expand Up @@ -349,7 +349,7 @@ data class UpdatedProduct(

data class RelatedCategory(
val enabled: Boolean? = null,
val categoryId: Int? = null,
val categoryId: Long? = null,
val productCount: Int? = null
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ data class FetchedProduct(
val inStock: Boolean? = null,
val warningLimit: Int? = null,

val categoryIds: List<Int>? = null,
val categoryIds: List<Long>? = null,
val categories: List<CategoryInfo>? = null,
val defaultCategoryId: Int? = null,
val defaultCategoryId: Long? = null,
val showOnFrontpage: Int? = null,

val price: Double? = null,
Expand Down Expand Up @@ -190,7 +190,7 @@ data class FetchedProduct(
)

data class CategoryInfo(
val id: Int = 0,
val id: Long = 0L,
val enabled: Boolean = true
)

Expand Down Expand Up @@ -302,7 +302,7 @@ data class FetchedProduct(

data class RelatedCategory(
val enabled: Boolean? = null,
val categoryId: Int? = null,
val categoryId: Long? = null,
val productCount: Int? = null
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ data class FetchedSubscription(
val id: Int? = null,

val productId: Int? = null,
val categoryId: Int? = null,
val categoryId: Long? = null,

val price: Double? = null,
val productPrice: Double? = null,
Expand Down
2 changes: 1 addition & 1 deletion src/test/kotlin/com/ecwid/apiclient/v3/entity/CartsTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ class CartsTest : BaseEntityTest() {
return OrderForCalculate.OrderItem(
id = randomId(),
productId = randomId(),
categoryId = randomId(),
categoryId = randomLongId(),
price = 22.2,
productPrice = 33.3,
shipping = 44.4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ class CategoriesTest : BaseEntityTest() {
}

private fun assertCategory(
desiredId: Int,
desiredId: Long,
desiredProductIds: List<Int>?,
categoriesSearchResult: CategoriesSearchResult
) {
Expand Down Expand Up @@ -569,7 +569,7 @@ private fun generateTestProduct(
}

private fun generateTestCategory(
parentCategoryId: Int? = null,
parentCategoryId: Long? = null,
productIds: List<Int> = listOf(),
enabled: Boolean = randomBoolean()
): UpdatedCategory {
Expand Down
4 changes: 2 additions & 2 deletions src/test/kotlin/com/ecwid/apiclient/v3/entity/CouponsTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ class CouponsTest : BaseEntityTest() {
return apiClient.createCategory(categoryCreateRequest)
}

private fun generateTestCouponForCreate(existingProductId: Int, existingCategoryId: Int): UpdatedCoupon {
private fun generateTestCouponForCreate(existingProductId: Int, existingCategoryId: Long): UpdatedCoupon {
val launchDate = randomDateFrom(Date())
val expirationDate = randomDateFrom(launchDate)

Expand All @@ -240,7 +240,7 @@ class CouponsTest : BaseEntityTest() {
)
}

private fun generateTestCouponForUpdate(existingProductId: Int, existingCategoryId: Int): UpdatedCoupon {
private fun generateTestCouponForUpdate(existingProductId: Int, existingCategoryId: Long): UpdatedCoupon {
val launchDate = randomDateFrom(Date())
val expirationDate = randomDateFrom(launchDate)

Expand Down
4 changes: 2 additions & 2 deletions src/test/kotlin/com/ecwid/apiclient/v3/entity/ProductsTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -1334,7 +1334,7 @@ class ProductsTest : BaseEntityTest() {
}
}

private fun generateTestCategory(parentId: Int? = null): UpdatedCategory {
private fun generateTestCategory(parentId: Long? = null): UpdatedCategory {
return UpdatedCategory(
name = "Category " + randomAlphanumeric(8),
description = "Description " + randomAlphanumeric(16),
Expand All @@ -1343,7 +1343,7 @@ private fun generateTestCategory(parentId: Int? = null): UpdatedCategory {
)
}

private fun generateTestProduct(categoryIds: List<Int> = listOf(), discountsAllowed: Boolean = true): UpdatedProduct {
private fun generateTestProduct(categoryIds: List<Long> = listOf(), discountsAllowed: Boolean = true): UpdatedProduct {
val basePrice = randomPrice()
val enName = "Product " + randomAlphanumeric(8)
val enDescription = "Description " + randomAlphanumeric(16)
Expand Down
Loading
Loading