-
-
Notifications
You must be signed in to change notification settings - Fork 495
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
feat: marketplace #5226
base: nextgen
Are you sure you want to change the base?
feat: marketplace #5226
Conversation
# Conflicts: # src/main/kotlin/net/ccbluex/liquidbounce/api/ClientApi.kt # src/main/kotlin/net/ccbluex/liquidbounce/api/oauth/ClientAccount.kt # src/main/kotlin/net/ccbluex/liquidbounce/api/services/auth/OAuthClient.kt
src/main/kotlin/net/ccbluex/liquidbounce/api/services/marketplace/MarketplaceApi.kt
Fixed
Show fixed
Hide fixed
suspend fun createMarketplaceItemRevision( | ||
session: OAuthSession, | ||
id: Int, | ||
file: File, | ||
version: String, | ||
changelog: String? = null, | ||
dependencies: String? = null | ||
) { |
Check warning
Code scanning / detekt
The more parameters a function has the more complex it is. Long parameter lists are often used to control complex algorithms and violate the Single Responsibility Principle. Prefer functions with short parameter lists. Warning
* You should have received a copy of the GNU General Public License | ||
* along with LiquidBounce. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
package net.ccbluex.liquidbounce.features.command.commands.client.marketplace |
Check warning
Code scanning / detekt
Kotlin source files should be stored in the directory corresponding to its package statement. Warning
...otlin/net/ccbluex/liquidbounce/features/command/commands/client/marketplace/SearchCommand.kt
Fixed
Show fixed
Hide fixed
.../ccbluex/liquidbounce/features/command/commands/client/marketplace/item/CreateItemCommand.kt
Fixed
Show fixed
Hide fixed
|
||
val type = try { | ||
MarketplaceItemType.valueOf(typeStr.uppercase()) | ||
} catch (e: IllegalArgumentException) { |
Check warning
Code scanning / detekt
The caught exception is swallowed. The original exception could be lost. Warning
*/ | ||
object UploadRevisionCommand : CommandFactory { | ||
|
||
override fun createCommand() = CommandBuilder |
Check warning
Code scanning / detekt
One method should have one responsibility. Long methods tend to handle many things at once. Prefer smaller methods to make them easier to understand. Warning
) | ||
) | ||
) | ||
} catch (e: Exception) { |
Check warning
Code scanning / detekt
The caught exception is swallowed. The original exception could be lost. Warning
updateItem(itemId) | ||
} catch (e: Exception) { | ||
logger.error("Failed to update subscribed item $itemId", e) | ||
e.printStackTrace() |
Check warning
Code scanning / detekt
Do not print a stack trace. These debug statements should be removed or replaced with a logger. Warning
} | ||
} | ||
|
||
private suspend fun updateItem(itemId: Int) { |
Check warning
Code scanning / detekt
Excessive nesting leads to hidden complexity. Prefer extracting code to make it easier to understand. Warning
why is it marked as a draft? please show the preview <3 |
...otlin/net/ccbluex/liquidbounce/features/command/commands/client/marketplace/SearchCommand.kt
Outdated
Show resolved
Hide resolved
...otlin/net/ccbluex/liquidbounce/features/command/commands/client/marketplace/SearchCommand.kt
Show resolved
Hide resolved
import okhttp3.RequestBody.Companion.asRequestBody | ||
import java.io.File | ||
|
||
object MarketplaceApi : BaseApi(API_V3_ENDPOINT) { |
Check warning
Code scanning / detekt
Too many functions inside a/an file/class/object/interface always indicate a violation of the single responsibility principle. Maybe the file/class/object/interface wants to manage too many things at once. Extract functionality which clearly belongs together. Warning
suspend fun getMarketplaceItems( | ||
page: Int = 1, | ||
limit: Int = 10, | ||
query: String? = null, | ||
type: MarketplaceItemType? = null, | ||
uid: String? = null, | ||
branch: String? = null, | ||
unapproved: Boolean = false | ||
): PaginatedResponse<MarketplaceItem> { |
Check warning
Code scanning / detekt
The more parameters a function has the more complex it is. Long parameter lists are often used to control complex algorithms and violate the Single Responsibility Principle. Prefer functions with short parameter lists. Warning
suspend fun getFeaturedMarketplaceItems( | ||
page: Int = 1, | ||
limit: Int = 10, | ||
query: String? = null, | ||
type: MarketplaceItemType? = null, | ||
uid: String? = null, | ||
branch: String? = null | ||
): PaginatedResponse<MarketplaceItem> { |
Check warning
Code scanning / detekt
The more parameters a function has the more complex it is. Long parameter lists are often used to control complex algorithms and violate the Single Responsibility Principle. Prefer functions with short parameter lists. Warning
As command:
GUI will be implemented by another PR.