Skip to content
Merged
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
2 changes: 2 additions & 0 deletions common-api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ dependencies {
// https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient
compileOnly("org.apache.httpcomponents:httpclient:4.5.10")

compileOnly("com.google.code.gson:gson:2.8.6")

// https://mvnrepository.com/artifact/org.apache.httpcomponents/httpmime
testImplementation("org.apache.httpcomponents:httpmime:4.5.10")

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package com.itangcent.common.constant

/**
* Enum representing supported languages for translation
* @property code The language ISO code (e.g., "en", "zh")
* @property displayName The human-readable language name (e.g., "English", "Chinese")
*/
enum class Language(val code: String, val displayName: String) {
ENGLISH("en", "English"),
CHINESE("zh", "Chinese"),
SPANISH("es", "Spanish"),
FRENCH("fr", "French"),
GERMAN("de", "German"),
JAPANESE("ja", "Japanese"),
KOREAN("ko", "Korean"),
RUSSIAN("ru", "Russian"),
PORTUGUESE("pt", "Portuguese"),
ITALIAN("it", "Italian"),
DUTCH("nl", "Dutch"),
ARABIC("ar", "Arabic"),
HINDI("hi", "Hindi"),
TURKISH("tr", "Turkish"),
VIETNAMESE("vi", "Vietnamese");

companion object {
/**
* Find a Language by its code
* @param code The language code to search for
* @return The Language enum value or null if not found
*/
fun fromCode(code: String?): Language? {
return entries.find { it.code == code }
}

/**
* Get the language name from its code
* @param code The language code
* @return The language name or the original code if not found
*/
fun getNameFromCode(code: String): String {
return fromCode(code)?.displayName ?: code
}

/**
* Get the default language (English)
*/
fun getDefault(): Language = ENGLISH
}
}
3 changes: 3 additions & 0 deletions common-api/src/main/kotlin/com/itangcent/common/model/Doc.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.itangcent.common.model

import com.itangcent.common.utils.SimpleExtensible
import com.google.gson.annotations.Expose
import java.io.Serializable

/**
Expand All @@ -11,6 +12,8 @@ open class Doc : SimpleExtensible(), Serializable {
/**
* The element associated the origin code.
*/
@Transient
@Expose(serialize = false, deserialize = false)
var resource: Any? = null

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ class PostmanExportAction : ApiExportAction("Export Postman") {
builder.bindInstance(ExportChannel::class, ExportChannel.of("postman"))
builder.bindInstance(ExportDoc::class, ExportDoc.of("request"))

builder.bind(RequestBuilderListener::class) { it.with(CompositeRequestBuilderListener::class).singleton() }

builder.bind(MethodFilter::class) { it.with(ConfigurableMethodFilter::class).singleton() }

builder.bindInstance("file.save.default", "postman.json")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ class YapiExportAction : ApiExportAction("Export Yapi") {
builder.bindInstance(ExportChannel::class, ExportChannel.of("yapi"))
builder.bindInstance(ExportDoc::class, ExportDoc.of("request", "methodDoc"))

builder.bind(RequestBuilderListener::class) { it.with(CompositeRequestBuilderListener::class).singleton() }
builder.bind(MethodDocBuilderListener::class) { it.with(CompositeMethodDocBuilderListener::class).singleton() }

builder.bind(MethodFilter::class) { it.with(ConfigurableMethodFilter::class).singleton() }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package com.itangcent.idea.plugin.api.export.core
import com.google.inject.ImplementedBy
import com.itangcent.common.model.*

@ImplementedBy(DefaultRequestBuilderListener::class)
@ImplementedBy(CompositeRequestBuilderListener::class)
interface RequestBuilderListener {

fun setName(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,6 @@ open class SuvApiExporter {
builder.bindInstance(ExportChannel::class, ExportChannel.of("postman"))
builder.bindInstance(ExportDoc::class, ExportDoc.of("request"))

builder.bind(RequestBuilderListener::class) { it.with(CompositeRequestBuilderListener::class).singleton() }

builder.bindInstance("file.save.default", "postman.json")
builder.bindInstance("file.save.last.location.key", "com.itangcent.postman.export.path")

Expand Down Expand Up @@ -383,7 +381,6 @@ open class SuvApiExporter {
builder.bindInstance(ExportChannel::class, ExportChannel.of("yapi"))
builder.bindInstance(ExportDoc::class, ExportDoc.of("request", "methodDoc"))

builder.bind(RequestBuilderListener::class) { it.with(CompositeRequestBuilderListener::class).singleton() }
builder.bind(MethodDocBuilderListener::class) {
it.with(CompositeMethodDocBuilderListener::class).singleton()
}
Expand Down
Loading
Loading