From a11b4b05068d2b0ddaf3d0df7369097656d44a8f Mon Sep 17 00:00:00 2001 From: ShivkeshMadasu Date: Fri, 12 May 2023 14:45:28 +0530 Subject: [PATCH 1/7] DEX-208 JSON documentation for Android SDK --- Skyflow/build.gradle | 4 +- Skyflow/src/main/kotlin/Skyflow/Client.kt | 9 +- .../src/main/kotlin/Skyflow/Description.kt | 3 + Skyflow/src/main/kotlin/Skyflow/GenJson.kt | 254 ++++++++ .../main/kotlin/Skyflow/RevealContainer.kt | 4 + docs/json/output.json | 557 ++++++++++++++++++ 6 files changed, 827 insertions(+), 4 deletions(-) create mode 100644 Skyflow/src/main/kotlin/Skyflow/Description.kt create mode 100644 Skyflow/src/main/kotlin/Skyflow/GenJson.kt create mode 100644 docs/json/output.json diff --git a/Skyflow/build.gradle b/Skyflow/build.gradle index 27799126..ab2c7240 100644 --- a/Skyflow/build.gradle +++ b/Skyflow/build.gradle @@ -103,8 +103,8 @@ dependencies { testImplementation "org.robolectric:robolectric:4.6.1" testImplementation 'io.mockk:mockk:1.8.5' androidTestImplementation "org.robolectric:robolectric:4.6.1" - - + implementation "org.jetbrains.kotlin:kotlin-reflect:1.6.21" + implementation 'com.fasterxml.jackson.module:jackson-module-kotlin:2.13.3' } publish.dependsOn assemble diff --git a/Skyflow/src/main/kotlin/Skyflow/Client.kt b/Skyflow/src/main/kotlin/Skyflow/Client.kt index 8965239b..e9b47dff 100644 --- a/Skyflow/src/main/kotlin/Skyflow/Client.kt +++ b/Skyflow/src/main/kotlin/Skyflow/Client.kt @@ -14,6 +14,7 @@ import javax.xml.parsers.DocumentBuilderFactory import kotlin.Exception import kotlin.reflect.KClass +@Description("This is Client class") class Client internal constructor( val configuration: Configuration, ){ @@ -45,7 +46,12 @@ class Client internal constructor( } } - fun getById(records: JSONObject, callback: Callback) + @Description("This is getById function") + fun getById( + @Description("This is getById records param") + records: JSONObject, + @Description("This is getById callback param") + callback: Callback) { Logger.info(tag, Messages.GET_BY_ID_CALLED.getMessage(), configuration.options.logLevel) try { @@ -199,4 +205,3 @@ class Client internal constructor( } - diff --git a/Skyflow/src/main/kotlin/Skyflow/Description.kt b/Skyflow/src/main/kotlin/Skyflow/Description.kt new file mode 100644 index 00000000..038bf44d --- /dev/null +++ b/Skyflow/src/main/kotlin/Skyflow/Description.kt @@ -0,0 +1,3 @@ +package Skyflow + +annotation class Description(val text: String) \ No newline at end of file diff --git a/Skyflow/src/main/kotlin/Skyflow/GenJson.kt b/Skyflow/src/main/kotlin/Skyflow/GenJson.kt new file mode 100644 index 00000000..8d811cef --- /dev/null +++ b/Skyflow/src/main/kotlin/Skyflow/GenJson.kt @@ -0,0 +1,254 @@ +package com.Skyflow + +import Skyflow.CollectContainer +import Skyflow.Description +import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper +import kotlin.reflect.KParameter +import com.fasterxml.jackson.databind.SerializationFeature +import java.io.File +import kotlin.reflect.* +//import java.lang.reflect.Modifier +import kotlin.reflect.KVisibility +import kotlin.reflect.full.* +import kotlin.reflect.jvm.* + +data class Arg(val name: String, val type: String, val description: String?) +data class Method(val name: String, val args: List, val description: String?, val returnType: String) +data class CompanionObject(val properties:List, val methods: List) +data class ClassInfo( + val name: String, + val type: String, + val args: List, + var methods: List, + val enumValues: List, + val companionObject: CompanionObject?, + val description: String? +) + +/** + * Student Class with name and age + * @property name name of student + * @property age age of student + */ +class Student(val name: String, val age: Int) { + + /** + * Description for display + */ + @Description("Random method in Student class") + fun display() { + println("$name is $age years old") + } + + /** + * Random method in Student class + * @param arg1 argument 1 + * @param arg2 argument 2 + */ + @Description("Random method in Student class") + @Deprecated("Support for this method will be removed soon. Please contact admin", level = DeprecationLevel.WARNING) + fun method(arg1: String, arg2: String) { + println(arg1) + println(arg2) + } +} +class GenJson {} + +fun getMethodDetails(method: KFunction<*>): Method { + return if (method.parameters.isNotEmpty()) { + Method( + method.name, + method.parameters + .filterNot { it.kind == KParameter.Kind.INSTANCE } + .map { + Arg( + it.name.toString(), + it.type.toString(), + it.findAnnotation()?.text ?: "" + ) + }, + method.findAnnotation()?.text ?: "", + method.returnType.toString() + ) + } else { + Method( + method.name, + emptyList(), + method.findAnnotation()?.text ?: "", + method.returnType.toString() + ) + } +} + +fun getCompanionObjectDetails(module: KClass): CompanionObject { + // get properties and methods defined inside companion object + val properties = module.companionObject?.declaredMemberProperties + ?.map { Arg( + it.name, + it.returnType.toString(), + it.findAnnotation()?.text ?: "" + )}!! + val methods = module.companionObject?.declaredFunctions + ?.filterNot { method -> method.hasAnnotation() } + ?.filterNot { method -> method.visibility == KVisibility.INTERNAL } + ?.map { method -> getMethodDetails(method) }!! + return CompanionObject(properties, methods) +} + +fun main() { + // This list is for classes + val packages = listOf("Client", "Configuration", "TokenProvider", "LogLevel", "Env", "utils.EventName", "ContainerType", "Callback", "Options", + "CollectElementInput", "CollectElementOptions", "CollectOptions", "RevealElementInput", "RevealElementOptions", "RevealOptions", + "InsertOptions", "SkyflowElementType", "RedactionType", "Styles", "Style", "Padding", "CollectContainer", "RevealContainer") + + // If a file has class and methods outside class. Provide it in both lists to get class details from above list and methods details outside class from below + + // This list is for files that have methods outside the class or with no class. Provide whole filename along with Kt extension. + val ktPackages = listOf("CollectContainerKt", "RevealContainerKt", "InitKt") + var list = listOf() + var args: List + var methods: List + var enumValues: List + var companionObject: CompanionObject? + var classInfo: ClassInfo + + for( packageName in packages) { + val module = Class.forName("Skyflow."+packageName).kotlin + + // check for enum Class + if(module.java.isEnum) { + + // get enum values + enumValues = module.java.enumConstants.map { it.toString() } + + // get methods in the class + methods = module.declaredFunctions + .filterNot { method -> method.hasAnnotation() } + .filterNot { method -> method.visibility == KVisibility.INTERNAL } + .filterNot { method -> method.name == "valueOf" || method.name == "values"} + .map { method -> getMethodDetails(method) } + + // get companion object details + companionObject = if(module.companionObject?.isCompanion == true) { + getCompanionObjectDetails(module) + } else { + null + } + + // class details + classInfo = ClassInfo( + module.simpleName ?: "", + "enum", + emptyList(), + methods, + enumValues, + companionObject, + module.findAnnotation()?.text ?: "" + ) + + list += classInfo + } + else { + // get constructor arguments + args = when (module.java.isInterface) { + true -> emptyList() + false -> module.constructors?.first() + ?.parameters?.map { + Arg( + it.name!!, + it.type.toString(), + it.findAnnotation()?.text ?: "" + ) + } + } + + methods = module.declaredFunctions + .filterNot { method -> method.hasAnnotation() } + .filterNot { method -> method.visibility == KVisibility.INTERNAL } + .map { method -> getMethodDetails(method) } + + companionObject = if(module.companionObject?.isCompanion == true) { + getCompanionObjectDetails(module) + } else { + null + } + + classInfo = ClassInfo( + module.simpleName ?: "", + if (module.java.isInterface) "interface" else "class", + args, + methods, + emptyList(), + companionObject, + module.findAnnotation()?.text ?: "" + ) + list += classInfo + } + } + + for( ktPackage in ktPackages) { + val module = Class.forName("Skyflow."+ktPackage) + + // to get methods outside class or from a file with no class + methods = module.declaredMethods +// .filterNot { method -> method.getAnnotation()() } + .filterNot { method -> method.kotlinFunction?.visibility == KVisibility.INTERNAL } + .filterNot { method -> method.name.contains("\$default")} + .map { method -> + if (method.kotlinFunction?.parameters?.isNotEmpty() == true) { + Method( + method.name, + method.kotlinFunction?.parameters!! + .filterNot { it.name.toString() == "null" } + .filterNot { it.kind == KParameter.Kind.INSTANCE } + .map { + Arg( + it.name.toString(), + it.type.toString(), + it.findAnnotation()?.text ?: "" + ) + }, + method.kotlinFunction?.findAnnotation()?.text ?: "", + method.returnType.simpleName.toString() + ) + } else { + Method( + method.name, + emptyList(), + method.kotlinFunction?.findAnnotation()?.text ?: "", + method.returnType.simpleName.toString() + ) + } + } + + // find class details in list + val obj = list.find { it.name == module.simpleName.replace("Kt", "") } + + // if class details present add methods to that object or create new class info + if(obj == null) { + classInfo = ClassInfo( + module.simpleName.replace("Kt", "") ?: "", + "", + emptyList(), + methods, + emptyList(), + null, + "" + ) + list += classInfo + } + else { + obj.methods += methods + } + } + + val mapper = jacksonObjectMapper().configure(SerializationFeature.INDENT_OUTPUT, true) + val json = mapper.writeValueAsString(list) + + // code to write JSON to file + val filename = "output.json" // replace with desired filename + val path = "docs/json/" // replace with desired path + val file = File("$path$filename") + file.writeText(json) + +} diff --git a/Skyflow/src/main/kotlin/Skyflow/RevealContainer.kt b/Skyflow/src/main/kotlin/Skyflow/RevealContainer.kt index 00ae1530..0fa11c15 100644 --- a/Skyflow/src/main/kotlin/Skyflow/RevealContainer.kt +++ b/Skyflow/src/main/kotlin/Skyflow/RevealContainer.kt @@ -13,13 +13,16 @@ import org.json.JSONObject import java.lang.Exception import java.util.* +@Description("This is Reveal Container class") class RevealContainer : ContainerProtocol { private val tag = RevealContainer::class.qualifiedName } private val tag = RevealContainer::class.qualifiedName +@Deprecated("This is Deprecated") fun Container.create( + @Description("This is create Container params") context: Context, input: RevealElementInput, options: RevealElementOptions = RevealElementOptions() @@ -41,6 +44,7 @@ fun Container.create( return revealElement } +@Description("This is Reveal Container") fun Container.reveal( callback: Callback, options: RevealOptions? = RevealOptions() diff --git a/docs/json/output.json b/docs/json/output.json new file mode 100644 index 00000000..89e875e7 --- /dev/null +++ b/docs/json/output.json @@ -0,0 +1,557 @@ +[ { + "name" : "Client", + "type" : "class", + "args" : [ { + "name" : "configuration", + "type" : "Skyflow.Configuration", + "description" : "" + } ], + "methods" : [ { + "name" : "container", + "args" : [ { + "name" : "type", + "type" : "kotlin.reflect.KClass", + "description" : "" + } ], + "description" : "", + "returnType" : "Skyflow.Container" + }, { + "name" : "detokenize", + "args" : [ { + "name" : "records", + "type" : "org.json.JSONObject", + "description" : "" + }, { + "name" : "callback", + "type" : "Skyflow.Callback", + "description" : "" + } ], + "description" : "", + "returnType" : "kotlin.Unit" + }, { + "name" : "getById", + "args" : [ { + "name" : "records", + "type" : "org.json.JSONObject", + "description" : "This is getById records param" + }, { + "name" : "callback", + "type" : "Skyflow.Callback", + "description" : "This is getById callback param" + } ], + "description" : "This is getById function", + "returnType" : "kotlin.Unit" + }, { + "name" : "insert", + "args" : [ { + "name" : "records", + "type" : "org.json.JSONObject", + "description" : "" + }, { + "name" : "options", + "type" : "Skyflow.InsertOptions?", + "description" : "" + }, { + "name" : "callback", + "type" : "Skyflow.Callback", + "description" : "" + } ], + "description" : "", + "returnType" : "kotlin.Unit" + } ], + "enumValues" : [ ], + "companionObject" : null, + "description" : "This is Client class" +}, { + "name" : "Configuration", + "type" : "class", + "args" : [ { + "name" : "vaultID", + "type" : "kotlin.String", + "description" : "" + }, { + "name" : "vaultURL", + "type" : "kotlin.String", + "description" : "" + }, { + "name" : "tokenProvider", + "type" : "Skyflow.TokenProvider", + "description" : "" + }, { + "name" : "options", + "type" : "Skyflow.Options", + "description" : "" + } ], + "methods" : [ ], + "enumValues" : [ ], + "companionObject" : null, + "description" : "" +}, { + "name" : "TokenProvider", + "type" : "interface", + "args" : [ ], + "methods" : [ { + "name" : "getBearerToken", + "args" : [ { + "name" : "callback", + "type" : "Skyflow.Callback", + "description" : "" + } ], + "description" : "", + "returnType" : "kotlin.Unit" + } ], + "enumValues" : [ ], + "companionObject" : null, + "description" : "" +}, { + "name" : "LogLevel", + "type" : "enum", + "args" : [ ], + "methods" : [ ], + "enumValues" : [ "DEBUG", "INFO", "WARN", "ERROR" ], + "companionObject" : null, + "description" : "" +}, { + "name" : "Env", + "type" : "enum", + "args" : [ ], + "methods" : [ ], + "enumValues" : [ "DEV", "PROD" ], + "companionObject" : null, + "description" : "" +}, { + "name" : "EventName", + "type" : "enum", + "args" : [ ], + "methods" : [ ], + "enumValues" : [ "CHANGE", "READY", "FOCUS", "BLUR" ], + "companionObject" : null, + "description" : "" +}, { + "name" : "ContainerType", + "type" : "class", + "args" : [ ], + "methods" : [ ], + "enumValues" : [ ], + "companionObject" : { + "properties" : [ { + "name" : "COLLECT", + "type" : "kotlin.reflect.KClass", + "description" : "" + }, { + "name" : "REVEAL", + "type" : "kotlin.reflect.KClass", + "description" : "" + } ], + "methods" : [ ] + }, + "description" : "" +}, { + "name" : "Callback", + "type" : "interface", + "args" : [ ], + "methods" : [ { + "name" : "onFailure", + "args" : [ { + "name" : "exception", + "type" : "kotlin.Any", + "description" : "" + } ], + "description" : "", + "returnType" : "kotlin.Unit" + }, { + "name" : "onSuccess", + "args" : [ { + "name" : "responseBody", + "type" : "kotlin.Any", + "description" : "" + } ], + "description" : "", + "returnType" : "kotlin.Unit" + } ], + "enumValues" : [ ], + "companionObject" : null, + "description" : "" +}, { + "name" : "Options", + "type" : "class", + "args" : [ { + "name" : "logLevel", + "type" : "Skyflow.LogLevel", + "description" : "" + }, { + "name" : "env", + "type" : "Skyflow.Env", + "description" : "" + } ], + "methods" : [ ], + "enumValues" : [ ], + "companionObject" : null, + "description" : "" +}, { + "name" : "CollectElementInput", + "type" : "class", + "args" : [ { + "name" : "table", + "type" : "kotlin.String?", + "description" : "" + }, { + "name" : "column", + "type" : "kotlin.String?", + "description" : "" + }, { + "name" : "type", + "type" : "Skyflow.SkyflowElementType", + "description" : "" + }, { + "name" : "inputStyles", + "type" : "Skyflow.Styles", + "description" : "" + }, { + "name" : "labelStyles", + "type" : "Skyflow.Styles", + "description" : "" + }, { + "name" : "errorTextStyles", + "type" : "Skyflow.Styles", + "description" : "" + }, { + "name" : "label", + "type" : "kotlin.String", + "description" : "" + }, { + "name" : "placeholder", + "type" : "kotlin.String", + "description" : "" + }, { + "name" : "altText", + "type" : "kotlin.String", + "description" : "" + }, { + "name" : "validations", + "type" : "com.Skyflow.collect.elements.validations.ValidationSet", + "description" : "" + } ], + "methods" : [ ], + "enumValues" : [ ], + "companionObject" : null, + "description" : "" +}, { + "name" : "CollectElementOptions", + "type" : "class", + "args" : [ { + "name" : "required", + "type" : "kotlin.Boolean", + "description" : "" + }, { + "name" : "enableCardIcon", + "type" : "kotlin.Boolean", + "description" : "" + }, { + "name" : "format", + "type" : "kotlin.String", + "description" : "" + } ], + "methods" : [ ], + "enumValues" : [ ], + "companionObject" : null, + "description" : "" +}, { + "name" : "CollectOptions", + "type" : "class", + "args" : [ { + "name" : "token", + "type" : "kotlin.Boolean", + "description" : "" + }, { + "name" : "additionalFields", + "type" : "org.json.JSONObject?", + "description" : "" + }, { + "name" : "upsert", + "type" : "org.json.JSONArray?", + "description" : "" + } ], + "methods" : [ ], + "enumValues" : [ ], + "companionObject" : null, + "description" : "" +}, { + "name" : "RevealElementInput", + "type" : "class", + "args" : [ { + "name" : "token", + "type" : "kotlin.String?", + "description" : "" + }, { + "name" : "redaction", + "type" : "Skyflow.RedactionType?", + "description" : "" + }, { + "name" : "inputStyles", + "type" : "Skyflow.Styles", + "description" : "" + }, { + "name" : "labelStyles", + "type" : "Skyflow.Styles", + "description" : "" + }, { + "name" : "errorTextStyles", + "type" : "Skyflow.Styles", + "description" : "" + }, { + "name" : "label", + "type" : "kotlin.String", + "description" : "" + }, { + "name" : "altText", + "type" : "kotlin.String", + "description" : "" + } ], + "methods" : [ ], + "enumValues" : [ ], + "companionObject" : null, + "description" : "" +}, { + "name" : "RevealElementOptions", + "type" : "class", + "args" : [ { + "name" : "formatRegex", + "type" : "kotlin.String", + "description" : "" + }, { + "name" : "replaceText", + "type" : "kotlin.String?", + "description" : "" + } ], + "methods" : [ ], + "enumValues" : [ ], + "companionObject" : null, + "description" : "" +}, { + "name" : "RevealOptions", + "type" : "class", + "args" : [ ], + "methods" : [ ], + "enumValues" : [ ], + "companionObject" : null, + "description" : "" +}, { + "name" : "InsertOptions", + "type" : "class", + "args" : [ { + "name" : "tokens", + "type" : "kotlin.Boolean", + "description" : "" + }, { + "name" : "upsert", + "type" : "org.json.JSONArray?", + "description" : "" + } ], + "methods" : [ ], + "enumValues" : [ ], + "companionObject" : null, + "description" : "" +}, { + "name" : "SkyflowElementType", + "type" : "enum", + "args" : [ ], + "methods" : [ { + "name" : "getType", + "args" : [ ], + "description" : "", + "returnType" : "Skyflow.Type" + } ], + "enumValues" : [ "CARDHOLDER_NAME", "CARD_NUMBER", "EXPIRATION_DATE", "CVV", "INPUT_FIELD", "PIN", "EXPIRATION_MONTH", "EXPIRATION_YEAR" ], + "companionObject" : null, + "description" : "" +}, { + "name" : "RedactionType", + "type" : "enum", + "args" : [ ], + "methods" : [ ], + "enumValues" : [ "DEFAULT", "PLAIN_TEXT", "MASKED", "REDACTED" ], + "companionObject" : null, + "description" : "" +}, { + "name" : "Styles", + "type" : "class", + "args" : [ { + "name" : "base", + "type" : "Skyflow.Style?", + "description" : "" + }, { + "name" : "complete", + "type" : "Skyflow.Style?", + "description" : "" + }, { + "name" : "empty", + "type" : "Skyflow.Style?", + "description" : "" + }, { + "name" : "focus", + "type" : "Skyflow.Style?", + "description" : "" + }, { + "name" : "invalid", + "type" : "Skyflow.Style?", + "description" : "" + } ], + "methods" : [ ], + "enumValues" : [ ], + "companionObject" : null, + "description" : "" +}, { + "name" : "Style", + "type" : "class", + "args" : [ { + "name" : "borderColor", + "type" : "kotlin.Int?", + "description" : "" + }, { + "name" : "cornerRadius", + "type" : "kotlin.Float?", + "description" : "" + }, { + "name" : "padding", + "type" : "Skyflow.Padding?", + "description" : "" + }, { + "name" : "borderWidth", + "type" : "kotlin.Int?", + "description" : "" + }, { + "name" : "font", + "type" : "kotlin.Int?", + "description" : "" + }, { + "name" : "textAlignment", + "type" : "kotlin.Int?", + "description" : "" + }, { + "name" : "textColor", + "type" : "kotlin.Int?", + "description" : "" + } ], + "methods" : [ ], + "enumValues" : [ ], + "companionObject" : null, + "description" : "" +}, { + "name" : "Padding", + "type" : "class", + "args" : [ { + "name" : "left", + "type" : "kotlin.Int", + "description" : "" + }, { + "name" : "top", + "type" : "kotlin.Int", + "description" : "" + }, { + "name" : "right", + "type" : "kotlin.Int", + "description" : "" + }, { + "name" : "bottom", + "type" : "kotlin.Int", + "description" : "" + } ], + "methods" : [ ], + "enumValues" : [ ], + "companionObject" : null, + "description" : "" +}, { + "name" : "CollectContainer", + "type" : "class", + "args" : [ ], + "methods" : [ { + "name" : "collect", + "args" : [ { + "name" : "callback", + "type" : "Skyflow.Callback", + "description" : "" + }, { + "name" : "options", + "type" : "Skyflow.CollectOptions?", + "description" : "" + } ], + "description" : "", + "returnType" : "void" + }, { + "name" : "create", + "args" : [ { + "name" : "context", + "type" : "android.content.Context", + "description" : "" + }, { + "name" : "input", + "type" : "Skyflow.CollectElementInput", + "description" : "" + }, { + "name" : "options", + "type" : "Skyflow.CollectElementOptions", + "description" : "" + } ], + "description" : "", + "returnType" : "TextField" + } ], + "enumValues" : [ ], + "companionObject" : null, + "description" : "" +}, { + "name" : "RevealContainer", + "type" : "class", + "args" : [ ], + "methods" : [ { + "name" : "create", + "args" : [ { + "name" : "context", + "type" : "android.content.Context", + "description" : "This is create Container params" + }, { + "name" : "input", + "type" : "Skyflow.RevealElementInput", + "description" : "" + }, { + "name" : "options", + "type" : "Skyflow.RevealElementOptions", + "description" : "" + } ], + "description" : "", + "returnType" : "Label" + }, { + "name" : "reveal", + "args" : [ { + "name" : "callback", + "type" : "Skyflow.Callback", + "description" : "" + }, { + "name" : "options", + "type" : "Skyflow.RevealOptions?", + "description" : "" + } ], + "description" : "This is Reveal Container", + "returnType" : "void" + } ], + "enumValues" : [ ], + "companionObject" : null, + "description" : "This is Reveal Container class" +}, { + "name" : "Init", + "type" : "", + "args" : [ ], + "methods" : [ { + "name" : "init", + "args" : [ { + "name" : "configuration", + "type" : "Skyflow.Configuration", + "description" : "" + } ], + "description" : "", + "returnType" : "Client" + } ], + "enumValues" : [ ], + "companionObject" : null, + "description" : "" +} ] \ No newline at end of file From 3fffa3ab41fb113b027d5c15029cb24ec77d4dd7 Mon Sep 17 00:00:00 2001 From: ShivkeshMadasu Date: Fri, 12 May 2023 14:45:28 +0530 Subject: [PATCH 2/7] DEX-208 JSON documentation for Android SDK --- Skyflow/build.gradle | 3 + Skyflow/src/main/kotlin/Skyflow/Client.kt | 9 +- .../src/main/kotlin/Skyflow/Description.kt | 3 + Skyflow/src/main/kotlin/Skyflow/GenJson.kt | 254 ++++++++ .../main/kotlin/Skyflow/RevealContainer.kt | 4 + docs/json/output.json | 557 ++++++++++++++++++ 6 files changed, 828 insertions(+), 2 deletions(-) create mode 100644 Skyflow/src/main/kotlin/Skyflow/Description.kt create mode 100644 Skyflow/src/main/kotlin/Skyflow/GenJson.kt create mode 100644 docs/json/output.json diff --git a/Skyflow/build.gradle b/Skyflow/build.gradle index 15f05819..61138282 100644 --- a/Skyflow/build.gradle +++ b/Skyflow/build.gradle @@ -143,6 +143,9 @@ dependencies { testImplementation "org.robolectric:robolectric:4.6.1" testImplementation 'io.mockk:mockk:1.8.5' androidTestImplementation "org.robolectric:robolectric:4.6.1" + implementation "org.jetbrains.kotlin:kotlin-reflect:1.6.21" + implementation 'com.fasterxml.jackson.module:jackson-module-kotlin:2.13.3' + } publish.dependsOn assemble diff --git a/Skyflow/src/main/kotlin/Skyflow/Client.kt b/Skyflow/src/main/kotlin/Skyflow/Client.kt index 8965239b..e9b47dff 100644 --- a/Skyflow/src/main/kotlin/Skyflow/Client.kt +++ b/Skyflow/src/main/kotlin/Skyflow/Client.kt @@ -14,6 +14,7 @@ import javax.xml.parsers.DocumentBuilderFactory import kotlin.Exception import kotlin.reflect.KClass +@Description("This is Client class") class Client internal constructor( val configuration: Configuration, ){ @@ -45,7 +46,12 @@ class Client internal constructor( } } - fun getById(records: JSONObject, callback: Callback) + @Description("This is getById function") + fun getById( + @Description("This is getById records param") + records: JSONObject, + @Description("This is getById callback param") + callback: Callback) { Logger.info(tag, Messages.GET_BY_ID_CALLED.getMessage(), configuration.options.logLevel) try { @@ -199,4 +205,3 @@ class Client internal constructor( } - diff --git a/Skyflow/src/main/kotlin/Skyflow/Description.kt b/Skyflow/src/main/kotlin/Skyflow/Description.kt new file mode 100644 index 00000000..038bf44d --- /dev/null +++ b/Skyflow/src/main/kotlin/Skyflow/Description.kt @@ -0,0 +1,3 @@ +package Skyflow + +annotation class Description(val text: String) \ No newline at end of file diff --git a/Skyflow/src/main/kotlin/Skyflow/GenJson.kt b/Skyflow/src/main/kotlin/Skyflow/GenJson.kt new file mode 100644 index 00000000..8d811cef --- /dev/null +++ b/Skyflow/src/main/kotlin/Skyflow/GenJson.kt @@ -0,0 +1,254 @@ +package com.Skyflow + +import Skyflow.CollectContainer +import Skyflow.Description +import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper +import kotlin.reflect.KParameter +import com.fasterxml.jackson.databind.SerializationFeature +import java.io.File +import kotlin.reflect.* +//import java.lang.reflect.Modifier +import kotlin.reflect.KVisibility +import kotlin.reflect.full.* +import kotlin.reflect.jvm.* + +data class Arg(val name: String, val type: String, val description: String?) +data class Method(val name: String, val args: List, val description: String?, val returnType: String) +data class CompanionObject(val properties:List, val methods: List) +data class ClassInfo( + val name: String, + val type: String, + val args: List, + var methods: List, + val enumValues: List, + val companionObject: CompanionObject?, + val description: String? +) + +/** + * Student Class with name and age + * @property name name of student + * @property age age of student + */ +class Student(val name: String, val age: Int) { + + /** + * Description for display + */ + @Description("Random method in Student class") + fun display() { + println("$name is $age years old") + } + + /** + * Random method in Student class + * @param arg1 argument 1 + * @param arg2 argument 2 + */ + @Description("Random method in Student class") + @Deprecated("Support for this method will be removed soon. Please contact admin", level = DeprecationLevel.WARNING) + fun method(arg1: String, arg2: String) { + println(arg1) + println(arg2) + } +} +class GenJson {} + +fun getMethodDetails(method: KFunction<*>): Method { + return if (method.parameters.isNotEmpty()) { + Method( + method.name, + method.parameters + .filterNot { it.kind == KParameter.Kind.INSTANCE } + .map { + Arg( + it.name.toString(), + it.type.toString(), + it.findAnnotation()?.text ?: "" + ) + }, + method.findAnnotation()?.text ?: "", + method.returnType.toString() + ) + } else { + Method( + method.name, + emptyList(), + method.findAnnotation()?.text ?: "", + method.returnType.toString() + ) + } +} + +fun getCompanionObjectDetails(module: KClass): CompanionObject { + // get properties and methods defined inside companion object + val properties = module.companionObject?.declaredMemberProperties + ?.map { Arg( + it.name, + it.returnType.toString(), + it.findAnnotation()?.text ?: "" + )}!! + val methods = module.companionObject?.declaredFunctions + ?.filterNot { method -> method.hasAnnotation() } + ?.filterNot { method -> method.visibility == KVisibility.INTERNAL } + ?.map { method -> getMethodDetails(method) }!! + return CompanionObject(properties, methods) +} + +fun main() { + // This list is for classes + val packages = listOf("Client", "Configuration", "TokenProvider", "LogLevel", "Env", "utils.EventName", "ContainerType", "Callback", "Options", + "CollectElementInput", "CollectElementOptions", "CollectOptions", "RevealElementInput", "RevealElementOptions", "RevealOptions", + "InsertOptions", "SkyflowElementType", "RedactionType", "Styles", "Style", "Padding", "CollectContainer", "RevealContainer") + + // If a file has class and methods outside class. Provide it in both lists to get class details from above list and methods details outside class from below + + // This list is for files that have methods outside the class or with no class. Provide whole filename along with Kt extension. + val ktPackages = listOf("CollectContainerKt", "RevealContainerKt", "InitKt") + var list = listOf() + var args: List + var methods: List + var enumValues: List + var companionObject: CompanionObject? + var classInfo: ClassInfo + + for( packageName in packages) { + val module = Class.forName("Skyflow."+packageName).kotlin + + // check for enum Class + if(module.java.isEnum) { + + // get enum values + enumValues = module.java.enumConstants.map { it.toString() } + + // get methods in the class + methods = module.declaredFunctions + .filterNot { method -> method.hasAnnotation() } + .filterNot { method -> method.visibility == KVisibility.INTERNAL } + .filterNot { method -> method.name == "valueOf" || method.name == "values"} + .map { method -> getMethodDetails(method) } + + // get companion object details + companionObject = if(module.companionObject?.isCompanion == true) { + getCompanionObjectDetails(module) + } else { + null + } + + // class details + classInfo = ClassInfo( + module.simpleName ?: "", + "enum", + emptyList(), + methods, + enumValues, + companionObject, + module.findAnnotation()?.text ?: "" + ) + + list += classInfo + } + else { + // get constructor arguments + args = when (module.java.isInterface) { + true -> emptyList() + false -> module.constructors?.first() + ?.parameters?.map { + Arg( + it.name!!, + it.type.toString(), + it.findAnnotation()?.text ?: "" + ) + } + } + + methods = module.declaredFunctions + .filterNot { method -> method.hasAnnotation() } + .filterNot { method -> method.visibility == KVisibility.INTERNAL } + .map { method -> getMethodDetails(method) } + + companionObject = if(module.companionObject?.isCompanion == true) { + getCompanionObjectDetails(module) + } else { + null + } + + classInfo = ClassInfo( + module.simpleName ?: "", + if (module.java.isInterface) "interface" else "class", + args, + methods, + emptyList(), + companionObject, + module.findAnnotation()?.text ?: "" + ) + list += classInfo + } + } + + for( ktPackage in ktPackages) { + val module = Class.forName("Skyflow."+ktPackage) + + // to get methods outside class or from a file with no class + methods = module.declaredMethods +// .filterNot { method -> method.getAnnotation()() } + .filterNot { method -> method.kotlinFunction?.visibility == KVisibility.INTERNAL } + .filterNot { method -> method.name.contains("\$default")} + .map { method -> + if (method.kotlinFunction?.parameters?.isNotEmpty() == true) { + Method( + method.name, + method.kotlinFunction?.parameters!! + .filterNot { it.name.toString() == "null" } + .filterNot { it.kind == KParameter.Kind.INSTANCE } + .map { + Arg( + it.name.toString(), + it.type.toString(), + it.findAnnotation()?.text ?: "" + ) + }, + method.kotlinFunction?.findAnnotation()?.text ?: "", + method.returnType.simpleName.toString() + ) + } else { + Method( + method.name, + emptyList(), + method.kotlinFunction?.findAnnotation()?.text ?: "", + method.returnType.simpleName.toString() + ) + } + } + + // find class details in list + val obj = list.find { it.name == module.simpleName.replace("Kt", "") } + + // if class details present add methods to that object or create new class info + if(obj == null) { + classInfo = ClassInfo( + module.simpleName.replace("Kt", "") ?: "", + "", + emptyList(), + methods, + emptyList(), + null, + "" + ) + list += classInfo + } + else { + obj.methods += methods + } + } + + val mapper = jacksonObjectMapper().configure(SerializationFeature.INDENT_OUTPUT, true) + val json = mapper.writeValueAsString(list) + + // code to write JSON to file + val filename = "output.json" // replace with desired filename + val path = "docs/json/" // replace with desired path + val file = File("$path$filename") + file.writeText(json) + +} diff --git a/Skyflow/src/main/kotlin/Skyflow/RevealContainer.kt b/Skyflow/src/main/kotlin/Skyflow/RevealContainer.kt index bc9cd627..ceb34ee5 100644 --- a/Skyflow/src/main/kotlin/Skyflow/RevealContainer.kt +++ b/Skyflow/src/main/kotlin/Skyflow/RevealContainer.kt @@ -12,13 +12,16 @@ import Skyflow.utils.Utils.Companion.checkIfElementsMounted import java.lang.Exception import java.util.* +@Description("This is Reveal Container class") class RevealContainer : ContainerProtocol { private val tag = RevealContainer::class.qualifiedName } private val tag = RevealContainer::class.qualifiedName +@Deprecated("This is Deprecated") fun Container.create( + @Description("This is create Container params") context: Context, input: RevealElementInput, options: RevealElementOptions = RevealElementOptions() @@ -40,6 +43,7 @@ fun Container.create( return revealElement } +@Description("This is Reveal Container") fun Container.reveal( callback: Callback, options: RevealOptions? = RevealOptions() diff --git a/docs/json/output.json b/docs/json/output.json new file mode 100644 index 00000000..89e875e7 --- /dev/null +++ b/docs/json/output.json @@ -0,0 +1,557 @@ +[ { + "name" : "Client", + "type" : "class", + "args" : [ { + "name" : "configuration", + "type" : "Skyflow.Configuration", + "description" : "" + } ], + "methods" : [ { + "name" : "container", + "args" : [ { + "name" : "type", + "type" : "kotlin.reflect.KClass", + "description" : "" + } ], + "description" : "", + "returnType" : "Skyflow.Container" + }, { + "name" : "detokenize", + "args" : [ { + "name" : "records", + "type" : "org.json.JSONObject", + "description" : "" + }, { + "name" : "callback", + "type" : "Skyflow.Callback", + "description" : "" + } ], + "description" : "", + "returnType" : "kotlin.Unit" + }, { + "name" : "getById", + "args" : [ { + "name" : "records", + "type" : "org.json.JSONObject", + "description" : "This is getById records param" + }, { + "name" : "callback", + "type" : "Skyflow.Callback", + "description" : "This is getById callback param" + } ], + "description" : "This is getById function", + "returnType" : "kotlin.Unit" + }, { + "name" : "insert", + "args" : [ { + "name" : "records", + "type" : "org.json.JSONObject", + "description" : "" + }, { + "name" : "options", + "type" : "Skyflow.InsertOptions?", + "description" : "" + }, { + "name" : "callback", + "type" : "Skyflow.Callback", + "description" : "" + } ], + "description" : "", + "returnType" : "kotlin.Unit" + } ], + "enumValues" : [ ], + "companionObject" : null, + "description" : "This is Client class" +}, { + "name" : "Configuration", + "type" : "class", + "args" : [ { + "name" : "vaultID", + "type" : "kotlin.String", + "description" : "" + }, { + "name" : "vaultURL", + "type" : "kotlin.String", + "description" : "" + }, { + "name" : "tokenProvider", + "type" : "Skyflow.TokenProvider", + "description" : "" + }, { + "name" : "options", + "type" : "Skyflow.Options", + "description" : "" + } ], + "methods" : [ ], + "enumValues" : [ ], + "companionObject" : null, + "description" : "" +}, { + "name" : "TokenProvider", + "type" : "interface", + "args" : [ ], + "methods" : [ { + "name" : "getBearerToken", + "args" : [ { + "name" : "callback", + "type" : "Skyflow.Callback", + "description" : "" + } ], + "description" : "", + "returnType" : "kotlin.Unit" + } ], + "enumValues" : [ ], + "companionObject" : null, + "description" : "" +}, { + "name" : "LogLevel", + "type" : "enum", + "args" : [ ], + "methods" : [ ], + "enumValues" : [ "DEBUG", "INFO", "WARN", "ERROR" ], + "companionObject" : null, + "description" : "" +}, { + "name" : "Env", + "type" : "enum", + "args" : [ ], + "methods" : [ ], + "enumValues" : [ "DEV", "PROD" ], + "companionObject" : null, + "description" : "" +}, { + "name" : "EventName", + "type" : "enum", + "args" : [ ], + "methods" : [ ], + "enumValues" : [ "CHANGE", "READY", "FOCUS", "BLUR" ], + "companionObject" : null, + "description" : "" +}, { + "name" : "ContainerType", + "type" : "class", + "args" : [ ], + "methods" : [ ], + "enumValues" : [ ], + "companionObject" : { + "properties" : [ { + "name" : "COLLECT", + "type" : "kotlin.reflect.KClass", + "description" : "" + }, { + "name" : "REVEAL", + "type" : "kotlin.reflect.KClass", + "description" : "" + } ], + "methods" : [ ] + }, + "description" : "" +}, { + "name" : "Callback", + "type" : "interface", + "args" : [ ], + "methods" : [ { + "name" : "onFailure", + "args" : [ { + "name" : "exception", + "type" : "kotlin.Any", + "description" : "" + } ], + "description" : "", + "returnType" : "kotlin.Unit" + }, { + "name" : "onSuccess", + "args" : [ { + "name" : "responseBody", + "type" : "kotlin.Any", + "description" : "" + } ], + "description" : "", + "returnType" : "kotlin.Unit" + } ], + "enumValues" : [ ], + "companionObject" : null, + "description" : "" +}, { + "name" : "Options", + "type" : "class", + "args" : [ { + "name" : "logLevel", + "type" : "Skyflow.LogLevel", + "description" : "" + }, { + "name" : "env", + "type" : "Skyflow.Env", + "description" : "" + } ], + "methods" : [ ], + "enumValues" : [ ], + "companionObject" : null, + "description" : "" +}, { + "name" : "CollectElementInput", + "type" : "class", + "args" : [ { + "name" : "table", + "type" : "kotlin.String?", + "description" : "" + }, { + "name" : "column", + "type" : "kotlin.String?", + "description" : "" + }, { + "name" : "type", + "type" : "Skyflow.SkyflowElementType", + "description" : "" + }, { + "name" : "inputStyles", + "type" : "Skyflow.Styles", + "description" : "" + }, { + "name" : "labelStyles", + "type" : "Skyflow.Styles", + "description" : "" + }, { + "name" : "errorTextStyles", + "type" : "Skyflow.Styles", + "description" : "" + }, { + "name" : "label", + "type" : "kotlin.String", + "description" : "" + }, { + "name" : "placeholder", + "type" : "kotlin.String", + "description" : "" + }, { + "name" : "altText", + "type" : "kotlin.String", + "description" : "" + }, { + "name" : "validations", + "type" : "com.Skyflow.collect.elements.validations.ValidationSet", + "description" : "" + } ], + "methods" : [ ], + "enumValues" : [ ], + "companionObject" : null, + "description" : "" +}, { + "name" : "CollectElementOptions", + "type" : "class", + "args" : [ { + "name" : "required", + "type" : "kotlin.Boolean", + "description" : "" + }, { + "name" : "enableCardIcon", + "type" : "kotlin.Boolean", + "description" : "" + }, { + "name" : "format", + "type" : "kotlin.String", + "description" : "" + } ], + "methods" : [ ], + "enumValues" : [ ], + "companionObject" : null, + "description" : "" +}, { + "name" : "CollectOptions", + "type" : "class", + "args" : [ { + "name" : "token", + "type" : "kotlin.Boolean", + "description" : "" + }, { + "name" : "additionalFields", + "type" : "org.json.JSONObject?", + "description" : "" + }, { + "name" : "upsert", + "type" : "org.json.JSONArray?", + "description" : "" + } ], + "methods" : [ ], + "enumValues" : [ ], + "companionObject" : null, + "description" : "" +}, { + "name" : "RevealElementInput", + "type" : "class", + "args" : [ { + "name" : "token", + "type" : "kotlin.String?", + "description" : "" + }, { + "name" : "redaction", + "type" : "Skyflow.RedactionType?", + "description" : "" + }, { + "name" : "inputStyles", + "type" : "Skyflow.Styles", + "description" : "" + }, { + "name" : "labelStyles", + "type" : "Skyflow.Styles", + "description" : "" + }, { + "name" : "errorTextStyles", + "type" : "Skyflow.Styles", + "description" : "" + }, { + "name" : "label", + "type" : "kotlin.String", + "description" : "" + }, { + "name" : "altText", + "type" : "kotlin.String", + "description" : "" + } ], + "methods" : [ ], + "enumValues" : [ ], + "companionObject" : null, + "description" : "" +}, { + "name" : "RevealElementOptions", + "type" : "class", + "args" : [ { + "name" : "formatRegex", + "type" : "kotlin.String", + "description" : "" + }, { + "name" : "replaceText", + "type" : "kotlin.String?", + "description" : "" + } ], + "methods" : [ ], + "enumValues" : [ ], + "companionObject" : null, + "description" : "" +}, { + "name" : "RevealOptions", + "type" : "class", + "args" : [ ], + "methods" : [ ], + "enumValues" : [ ], + "companionObject" : null, + "description" : "" +}, { + "name" : "InsertOptions", + "type" : "class", + "args" : [ { + "name" : "tokens", + "type" : "kotlin.Boolean", + "description" : "" + }, { + "name" : "upsert", + "type" : "org.json.JSONArray?", + "description" : "" + } ], + "methods" : [ ], + "enumValues" : [ ], + "companionObject" : null, + "description" : "" +}, { + "name" : "SkyflowElementType", + "type" : "enum", + "args" : [ ], + "methods" : [ { + "name" : "getType", + "args" : [ ], + "description" : "", + "returnType" : "Skyflow.Type" + } ], + "enumValues" : [ "CARDHOLDER_NAME", "CARD_NUMBER", "EXPIRATION_DATE", "CVV", "INPUT_FIELD", "PIN", "EXPIRATION_MONTH", "EXPIRATION_YEAR" ], + "companionObject" : null, + "description" : "" +}, { + "name" : "RedactionType", + "type" : "enum", + "args" : [ ], + "methods" : [ ], + "enumValues" : [ "DEFAULT", "PLAIN_TEXT", "MASKED", "REDACTED" ], + "companionObject" : null, + "description" : "" +}, { + "name" : "Styles", + "type" : "class", + "args" : [ { + "name" : "base", + "type" : "Skyflow.Style?", + "description" : "" + }, { + "name" : "complete", + "type" : "Skyflow.Style?", + "description" : "" + }, { + "name" : "empty", + "type" : "Skyflow.Style?", + "description" : "" + }, { + "name" : "focus", + "type" : "Skyflow.Style?", + "description" : "" + }, { + "name" : "invalid", + "type" : "Skyflow.Style?", + "description" : "" + } ], + "methods" : [ ], + "enumValues" : [ ], + "companionObject" : null, + "description" : "" +}, { + "name" : "Style", + "type" : "class", + "args" : [ { + "name" : "borderColor", + "type" : "kotlin.Int?", + "description" : "" + }, { + "name" : "cornerRadius", + "type" : "kotlin.Float?", + "description" : "" + }, { + "name" : "padding", + "type" : "Skyflow.Padding?", + "description" : "" + }, { + "name" : "borderWidth", + "type" : "kotlin.Int?", + "description" : "" + }, { + "name" : "font", + "type" : "kotlin.Int?", + "description" : "" + }, { + "name" : "textAlignment", + "type" : "kotlin.Int?", + "description" : "" + }, { + "name" : "textColor", + "type" : "kotlin.Int?", + "description" : "" + } ], + "methods" : [ ], + "enumValues" : [ ], + "companionObject" : null, + "description" : "" +}, { + "name" : "Padding", + "type" : "class", + "args" : [ { + "name" : "left", + "type" : "kotlin.Int", + "description" : "" + }, { + "name" : "top", + "type" : "kotlin.Int", + "description" : "" + }, { + "name" : "right", + "type" : "kotlin.Int", + "description" : "" + }, { + "name" : "bottom", + "type" : "kotlin.Int", + "description" : "" + } ], + "methods" : [ ], + "enumValues" : [ ], + "companionObject" : null, + "description" : "" +}, { + "name" : "CollectContainer", + "type" : "class", + "args" : [ ], + "methods" : [ { + "name" : "collect", + "args" : [ { + "name" : "callback", + "type" : "Skyflow.Callback", + "description" : "" + }, { + "name" : "options", + "type" : "Skyflow.CollectOptions?", + "description" : "" + } ], + "description" : "", + "returnType" : "void" + }, { + "name" : "create", + "args" : [ { + "name" : "context", + "type" : "android.content.Context", + "description" : "" + }, { + "name" : "input", + "type" : "Skyflow.CollectElementInput", + "description" : "" + }, { + "name" : "options", + "type" : "Skyflow.CollectElementOptions", + "description" : "" + } ], + "description" : "", + "returnType" : "TextField" + } ], + "enumValues" : [ ], + "companionObject" : null, + "description" : "" +}, { + "name" : "RevealContainer", + "type" : "class", + "args" : [ ], + "methods" : [ { + "name" : "create", + "args" : [ { + "name" : "context", + "type" : "android.content.Context", + "description" : "This is create Container params" + }, { + "name" : "input", + "type" : "Skyflow.RevealElementInput", + "description" : "" + }, { + "name" : "options", + "type" : "Skyflow.RevealElementOptions", + "description" : "" + } ], + "description" : "", + "returnType" : "Label" + }, { + "name" : "reveal", + "args" : [ { + "name" : "callback", + "type" : "Skyflow.Callback", + "description" : "" + }, { + "name" : "options", + "type" : "Skyflow.RevealOptions?", + "description" : "" + } ], + "description" : "This is Reveal Container", + "returnType" : "void" + } ], + "enumValues" : [ ], + "companionObject" : null, + "description" : "This is Reveal Container class" +}, { + "name" : "Init", + "type" : "", + "args" : [ ], + "methods" : [ { + "name" : "init", + "args" : [ { + "name" : "configuration", + "type" : "Skyflow.Configuration", + "description" : "" + } ], + "description" : "", + "returnType" : "Client" + } ], + "enumValues" : [ ], + "companionObject" : null, + "description" : "" +} ] \ No newline at end of file From fd65ea1790c1721bd8bb0257615f5c03347f34c7 Mon Sep 17 00:00:00 2001 From: ShivkeshMadasu Date: Tue, 13 Jun 2023 09:41:13 +0530 Subject: [PATCH 3/7] DEX-208 Overview page and styling changes --- Skyflow/build.gradle | 3 +- Skyflow/src/main/kotlin/Skyflow/Callback.kt | 14 +- Skyflow/src/main/kotlin/Skyflow/Client.kt | 40 +++- .../main/kotlin/Skyflow/CollectContainer.kt | 20 +- .../kotlin/Skyflow/CollectElementInput.kt | 29 ++- .../kotlin/Skyflow/CollectElementOptions.kt | 4 + .../src/main/kotlin/Skyflow/CollectOptions.kt | 10 +- .../src/main/kotlin/Skyflow/Configuration.kt | 6 +- .../src/main/kotlin/Skyflow/ContainerType.kt | 1 + .../src/main/kotlin/Skyflow/ElementType.kt | 1 + Skyflow/src/main/kotlin/Skyflow/Env.kt | 1 + Skyflow/src/main/kotlin/Skyflow/GenJson.kt | 85 ++++++-- .../src/main/kotlin/Skyflow/GenMarkdown.kt | 194 ++++++++++++++++++ Skyflow/src/main/kotlin/Skyflow/Init.kt | 7 +- .../src/main/kotlin/Skyflow/InsertOptions.kt | 3 + Skyflow/src/main/kotlin/Skyflow/LogLevel.kt | 1 + Skyflow/src/main/kotlin/Skyflow/Options.kt | 8 +- Skyflow/src/main/kotlin/Skyflow/Padding.kt | 12 +- .../src/main/kotlin/Skyflow/RedactionType.kt | 1 + .../main/kotlin/Skyflow/RevealContainer.kt | 12 +- .../main/kotlin/Skyflow/RevealElementInput.kt | 8 + .../kotlin/Skyflow/RevealElementOptions.kt | 8 +- .../src/main/kotlin/Skyflow/RevealOptions.kt | 1 + Skyflow/src/main/kotlin/Skyflow/Style.kt | 9 +- Skyflow/src/main/kotlin/Skyflow/Styles.kt | 17 +- .../src/main/kotlin/Skyflow/TokenProvider.kt | 8 +- .../main/kotlin/Skyflow/utils/EventName.kt | 3 + build.gradle | 1 + 28 files changed, 452 insertions(+), 55 deletions(-) create mode 100644 Skyflow/src/main/kotlin/Skyflow/GenMarkdown.kt diff --git a/Skyflow/build.gradle b/Skyflow/build.gradle index 61138282..024f1136 100644 --- a/Skyflow/build.gradle +++ b/Skyflow/build.gradle @@ -4,6 +4,7 @@ plugins { id 'maven-publish' } apply plugin: 'kotlin-android' +apply plugin: 'kotlinx-serialization' //group='com.github.skyflowapi' //version = rootProject.ext.versionName ext { @@ -145,7 +146,7 @@ dependencies { androidTestImplementation "org.robolectric:robolectric:4.6.1" implementation "org.jetbrains.kotlin:kotlin-reflect:1.6.21" implementation 'com.fasterxml.jackson.module:jackson-module-kotlin:2.13.3' - + implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1") } publish.dependsOn assemble diff --git a/Skyflow/src/main/kotlin/Skyflow/Callback.kt b/Skyflow/src/main/kotlin/Skyflow/Callback.kt index 64243cc3..cdac1a37 100644 --- a/Skyflow/src/main/kotlin/Skyflow/Callback.kt +++ b/Skyflow/src/main/kotlin/Skyflow/Callback.kt @@ -1,9 +1,17 @@ package Skyflow - +@Description("This is the description for Callback interface") interface Callback { - fun onSuccess(responseBody: Any) + @Description("This is the description for onSuccess function") + fun onSuccess( + @Description("Description for responseBody param") + responseBody: Any + ) - fun onFailure(exception: Any) + @Description("This is the description for onFailure function") + fun onFailure( + @Description("Description for exception param") + exception: Any + ) } \ No newline at end of file diff --git a/Skyflow/src/main/kotlin/Skyflow/Client.kt b/Skyflow/src/main/kotlin/Skyflow/Client.kt index e9b47dff..c1cec035 100644 --- a/Skyflow/src/main/kotlin/Skyflow/Client.kt +++ b/Skyflow/src/main/kotlin/Skyflow/Client.kt @@ -14,8 +14,9 @@ import javax.xml.parsers.DocumentBuilderFactory import kotlin.Exception import kotlin.reflect.KClass -@Description("This is Client class") +@Description("This is the description for Client class") class Client internal constructor( + @Description("Description for configuration param") val configuration: Configuration, ){ internal val tag = Client::class.qualifiedName @@ -24,7 +25,16 @@ class Client internal constructor( configuration.tokenProvider,configuration.options.logLevel) internal val elementMap = HashMap() - fun insert(records: JSONObject, options: InsertOptions? = InsertOptions(), callback: Callback){ + + @Description("This is the description for insert function") + fun insert( + @Description("Description for records param") + records: JSONObject, + @Description("Description for options param") + options: InsertOptions? = InsertOptions(), + @Description("Description for callback param") + callback: Callback + ){ try { Utils.checkVaultDetails(configuration) Logger.info(tag, Messages.INSERTING_RECORDS.getMessage(configuration.vaultID), configuration.options.logLevel) @@ -35,7 +45,14 @@ class Client internal constructor( callback.onFailure(e) } } - fun detokenize(records: JSONObject, callback: Callback) { + + @Description("This is the description for detokenize function") + fun detokenize( + @Description("Description for records param") + records: JSONObject, + @Description("Description for callback param") + callback: Callback + ) { try { Utils.checkVaultDetails(configuration) this.apiClient.get(records,loggingCallback(callback, Messages.DETOKENIZE_SUCCESS.getMessage())) @@ -46,13 +63,13 @@ class Client internal constructor( } } - @Description("This is getById function") + @Description("This is description for getById function") fun getById( - @Description("This is getById records param") + @Description("Description for records param") records: JSONObject, - @Description("This is getById callback param") - callback: Callback) - { + @Description("Description for callback param") + callback: Callback + ){ Logger.info(tag, Messages.GET_BY_ID_CALLED.getMessage(), configuration.options.logLevel) try { Utils.checkVaultDetails(configuration) @@ -179,8 +196,11 @@ class Client internal constructor( return result } - - fun container(type: KClass) : Container{ + @Description("This is the description for container function") + fun container( + @Description("Description for type param") + type: KClass + ) : Container{ if(type == ContainerType.COLLECT){ Logger.info(tag, Messages.COLLECT_CONTAINER_CREATED.getMessage(), configuration.options.logLevel) } diff --git a/Skyflow/src/main/kotlin/Skyflow/CollectContainer.kt b/Skyflow/src/main/kotlin/Skyflow/CollectContainer.kt index 14457f68..65209bd1 100644 --- a/Skyflow/src/main/kotlin/Skyflow/CollectContainer.kt +++ b/Skyflow/src/main/kotlin/Skyflow/CollectContainer.kt @@ -10,7 +10,7 @@ import com.Skyflow.core.container.ContainerProtocol import org.json.JSONObject import java.util.* - +@Description("This is the description for CollectContainer class") open class CollectContainer : ContainerProtocol { } @@ -18,7 +18,15 @@ open class CollectContainer : ContainerProtocol { private val tag = CollectContainer::class.qualifiedName -fun Container.create(context: Context, input : CollectElementInput, options : CollectElementOptions = CollectElementOptions()) : TextField +@Description("This is the description for create function") +fun Container.create( + @Description("Description for context param") + context: Context, + @Description("Description for input param") + input : CollectElementInput, + @Description("Description for options param") + options : CollectElementOptions = CollectElementOptions() +) : TextField { Logger.info(tag, Messages.CREATED_COLLECT_ELEMENT.getMessage(input.label), configuration.options.logLevel) val collectElement = TextField(context, configuration.options) @@ -30,7 +38,13 @@ fun Container.create(context: Context, input : CollectElementI return collectElement } -fun Container.collect(callback: Callback, options: CollectOptions? = CollectOptions()){ +@Description("This is the description for collect function") +fun Container.collect( + @Description("Description for callback param") + callback: Callback, + @Description("Description for options param") + options: CollectOptions? = CollectOptions() +){ try { Utils.checkVaultDetails(client.configuration) Logger.info(tag, Messages.VALIDATE_COLLECT_RECORDS.getMessage(), configuration.options.logLevel) diff --git a/Skyflow/src/main/kotlin/Skyflow/CollectElementInput.kt b/Skyflow/src/main/kotlin/Skyflow/CollectElementInput.kt index 79fd79f7..58e548eb 100644 --- a/Skyflow/src/main/kotlin/Skyflow/CollectElementInput.kt +++ b/Skyflow/src/main/kotlin/Skyflow/CollectElementInput.kt @@ -2,11 +2,28 @@ package Skyflow import com.Skyflow.collect.elements.validations.ValidationSet -class CollectElementInput(internal var table: String? = null, internal var column: String? = null, internal var type: SkyflowElementType, - internal var inputStyles: Styles = Styles(), internal var labelStyles:Styles=Styles(), internal var errorTextStyles:Styles=Styles(), - internal var label: String = "", - internal var placeholder: String = "", - @Deprecated("altText parameter is deprecated" , level = DeprecationLevel.WARNING) internal var altText: String = "", - internal var validations : ValidationSet = ValidationSet() +@Description("This is the description for CollectElementInput class") +class CollectElementInput( + @Description("Description for table param") + internal var table: String? = null, + @Description("Description for column param") + internal var column: String? = null, + @Description("Description for type param") + internal var type: SkyflowElementType, + @Description("Description for inputStyles param") + internal var inputStyles: Styles = Styles(), + @Description("Description for labelStyles param") + internal var labelStyles:Styles=Styles(), + @Description("Description for errorTextStyles param") + internal var errorTextStyles:Styles=Styles(), + @Description("Description for label param") + internal var label: String = "", + @Description("Description for placeholder param") + internal var placeholder: String = "", + @Description("Description for altText param") + @Deprecated("altText parameter is deprecated" , level = DeprecationLevel.WARNING) + internal var altText: String = "", + @Description("Description for validations param") + internal var validations : ValidationSet = ValidationSet() ) { } \ No newline at end of file diff --git a/Skyflow/src/main/kotlin/Skyflow/CollectElementOptions.kt b/Skyflow/src/main/kotlin/Skyflow/CollectElementOptions.kt index 9e4253f9..6cd50d1f 100644 --- a/Skyflow/src/main/kotlin/Skyflow/CollectElementOptions.kt +++ b/Skyflow/src/main/kotlin/Skyflow/CollectElementOptions.kt @@ -1,8 +1,12 @@ package Skyflow +@Description("This is the description for CollectElementOptions class") class CollectElementOptions( + @Description("Description for required param") var required:Boolean = false, + @Description("Description for enableCardIcon param") var enableCardIcon : Boolean = true, + @Description("Description for format param") var format: String = "" ) { } \ No newline at end of file diff --git a/Skyflow/src/main/kotlin/Skyflow/CollectOptions.kt b/Skyflow/src/main/kotlin/Skyflow/CollectOptions.kt index a07417cf..5f7d90e9 100644 --- a/Skyflow/src/main/kotlin/Skyflow/CollectOptions.kt +++ b/Skyflow/src/main/kotlin/Skyflow/CollectOptions.kt @@ -3,5 +3,13 @@ package Skyflow import org.json.JSONArray import org.json.JSONObject -class CollectOptions(val token:Boolean = true, val additionalFields: JSONObject? = null, val upsert : JSONArray? = null) { +@Description("This is the description for CollectOptions class") +class CollectOptions( + @Description("Description for token param") + val token:Boolean = true, + @Description("Description for additionalFields param") + val additionalFields: JSONObject? = null, + @Description("Description for upsert param") + val upsert : JSONArray? = null +) { } \ No newline at end of file diff --git a/Skyflow/src/main/kotlin/Skyflow/Configuration.kt b/Skyflow/src/main/kotlin/Skyflow/Configuration.kt index 9fb525ac..073512ec 100644 --- a/Skyflow/src/main/kotlin/Skyflow/Configuration.kt +++ b/Skyflow/src/main/kotlin/Skyflow/Configuration.kt @@ -1,11 +1,15 @@ package Skyflow - +@Description("This is the description for Configuration class") class Configuration( + @Description("Description for vaultID param") val vaultID: String = "", + @Description("Description for vaultURL param") var vaultURL: String = "", + @Description("Description for tokenProvider param") val tokenProvider: TokenProvider, + @Description("Description for options param") val options: Options = Options(), ){ init { diff --git a/Skyflow/src/main/kotlin/Skyflow/ContainerType.kt b/Skyflow/src/main/kotlin/Skyflow/ContainerType.kt index 3bebb81f..f89718a6 100644 --- a/Skyflow/src/main/kotlin/Skyflow/ContainerType.kt +++ b/Skyflow/src/main/kotlin/Skyflow/ContainerType.kt @@ -1,5 +1,6 @@ package Skyflow +@Description("This is the description for ContainerType class") class ContainerType { companion object{ val COLLECT = CollectContainer::class; diff --git a/Skyflow/src/main/kotlin/Skyflow/ElementType.kt b/Skyflow/src/main/kotlin/Skyflow/ElementType.kt index 5625038f..5d4410f4 100644 --- a/Skyflow/src/main/kotlin/Skyflow/ElementType.kt +++ b/Skyflow/src/main/kotlin/Skyflow/ElementType.kt @@ -15,6 +15,7 @@ class Type(var formatPattern:String, var regex: String, } +@Description("This is the description for SkyflowElementType enum class") enum class SkyflowElementType { diff --git a/Skyflow/src/main/kotlin/Skyflow/Env.kt b/Skyflow/src/main/kotlin/Skyflow/Env.kt index 787aec4e..ab3c52a8 100644 --- a/Skyflow/src/main/kotlin/Skyflow/Env.kt +++ b/Skyflow/src/main/kotlin/Skyflow/Env.kt @@ -1,5 +1,6 @@ package Skyflow +@Description("This is the description for Env enum class") enum class Env { DEV, PROD diff --git a/Skyflow/src/main/kotlin/Skyflow/GenJson.kt b/Skyflow/src/main/kotlin/Skyflow/GenJson.kt index 8d811cef..4446589e 100644 --- a/Skyflow/src/main/kotlin/Skyflow/GenJson.kt +++ b/Skyflow/src/main/kotlin/Skyflow/GenJson.kt @@ -1,10 +1,10 @@ package com.Skyflow -import Skyflow.CollectContainer import Skyflow.Description import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper import kotlin.reflect.KParameter import com.fasterxml.jackson.databind.SerializationFeature +import kotlinx.serialization.Serializable import java.io.File import kotlin.reflect.* //import java.lang.reflect.Modifier @@ -12,9 +12,13 @@ import kotlin.reflect.KVisibility import kotlin.reflect.full.* import kotlin.reflect.jvm.* +@Serializable data class Arg(val name: String, val type: String, val description: String?) +@Serializable data class Method(val name: String, val args: List, val description: String?, val returnType: String) +@Serializable data class CompanionObject(val properties:List, val methods: List) +@Serializable data class ClassInfo( val name: String, val type: String, @@ -54,6 +58,12 @@ class Student(val name: String, val age: Int) { } class GenJson {} +fun getReturnType(returnType: String): String { + if(returnType == "void") { + return "Unit" + } + else return returnType +} fun getMethodDetails(method: KFunction<*>): Method { return if (method.parameters.isNotEmpty()) { Method( @@ -61,21 +71,32 @@ fun getMethodDetails(method: KFunction<*>): Method { method.parameters .filterNot { it.kind == KParameter.Kind.INSTANCE } .map { + val type = it.type + + val typeName = if (type.classifier == null) { + "null" + } else if (type.arguments.isNotEmpty() && type.classifier is KClass<*>) { + val containerTypeName = (type.classifier as KClass<*>).simpleName + var typeArgs = type.arguments.map { arg -> arg.type?.classifier }.joinToString(", ") + "$containerTypeName<$typeArgs>" + } else { + (type.classifier as KClass<*>).simpleName ?: "null" + } Arg( it.name.toString(), - it.type.toString(), + typeName, it.findAnnotation()?.text ?: "" ) }, method.findAnnotation()?.text ?: "", - method.returnType.toString() + getReturnType(method.javaMethod?.returnType?.simpleName.toString()) ) } else { Method( method.name, emptyList(), method.findAnnotation()?.text ?: "", - method.returnType.toString() + getReturnType(method.javaMethod?.returnType?.simpleName.toString()) ) } } @@ -83,9 +104,21 @@ fun getMethodDetails(method: KFunction<*>): Method { fun getCompanionObjectDetails(module: KClass): CompanionObject { // get properties and methods defined inside companion object val properties = module.companionObject?.declaredMemberProperties - ?.map { Arg( + ?.map { + val type = it.returnType + + val typeName = if (type.classifier == null) { + "null" + } else if (type.arguments.isNotEmpty() && type.classifier is KClass<*>) { + val containerTypeName = (type.classifier as KClass<*>).simpleName + var typeArgs = type.arguments.map { arg -> (arg.type?.classifier as KClass<*>).simpleName }.joinToString(", ") + "$containerTypeName<$typeArgs>" + } else { + (type.classifier as KClass<*>).simpleName ?: "null" + } + Arg( it.name, - it.returnType.toString(), + typeName, it.findAnnotation()?.text ?: "" )}!! val methods = module.companionObject?.declaredFunctions @@ -153,17 +186,32 @@ fun main() { args = when (module.java.isInterface) { true -> emptyList() false -> module.constructors?.first() - ?.parameters?.map { + ?.parameters.map { + val type = it.type + + val typeName = if (type.classifier == null) { + "null" + } else if (type.arguments.isNotEmpty() && type.classifier is KClass<*>) { + val containerTypeName = (type.classifier as KClass<*>).simpleName + var typeArgs = type.arguments.map { arg -> (arg.type?.classifier as KClass<*>).simpleName }.joinToString(", ") +// if(module.simpleName == "ContainerType") println("$containerTypeName<$typeArgs>") + "$containerTypeName<$typeArgs>" + } else { + (type.classifier as KClass<*>).simpleName ?: "null" + } +// if(module.simpleName == "CollectElementInput") { +// println(it.name + " " + it.annotations.toString() + " " + it.hasAnnotation()) +// } Arg( it.name!!, - it.type.toString(), - it.findAnnotation()?.text ?: "" + typeName, + it.findAnnotation()?.message ?: it.findAnnotation()?.text ?: "" ) } } methods = module.declaredFunctions - .filterNot { method -> method.hasAnnotation() } +// .filterNot { method -> method.hasAnnotation() } .filterNot { method -> method.visibility == KVisibility.INTERNAL } .map { method -> getMethodDetails(method) } @@ -202,21 +250,32 @@ fun main() { .filterNot { it.name.toString() == "null" } .filterNot { it.kind == KParameter.Kind.INSTANCE } .map { + val type = it.type + + val typeName = if (type.classifier == null) { + "null" + } else if (type.arguments.isNotEmpty() && type.classifier is KClass<*>) { + val containerTypeName = (type.classifier as KClass<*>).simpleName + var typeArgs = type.arguments.map { arg -> arg.type?.classifier }.joinToString(", ") + "$containerTypeName<$typeArgs>" + } else { + (type.classifier as KClass<*>).simpleName ?: "null" + } Arg( it.name.toString(), - it.type.toString(), + typeName, it.findAnnotation()?.text ?: "" ) }, method.kotlinFunction?.findAnnotation()?.text ?: "", - method.returnType.simpleName.toString() + getReturnType(method.returnType.simpleName.toString()) ) } else { Method( method.name, emptyList(), method.kotlinFunction?.findAnnotation()?.text ?: "", - method.returnType.simpleName.toString() + getReturnType(method.returnType.simpleName.toString()) ) } } diff --git a/Skyflow/src/main/kotlin/Skyflow/GenMarkdown.kt b/Skyflow/src/main/kotlin/Skyflow/GenMarkdown.kt new file mode 100644 index 00000000..7dc29561 --- /dev/null +++ b/Skyflow/src/main/kotlin/Skyflow/GenMarkdown.kt @@ -0,0 +1,194 @@ +package Skyflow + +import com.Skyflow.* +import kotlinx.serialization.* +import kotlinx.serialization.json.* +import java.io.File + +fun generateArgList(args: List): StringBuilder { + val sb = StringBuilder() + for ((i, arg) in args.withIndex()) { + sb.append("\n ${arg.name}: ${arg.type}") + if (i != args.lastIndex) { + sb.append(",") + } + } + sb.append("\n ") + return sb +} + +fun generateTableForArgs(args: List): StringBuilder { + val sb = StringBuilder() + for ((i, arg) in args.withIndex()) { + sb.append("| ${arg.name} | ${arg.type} | ${arg.description} |\n") + } + return sb +} + +fun extractItemName(line: String): String { + val start = line.indexOf("[") + 1 + val end = line.indexOf("]") + return line.substring(start, end) +} + +fun sortValues(sb: StringBuilder): StringBuilder { + // Store lines in a list + val lines = sb.toString().split("\n").filter { it.isNotEmpty() } + + // Sort the lines based on item.name + val sortedLines = lines.sortedBy { extractItemName(it) } + + // Clear the StringBuilder + sb.setLength(0) + + // Append the sorted lines back to the StringBuilder + sortedLines.forEach { sb.append("$it\n") } + + // Print the sorted StringBuilder + return sb +} + +fun main() { + val jsonString = File("docs/json/output.json").readText() + val list = Json.decodeFromString>(jsonString) +// println(list) + +// .filter { item -> item.companionObject != null } + val overviewSb = StringBuilder() + val classSb = StringBuilder() + val staticMethodSb = StringBuilder().append("## Static Method\n\n") + val interfaceSb = StringBuilder() + val enumSb = StringBuilder() + list.forEach { item -> + val sb = StringBuilder() + var itemType = "" + sb.append("{% env enable=\"androidSdkRef\" %}\n\n") + sb.append("# Skyflow.${item.name}") + + if(item.type == "class" || item.type == "enum") { + itemType = "classes" + sb.append("\n\n## Class ${item.name}\n") + if(item.description?.isNotEmpty() == true) { + sb.append("${item.description}\n") + } + sb.append("\n```kotlin\n") + if(item.type == "enum") { + sb.append("enum ") + itemType = "enums" + } + sb.append("class ${item.name}") + if(item.args.isNotEmpty()) { + sb.append("(${generateArgList(item.args)})") + } + sb.append(" {") + + // Constructor +// if (item.args.isNotEmpty()) { +// sb.append("\n### Constructor\n\n") +// sb.append("```kotlin\n") +// sb.append(" constructor(") +// for ((i, arg) in item.args.withIndex()) { +// sb.append("${arg.name}: ${arg.type}") +// if (i != item.args.lastIndex) { +// sb.append(", ") +// } +// } +// sb.append(")\n") +// sb.append("```\n\n") +// } + if (item.companionObject != null) { + sb.append("\n\n### Companion object\n\n") + sb.append(" companion object {\n") + for (property in item.companionObject.properties) { + sb.append(" ${property.name}: ${property.type}\n") + } + sb.append(" }\n") + } + sb.append("}\n```") + + if(item.enumValues.isNotEmpty()) { + sb.append("\n\n### Enum Values\n\n") + sb.append("| Value |\n| --- |\n") + item.enumValues?.forEach { + sb.append("| ${it} |\n") + } +// sb.append("\n") + } + + if(item.args.isNotEmpty()) { + sb.append("\n\n### Parameters\n\n") + sb.append("| Name | Type | Description |\n| --- | --- | --- |\n") + sb.append("${generateTableForArgs(item.args)}") + } + } + else if (item.type == "interface") { + itemType = "interfaces" + sb.append("\n\n## Interface ${item.name}\n") + if(item.description?.isNotEmpty() == true) { + sb.append("${item.description}\n") + } + sb.append("\n```kotlin\n") + sb.append("interface ${item.name}") + + sb.append(" {}\n```") + + } + if(item.methods.isNotEmpty()) { + sb.append("\n\n## Functions\n") + for (method in item.methods) { + sb.append("\n### ${method.name}\n") + if(method.description?.isNotEmpty() == true) { + sb.append("${method.description}\n") + } + sb.append("\n```kotlin\n") + sb.append("fun ${method.name}(${generateArgList(method.args)}) : ${method.returnType} {}") + sb.append("\n```") + if(method.args.isNotEmpty()) { + sb.append("\n\n#### Parameters\n\n") + sb.append("| Name | Type | Description |\n| --- | --- | --- |\n") + sb.append("${generateTableForArgs(method.args)}") + } + } + } + sb.append("\n{% /env %}") + when (itemType) { + "classes" -> { + classSb.append("- [${item.name}](/sdks/skyflow-android/${itemType}/${item.name})\n") + } + "interfaces" -> { + interfaceSb.append("- [${item.name}](/sdks/skyflow-android/${itemType}/${item.name})\n") + } + "enums" -> { + enumSb.append("- [${item.name}](/sdks/skyflow-android/${itemType}/${item.name})\n") + } + "" -> { + staticMethodSb.append("[${item.name}](/sdks/skyflow-android/${item.name})\n") + } + } + val filename = "${item.name}.md" // replace with desired filename + var path = "docs/markdown/" // replace with desired path + if(itemType != "") + { + path = "docs/markdown/${itemType}/" + } + val directory = File(path) + if (!directory.exists()) { + directory.mkdirs() + } + val file = File("$path$filename") + file.writeText(sb.toString()) + } + overviewSb.append("{% env enable=\"androidSdkRef\" %}\n\n") + overviewSb.append("# Android\n\n") + overviewSb.append("Some documentation for overview page\n\n") + overviewSb.append("${staticMethodSb}\n") + overviewSb.append("## Classes\n\n") + overviewSb.append("${sortValues(classSb)}\n") + overviewSb.append("## Interfaces\n\n") + overviewSb.append("${sortValues(interfaceSb)}\n") + overviewSb.append("## Enums\n\n") + overviewSb.append("${sortValues(enumSb)}\n") + overviewSb.append("{% /env %}") + val overviewFile = File("docs/markdown/Overview.md") + overviewFile.writeText(overviewSb.toString()) +} \ No newline at end of file diff --git a/Skyflow/src/main/kotlin/Skyflow/Init.kt b/Skyflow/src/main/kotlin/Skyflow/Init.kt index 04ed7b37..8cd4606f 100644 --- a/Skyflow/src/main/kotlin/Skyflow/Init.kt +++ b/Skyflow/src/main/kotlin/Skyflow/Init.kt @@ -4,8 +4,11 @@ import Skyflow.core.Logger import Skyflow.core.Messages import Skyflow.core.getMessage - -fun init(configuration: Configuration) : Client{ +@Description("This is the description for init function") +fun init( + @Description("Description for configuration param") + configuration: Configuration +) : Client{ val tag = Client::class.qualifiedName Logger.info(tag, Messages.CLIENT_INITIALIZED.getMessage(), configuration.options.logLevel) return Client(configuration) diff --git a/Skyflow/src/main/kotlin/Skyflow/InsertOptions.kt b/Skyflow/src/main/kotlin/Skyflow/InsertOptions.kt index 328af6af..7c43768f 100644 --- a/Skyflow/src/main/kotlin/Skyflow/InsertOptions.kt +++ b/Skyflow/src/main/kotlin/Skyflow/InsertOptions.kt @@ -2,7 +2,10 @@ package Skyflow import org.json.JSONArray +@Description("This is the description for InsertOptions class") class InsertOptions( + @Description("Description for tokens param") val tokens : Boolean = true, + @Description("Description for upsert param") val upsert : JSONArray? = null ){} \ No newline at end of file diff --git a/Skyflow/src/main/kotlin/Skyflow/LogLevel.kt b/Skyflow/src/main/kotlin/Skyflow/LogLevel.kt index c39c93f5..7165b718 100644 --- a/Skyflow/src/main/kotlin/Skyflow/LogLevel.kt +++ b/Skyflow/src/main/kotlin/Skyflow/LogLevel.kt @@ -1,5 +1,6 @@ package Skyflow +@Description("This is the description for LogLevel enum class") enum class LogLevel { DEBUG, INFO, diff --git a/Skyflow/src/main/kotlin/Skyflow/Options.kt b/Skyflow/src/main/kotlin/Skyflow/Options.kt index dfaab5ee..b8c21f84 100644 --- a/Skyflow/src/main/kotlin/Skyflow/Options.kt +++ b/Skyflow/src/main/kotlin/Skyflow/Options.kt @@ -1,4 +1,10 @@ package Skyflow -class Options(val logLevel: LogLevel = LogLevel.ERROR, val env: Env = Env.PROD) { +@Description("This is the description for Options class") +class Options( + @Description("Description for logLevel param") + val logLevel: LogLevel = LogLevel.ERROR, + @Description("Description for env param") + val env: Env = Env.PROD +) { } \ No newline at end of file diff --git a/Skyflow/src/main/kotlin/Skyflow/Padding.kt b/Skyflow/src/main/kotlin/Skyflow/Padding.kt index d1c2582d..d1ed3f2e 100644 --- a/Skyflow/src/main/kotlin/Skyflow/Padding.kt +++ b/Skyflow/src/main/kotlin/Skyflow/Padding.kt @@ -1,3 +1,13 @@ package Skyflow -public class Padding(val left:Int=10,val top:Int=10,val right:Int=10,val bottom:Int=10) {} \ No newline at end of file +@Description("This is the description for Padding class") +public class Padding( + @Description("Description for left param") + val left:Int=10, + @Description("Description for top param") + val top:Int=10, + @Description("Description for right param") + val right:Int=10, + @Description("Description for bottom param") + val bottom:Int=10 +) {} \ No newline at end of file diff --git a/Skyflow/src/main/kotlin/Skyflow/RedactionType.kt b/Skyflow/src/main/kotlin/Skyflow/RedactionType.kt index 702cf0be..631d000f 100644 --- a/Skyflow/src/main/kotlin/Skyflow/RedactionType.kt +++ b/Skyflow/src/main/kotlin/Skyflow/RedactionType.kt @@ -1,5 +1,6 @@ package Skyflow +@Description("This is the description for RedactionType enum class") enum class RedactionType { DEFAULT, PLAIN_TEXT, diff --git a/Skyflow/src/main/kotlin/Skyflow/RevealContainer.kt b/Skyflow/src/main/kotlin/Skyflow/RevealContainer.kt index ceb34ee5..03a3c055 100644 --- a/Skyflow/src/main/kotlin/Skyflow/RevealContainer.kt +++ b/Skyflow/src/main/kotlin/Skyflow/RevealContainer.kt @@ -12,18 +12,20 @@ import Skyflow.utils.Utils.Companion.checkIfElementsMounted import java.lang.Exception import java.util.* -@Description("This is Reveal Container class") +@Description("This is the description for Reveal Container class") class RevealContainer : ContainerProtocol { private val tag = RevealContainer::class.qualifiedName } private val tag = RevealContainer::class.qualifiedName -@Deprecated("This is Deprecated") +@Description("This is description for create function") fun Container.create( - @Description("This is create Container params") + @Description("Description for context param") context: Context, + @Description("Description for input param") input: RevealElementInput, + @Description("Description for options param") options: RevealElementOptions = RevealElementOptions() ): Label { Logger.info( @@ -43,9 +45,11 @@ fun Container.create( return revealElement } -@Description("This is Reveal Container") +@Description("This is description for reveal function") fun Container.reveal( + @Description("Description for callback param") callback: Callback, + @Description("Description for options param") options: RevealOptions? = RevealOptions() ) { try { diff --git a/Skyflow/src/main/kotlin/Skyflow/RevealElementInput.kt b/Skyflow/src/main/kotlin/Skyflow/RevealElementInput.kt index 1e132a16..daf05f1f 100644 --- a/Skyflow/src/main/kotlin/Skyflow/RevealElementInput.kt +++ b/Skyflow/src/main/kotlin/Skyflow/RevealElementInput.kt @@ -1,11 +1,19 @@ package Skyflow +@Description("This is the description for RevealElementInput class") class RevealElementInput( + @Description("Description for token param") internal var token: String? = null, + @Description("Description for redaction param") internal var redaction: RedactionType? = RedactionType.PLAIN_TEXT, + @Description("Description for inputStyles param") internal var inputStyles: Styles = Styles(), + @Description("Description for labelStyles param") internal var labelStyles: Styles = Styles(), + @Description("Description for errorTextStyles param") internal var errorTextStyles: Styles = Styles(), + @Description("Description for label param") internal var label: String = "", + @Description("Description for altText param") internal var altText: String = "" ) {} \ No newline at end of file diff --git a/Skyflow/src/main/kotlin/Skyflow/RevealElementOptions.kt b/Skyflow/src/main/kotlin/Skyflow/RevealElementOptions.kt index 835d525c..33c5da50 100644 --- a/Skyflow/src/main/kotlin/Skyflow/RevealElementOptions.kt +++ b/Skyflow/src/main/kotlin/Skyflow/RevealElementOptions.kt @@ -1,3 +1,9 @@ package Skyflow -class RevealElementOptions(var formatRegex : String = "",var replaceText:String? = null) {} \ No newline at end of file +@Description("This is the description for RevealElementOptions class") +class RevealElementOptions( + @Description("Description for formatRegex param") + var formatRegex : String = "", + @Description("Description for replaceText param") + var replaceText:String? = null +) {} \ No newline at end of file diff --git a/Skyflow/src/main/kotlin/Skyflow/RevealOptions.kt b/Skyflow/src/main/kotlin/Skyflow/RevealOptions.kt index 9ae3cdbc..97b245f0 100644 --- a/Skyflow/src/main/kotlin/Skyflow/RevealOptions.kt +++ b/Skyflow/src/main/kotlin/Skyflow/RevealOptions.kt @@ -1,4 +1,5 @@ package Skyflow +@Description("This is the description for RevealOptions class") class RevealOptions { } \ No newline at end of file diff --git a/Skyflow/src/main/kotlin/Skyflow/Style.kt b/Skyflow/src/main/kotlin/Skyflow/Style.kt index 774a1bee..9aac621d 100644 --- a/Skyflow/src/main/kotlin/Skyflow/Style.kt +++ b/Skyflow/src/main/kotlin/Skyflow/Style.kt @@ -4,14 +4,21 @@ import android.graphics.Color import android.graphics.Typeface import android.view.Gravity - +@Description("This is the description for Style class") class Style( + @Description("Description for borderColor param") borderColor: Int? = Color.BLACK, + @Description("Description for cornerRadius param") cornerRadius: Float? = 20f, + @Description("Description for padding param") padding: Padding? = Padding(10,10,10,10), + @Description("Description for borderWidth param") borderWidth: Int? = 2, + @Description("Description for font param") font: Int? = Typeface.NORMAL, + @Description("Description for textAlignment param") textAlignment: Int? = Gravity.LEFT, + @Description("Description for textColor param") textColor: Int? = Color.BLACK) { var borderColor = borderColor ?: Color.BLACK diff --git a/Skyflow/src/main/kotlin/Skyflow/Styles.kt b/Skyflow/src/main/kotlin/Skyflow/Styles.kt index 4ae58cc1..bf5df402 100644 --- a/Skyflow/src/main/kotlin/Skyflow/Styles.kt +++ b/Skyflow/src/main/kotlin/Skyflow/Styles.kt @@ -1,10 +1,17 @@ package Skyflow -public class Styles( base: Style? = Style(), - complete: Style? = Style(), - empty: Style? = Style(), - focus: Style? = Style(), - invalid: Style? = Style() +@Description("This is the description for Styles class") +public class Styles( + @Description("Description for base param") + base: Style? = Style(), + @Description("Description for complete param") + complete: Style? = Style(), + @Description("Description for empty param") + empty: Style? = Style(), + @Description("Description for focus param") + focus: Style? = Style(), + @Description("Description for invalid param") + invalid: Style? = Style() ) { var base = base ?: Style() var complete = complete ?: Style() diff --git a/Skyflow/src/main/kotlin/Skyflow/TokenProvider.kt b/Skyflow/src/main/kotlin/Skyflow/TokenProvider.kt index 769142f7..07506562 100644 --- a/Skyflow/src/main/kotlin/Skyflow/TokenProvider.kt +++ b/Skyflow/src/main/kotlin/Skyflow/TokenProvider.kt @@ -1,6 +1,10 @@ package Skyflow - +@Description("This is the description for TokenProvider interface") interface TokenProvider { - fun getBearerToken(callback: Callback) + @Description("This is description for getBearerToken function") + fun getBearerToken( + @Description("Description for callback param") + callback: Callback + ) } \ No newline at end of file diff --git a/Skyflow/src/main/kotlin/Skyflow/utils/EventName.kt b/Skyflow/src/main/kotlin/Skyflow/utils/EventName.kt index 99009e98..25ec377b 100644 --- a/Skyflow/src/main/kotlin/Skyflow/utils/EventName.kt +++ b/Skyflow/src/main/kotlin/Skyflow/utils/EventName.kt @@ -1,5 +1,8 @@ package Skyflow.utils +import Skyflow.Description + +@Description("This is the description for EventName enum class") enum class EventName { CHANGE, READY, diff --git a/build.gradle b/build.gradle index 47fd4027..edebf9eb 100644 --- a/build.gradle +++ b/build.gradle @@ -10,6 +10,7 @@ buildscript { classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.0' classpath "com.github.dcendents:android-maven-gradle-plugin:2.0" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } From 1c7c943d223e658a802d501055fcf4604fd3635b Mon Sep 17 00:00:00 2001 From: kamal-skyflow Date: Tue, 18 Jul 2023 18:55:46 +0530 Subject: [PATCH 4/7] DEX-289 feat: added description(comments) --- Skyflow/src/main/kotlin/Skyflow/Callback.kt | 10 +++---- Skyflow/src/main/kotlin/Skyflow/Client.kt | 28 +++++++++---------- .../main/kotlin/Skyflow/CollectContainer.kt | 16 +++++------ .../kotlin/Skyflow/CollectElementInput.kt | 22 +++++++-------- .../kotlin/Skyflow/CollectElementOptions.kt | 8 +++--- .../src/main/kotlin/Skyflow/CollectOptions.kt | 8 +++--- .../src/main/kotlin/Skyflow/Configuration.kt | 10 +++---- .../src/main/kotlin/Skyflow/ContainerType.kt | 2 +- .../src/main/kotlin/Skyflow/ElementType.kt | 2 +- Skyflow/src/main/kotlin/Skyflow/Env.kt | 2 +- Skyflow/src/main/kotlin/Skyflow/Init.kt | 4 +-- .../src/main/kotlin/Skyflow/InsertOptions.kt | 6 ++-- Skyflow/src/main/kotlin/Skyflow/LogLevel.kt | 2 +- Skyflow/src/main/kotlin/Skyflow/Options.kt | 6 ++-- Skyflow/src/main/kotlin/Skyflow/Padding.kt | 10 +++---- .../src/main/kotlin/Skyflow/RedactionType.kt | 2 +- .../main/kotlin/Skyflow/RevealContainer.kt | 14 +++++----- .../main/kotlin/Skyflow/RevealElementInput.kt | 16 +++++------ .../kotlin/Skyflow/RevealElementOptions.kt | 6 ++-- .../src/main/kotlin/Skyflow/RevealOptions.kt | 2 +- Skyflow/src/main/kotlin/Skyflow/Style.kt | 16 +++++------ Skyflow/src/main/kotlin/Skyflow/Styles.kt | 12 ++++---- .../src/main/kotlin/Skyflow/TokenProvider.kt | 6 ++-- .../main/kotlin/Skyflow/utils/EventName.kt | 2 +- 24 files changed, 106 insertions(+), 106 deletions(-) diff --git a/Skyflow/src/main/kotlin/Skyflow/Callback.kt b/Skyflow/src/main/kotlin/Skyflow/Callback.kt index cdac1a37..d70555c2 100644 --- a/Skyflow/src/main/kotlin/Skyflow/Callback.kt +++ b/Skyflow/src/main/kotlin/Skyflow/Callback.kt @@ -1,17 +1,17 @@ package Skyflow -@Description("This is the description for Callback interface") +@Description("This interface contains the results of the implementation of callback.") interface Callback { - @Description("This is the description for onSuccess function") + @Description("Implementation when callback results in success.") fun onSuccess( - @Description("Description for responseBody param") + @Description("The success response.") responseBody: Any ) - @Description("This is the description for onFailure function") + @Description("Implementation when callback results in failure.") fun onFailure( - @Description("Description for exception param") + @Description("The failure response.") exception: Any ) } \ No newline at end of file diff --git a/Skyflow/src/main/kotlin/Skyflow/Client.kt b/Skyflow/src/main/kotlin/Skyflow/Client.kt index c1cec035..6e52e594 100644 --- a/Skyflow/src/main/kotlin/Skyflow/Client.kt +++ b/Skyflow/src/main/kotlin/Skyflow/Client.kt @@ -14,9 +14,9 @@ import javax.xml.parsers.DocumentBuilderFactory import kotlin.Exception import kotlin.reflect.KClass -@Description("This is the description for Client class") +@Description("This class contains an instance of the Skyflow client.") class Client internal constructor( - @Description("Description for configuration param") + @Description("The skyflow client initialization includes configuration options.") val configuration: Configuration, ){ internal val tag = Client::class.qualifiedName @@ -26,13 +26,13 @@ class Client internal constructor( internal val elementMap = HashMap() - @Description("This is the description for insert function") + @Description("The function inserts data into the vault.") fun insert( - @Description("Description for records param") + @Description("Inserts records into the vault.") records: JSONObject, - @Description("Description for options param") + @Description("Additional options for insert method/request.") options: InsertOptions? = InsertOptions(), - @Description("Description for callback param") + @Description("Implementation of Skyflow.Callback.") callback: Callback ){ try { @@ -46,11 +46,11 @@ class Client internal constructor( } } - @Description("This is the description for detokenize function") + @Description("This function retrieves record the data using tokens.") fun detokenize( - @Description("Description for records param") + @Description("This parameter takes a JSON object that contains tokens for fetching record values.") records: JSONObject, - @Description("Description for callback param") + @Description("Implementation of Skyflow.Callback.") callback: Callback ) { try { @@ -63,11 +63,11 @@ class Client internal constructor( } } - @Description("This is description for getById function") + @Description("This function retrieves using SkyflowID's.") fun getById( - @Description("Description for records param") + @Description("This parameter takes a JSON object that contains records to fetch.") records: JSONObject, - @Description("Description for callback param") + @Description("Implementation of Skyflow.Callback.") callback: Callback ){ Logger.info(tag, Messages.GET_BY_ID_CALLED.getMessage(), configuration.options.logLevel) @@ -196,9 +196,9 @@ class Client internal constructor( return result } - @Description("This is the description for container function") + @Description("This method creates a skyflow container.") fun container( - @Description("Description for type param") + @Description("This parameter defines the type of the container.") type: KClass ) : Container{ if(type == ContainerType.COLLECT){ diff --git a/Skyflow/src/main/kotlin/Skyflow/CollectContainer.kt b/Skyflow/src/main/kotlin/Skyflow/CollectContainer.kt index 65209bd1..4e145a8f 100644 --- a/Skyflow/src/main/kotlin/Skyflow/CollectContainer.kt +++ b/Skyflow/src/main/kotlin/Skyflow/CollectContainer.kt @@ -10,7 +10,7 @@ import com.Skyflow.core.container.ContainerProtocol import org.json.JSONObject import java.util.* -@Description("This is the description for CollectContainer class") +@Description("This container will contain all collect elements.") open class CollectContainer : ContainerProtocol { } @@ -18,13 +18,13 @@ open class CollectContainer : ContainerProtocol { private val tag = CollectContainer::class.qualifiedName -@Description("This is the description for create function") +@Description("This creates a skyflow collect element.") fun Container.create( - @Description("Description for context param") + @Description("This parameter takes an Android Context object.") context: Context, - @Description("Description for input param") + @Description("This parameter takes a Skyflow.CollectElementInput object.") input : CollectElementInput, - @Description("Description for options param") + @Description("This parameter takes a Skyflow.CollectElementOptions object.") options : CollectElementOptions = CollectElementOptions() ) : TextField { @@ -38,11 +38,11 @@ fun Container.create( return collectElement } -@Description("This is the description for collect function") +@Description("This function collects data and saves it to a vault.") fun Container.collect( - @Description("Description for callback param") + @Description("Implementation of Skyflow.Callback.") callback: Callback, - @Description("Description for options param") + @Description("The collect method offers additional options.") options: CollectOptions? = CollectOptions() ){ try { diff --git a/Skyflow/src/main/kotlin/Skyflow/CollectElementInput.kt b/Skyflow/src/main/kotlin/Skyflow/CollectElementInput.kt index 58e548eb..b2c4222b 100644 --- a/Skyflow/src/main/kotlin/Skyflow/CollectElementInput.kt +++ b/Skyflow/src/main/kotlin/Skyflow/CollectElementInput.kt @@ -2,28 +2,28 @@ package Skyflow import com.Skyflow.collect.elements.validations.ValidationSet -@Description("This is the description for CollectElementInput class") +@Description("This class contains the parameters that are required for the collect element.") class CollectElementInput( - @Description("Description for table param") + @Description("The data belongs to this table.") internal var table: String? = null, - @Description("Description for column param") + @Description("The data should be inserted into the column.") internal var column: String? = null, - @Description("Description for type param") + @Description("Skyflow.ElementType enum.") internal var type: SkyflowElementType, - @Description("Description for inputStyles param") + @Description("The styles that are applied to the form element.") internal var inputStyles: Styles = Styles(), - @Description("Description for labelStyles param") + @Description("the styles that are applied to the label of the collect element.") internal var labelStyles:Styles=Styles(), - @Description("Description for errorTextStyles param") + @Description("The styles that are applied to the errorText of the collect element.") internal var errorTextStyles:Styles=Styles(), - @Description("Description for label param") + @Description("The Label of the form element.") internal var label: String = "", - @Description("Description for placeholder param") + @Description("The placeholder for the form element.") internal var placeholder: String = "", - @Description("Description for altText param") + @Description("the string that acts as an initial value to the collect element.") @Deprecated("altText parameter is deprecated" , level = DeprecationLevel.WARNING) internal var altText: String = "", - @Description("Description for validations param") + @Description("A set of validations to the collect element.") internal var validations : ValidationSet = ValidationSet() ) { } \ No newline at end of file diff --git a/Skyflow/src/main/kotlin/Skyflow/CollectElementOptions.kt b/Skyflow/src/main/kotlin/Skyflow/CollectElementOptions.kt index 6cd50d1f..9d65b369 100644 --- a/Skyflow/src/main/kotlin/Skyflow/CollectElementOptions.kt +++ b/Skyflow/src/main/kotlin/Skyflow/CollectElementOptions.kt @@ -1,12 +1,12 @@ package Skyflow -@Description("This is the description for CollectElementOptions class") +@Description("This class contains the additional options for skyflow collect element.") class CollectElementOptions( - @Description("Description for required param") + @Description("Indicates whether the field is marked as required. Defaults to 'false'.") var required:Boolean = false, - @Description("Description for enableCardIcon param") + @Description("Indicates whether card icon should be enabled (only for CARD_NUMBER inputs).") var enableCardIcon : Boolean = true, - @Description("Description for format param") + @Description("The format for the element.") var format: String = "" ) { } \ No newline at end of file diff --git a/Skyflow/src/main/kotlin/Skyflow/CollectOptions.kt b/Skyflow/src/main/kotlin/Skyflow/CollectOptions.kt index 5f7d90e9..8ee87a6f 100644 --- a/Skyflow/src/main/kotlin/Skyflow/CollectOptions.kt +++ b/Skyflow/src/main/kotlin/Skyflow/CollectOptions.kt @@ -3,13 +3,13 @@ package Skyflow import org.json.JSONArray import org.json.JSONObject -@Description("This is the description for CollectOptions class") +@Description("This class contains the additional parameters for the collect method.") class CollectOptions( - @Description("Description for token param") + @Description("Indicates whether tokens for the collected data should be returned or not. Defaults to 'true'.") val token:Boolean = true, - @Description("Description for additionalFields param") + @Description("Insert the non-PCI elements data into the vault in the format of the records object.") val additionalFields: JSONObject? = null, - @Description("Description for upsert param") + @Description("This parameter takes a JSONArray, if provided, upsert operation will be performed instead of insert.") val upsert : JSONArray? = null ) { } \ No newline at end of file diff --git a/Skyflow/src/main/kotlin/Skyflow/Configuration.kt b/Skyflow/src/main/kotlin/Skyflow/Configuration.kt index 073512ec..6a1e9823 100644 --- a/Skyflow/src/main/kotlin/Skyflow/Configuration.kt +++ b/Skyflow/src/main/kotlin/Skyflow/Configuration.kt @@ -1,15 +1,15 @@ package Skyflow -@Description("This is the description for Configuration class") +@Description("This class contains the parameters required for skyflow client initialisation.") class Configuration( - @Description("Description for vaultID param") + @Description("Unique ID of a vault.") val vaultID: String = "", - @Description("Description for vaultURL param") + @Description("The URL of the vault.") var vaultURL: String = "", - @Description("Description for tokenProvider param") + @Description("An implementation of the token provider interface.") val tokenProvider: TokenProvider, - @Description("Description for options param") + @Description("Additional options for configuration.") val options: Options = Options(), ){ init { diff --git a/Skyflow/src/main/kotlin/Skyflow/ContainerType.kt b/Skyflow/src/main/kotlin/Skyflow/ContainerType.kt index f89718a6..a88c699d 100644 --- a/Skyflow/src/main/kotlin/Skyflow/ContainerType.kt +++ b/Skyflow/src/main/kotlin/Skyflow/ContainerType.kt @@ -1,6 +1,6 @@ package Skyflow -@Description("This is the description for ContainerType class") +@Description("This class contains the valid skyflow container types.") class ContainerType { companion object{ val COLLECT = CollectContainer::class; diff --git a/Skyflow/src/main/kotlin/Skyflow/ElementType.kt b/Skyflow/src/main/kotlin/Skyflow/ElementType.kt index 5d4410f4..6106cb7d 100644 --- a/Skyflow/src/main/kotlin/Skyflow/ElementType.kt +++ b/Skyflow/src/main/kotlin/Skyflow/ElementType.kt @@ -15,7 +15,7 @@ class Type(var formatPattern:String, var regex: String, } -@Description("This is the description for SkyflowElementType enum class") +@Description("This class contains all the supported skyflow element types.") enum class SkyflowElementType { diff --git a/Skyflow/src/main/kotlin/Skyflow/Env.kt b/Skyflow/src/main/kotlin/Skyflow/Env.kt index ab3c52a8..69b0afaa 100644 --- a/Skyflow/src/main/kotlin/Skyflow/Env.kt +++ b/Skyflow/src/main/kotlin/Skyflow/Env.kt @@ -1,6 +1,6 @@ package Skyflow -@Description("This is the description for Env enum class") +@Description("Supported environments.") enum class Env { DEV, PROD diff --git a/Skyflow/src/main/kotlin/Skyflow/Init.kt b/Skyflow/src/main/kotlin/Skyflow/Init.kt index 8cd4606f..aa7ba6c7 100644 --- a/Skyflow/src/main/kotlin/Skyflow/Init.kt +++ b/Skyflow/src/main/kotlin/Skyflow/Init.kt @@ -4,9 +4,9 @@ import Skyflow.core.Logger import Skyflow.core.Messages import Skyflow.core.getMessage -@Description("This is the description for init function") +@Description("This function initialises skyflow client.") fun init( - @Description("Description for configuration param") + @Description("The configuration for the skyflow client.") configuration: Configuration ) : Client{ val tag = Client::class.qualifiedName diff --git a/Skyflow/src/main/kotlin/Skyflow/InsertOptions.kt b/Skyflow/src/main/kotlin/Skyflow/InsertOptions.kt index 7c43768f..f2fa7842 100644 --- a/Skyflow/src/main/kotlin/Skyflow/InsertOptions.kt +++ b/Skyflow/src/main/kotlin/Skyflow/InsertOptions.kt @@ -2,10 +2,10 @@ package Skyflow import org.json.JSONArray -@Description("This is the description for InsertOptions class") +@Description("This class contains the additional parameters for the insert method.") class InsertOptions( - @Description("Description for tokens param") + @Description("Indicates whether tokens for the collected data should be returned or not. Defaults to 'true'.") val tokens : Boolean = true, - @Description("Description for upsert param") + @Description("This parameter takes a JSONArray, if provided, upsert operation will be performed instead of insert.") val upsert : JSONArray? = null ){} \ No newline at end of file diff --git a/Skyflow/src/main/kotlin/Skyflow/LogLevel.kt b/Skyflow/src/main/kotlin/Skyflow/LogLevel.kt index 7165b718..92d230e9 100644 --- a/Skyflow/src/main/kotlin/Skyflow/LogLevel.kt +++ b/Skyflow/src/main/kotlin/Skyflow/LogLevel.kt @@ -1,6 +1,6 @@ package Skyflow -@Description("This is the description for LogLevel enum class") +@Description("Supported log levels.") enum class LogLevel { DEBUG, INFO, diff --git a/Skyflow/src/main/kotlin/Skyflow/Options.kt b/Skyflow/src/main/kotlin/Skyflow/Options.kt index b8c21f84..bd1ad003 100644 --- a/Skyflow/src/main/kotlin/Skyflow/Options.kt +++ b/Skyflow/src/main/kotlin/Skyflow/Options.kt @@ -1,10 +1,10 @@ package Skyflow -@Description("This is the description for Options class") +@Description("This class contains additional parameters for skyflow client configuration.") class Options( - @Description("Description for logLevel param") + @Description("The log level for the client.") val logLevel: LogLevel = LogLevel.ERROR, - @Description("Description for env param") + @Description("The working environment.") val env: Env = Env.PROD ) { } \ No newline at end of file diff --git a/Skyflow/src/main/kotlin/Skyflow/Padding.kt b/Skyflow/src/main/kotlin/Skyflow/Padding.kt index d1ed3f2e..0384495c 100644 --- a/Skyflow/src/main/kotlin/Skyflow/Padding.kt +++ b/Skyflow/src/main/kotlin/Skyflow/Padding.kt @@ -1,13 +1,13 @@ package Skyflow -@Description("This is the description for Padding class") +@Description("This class sets the padding for the collect element which takes all the left, top, right, bottom padding values.") public class Padding( - @Description("Description for left param") + @Description("Value for left padding.") val left:Int=10, - @Description("Description for top param") + @Description("Value for top padding.") val top:Int=10, - @Description("Description for right param") + @Description("Value for right padding.") val right:Int=10, - @Description("Description for bottom param") + @Description("Value for bottom padding.") val bottom:Int=10 ) {} \ No newline at end of file diff --git a/Skyflow/src/main/kotlin/Skyflow/RedactionType.kt b/Skyflow/src/main/kotlin/Skyflow/RedactionType.kt index 631d000f..ca61cd1a 100644 --- a/Skyflow/src/main/kotlin/Skyflow/RedactionType.kt +++ b/Skyflow/src/main/kotlin/Skyflow/RedactionType.kt @@ -1,6 +1,6 @@ package Skyflow -@Description("This is the description for RedactionType enum class") +@Description("Supported redaction types.") enum class RedactionType { DEFAULT, PLAIN_TEXT, diff --git a/Skyflow/src/main/kotlin/Skyflow/RevealContainer.kt b/Skyflow/src/main/kotlin/Skyflow/RevealContainer.kt index 03a3c055..93feb897 100644 --- a/Skyflow/src/main/kotlin/Skyflow/RevealContainer.kt +++ b/Skyflow/src/main/kotlin/Skyflow/RevealContainer.kt @@ -12,7 +12,7 @@ import Skyflow.utils.Utils.Companion.checkIfElementsMounted import java.lang.Exception import java.util.* -@Description("This is the description for Reveal Container class") +@Description("This container will contain all reveal elements.") class RevealContainer : ContainerProtocol { private val tag = RevealContainer::class.qualifiedName } @@ -21,11 +21,11 @@ private val tag = RevealContainer::class.qualifiedName @Description("This is description for create function") fun Container.create( - @Description("Description for context param") + @Description("This parameter takes android context object.") context: Context, - @Description("Description for input param") + @Description("This parameter takes a Skyflow.RevealElementInput object.") input: RevealElementInput, - @Description("Description for options param") + @Description("This parameter takes a Skyflow.RevealElementOptions object.") options: RevealElementOptions = RevealElementOptions() ): Label { Logger.info( @@ -45,11 +45,11 @@ fun Container.create( return revealElement } -@Description("This is description for reveal function") +@Description("This function reveals data in the container.") fun Container.reveal( - @Description("Description for callback param") + @Description("Implementation of Skyflow.Callback.") callback: Callback, - @Description("Description for options param") + @Description("Additional options for the reveal method.") options: RevealOptions? = RevealOptions() ) { try { diff --git a/Skyflow/src/main/kotlin/Skyflow/RevealElementInput.kt b/Skyflow/src/main/kotlin/Skyflow/RevealElementInput.kt index daf05f1f..c13ee5d0 100644 --- a/Skyflow/src/main/kotlin/Skyflow/RevealElementInput.kt +++ b/Skyflow/src/main/kotlin/Skyflow/RevealElementInput.kt @@ -1,19 +1,19 @@ package Skyflow -@Description("This is the description for RevealElementInput class") +@Description("This class contains the parameters required for reveal element.") class RevealElementInput( - @Description("Description for token param") + @Description("The value of the skyflow token.") internal var token: String? = null, - @Description("Description for redaction param") + @Description("The redaction to apply for retrieved data. E.g. RedactionType.MASKED.") internal var redaction: RedactionType? = RedactionType.PLAIN_TEXT, - @Description("Description for inputStyles param") + @Description("The styles applied to the element.") internal var inputStyles: Styles = Styles(), - @Description("Description for labelStyles param") + @Description("The styles applied to the label of the reveal element.") internal var labelStyles: Styles = Styles(), - @Description("Description for errorTextStyles param") + @Description("The styles applied to the errorText of the reveal element.") internal var errorTextStyles: Styles = Styles(), - @Description("Description for label param") + @Description("The label for the element.") internal var label: String = "", - @Description("Description for altText param") + @Description("The string that is shown before reveal, will show token if altText is not provided.") internal var altText: String = "" ) {} \ No newline at end of file diff --git a/Skyflow/src/main/kotlin/Skyflow/RevealElementOptions.kt b/Skyflow/src/main/kotlin/Skyflow/RevealElementOptions.kt index 33c5da50..3235af4b 100644 --- a/Skyflow/src/main/kotlin/Skyflow/RevealElementOptions.kt +++ b/Skyflow/src/main/kotlin/Skyflow/RevealElementOptions.kt @@ -1,9 +1,9 @@ package Skyflow -@Description("This is the description for RevealElementOptions class") +@Description("This class contaions additional options for the reveal element.") class RevealElementOptions( - @Description("Description for formatRegex param") + @Description("The format for the element.") var formatRegex : String = "", - @Description("Description for replaceText param") + @Description("The text to replace with, when the format matches.") var replaceText:String? = null ) {} \ No newline at end of file diff --git a/Skyflow/src/main/kotlin/Skyflow/RevealOptions.kt b/Skyflow/src/main/kotlin/Skyflow/RevealOptions.kt index 97b245f0..05bc8da9 100644 --- a/Skyflow/src/main/kotlin/Skyflow/RevealOptions.kt +++ b/Skyflow/src/main/kotlin/Skyflow/RevealOptions.kt @@ -1,5 +1,5 @@ package Skyflow -@Description("This is the description for RevealOptions class") +@Description("Additional options for the reveal elements.") class RevealOptions { } \ No newline at end of file diff --git a/Skyflow/src/main/kotlin/Skyflow/Style.kt b/Skyflow/src/main/kotlin/Skyflow/Style.kt index 9aac621d..66781594 100644 --- a/Skyflow/src/main/kotlin/Skyflow/Style.kt +++ b/Skyflow/src/main/kotlin/Skyflow/Style.kt @@ -4,21 +4,21 @@ import android.graphics.Color import android.graphics.Typeface import android.view.Gravity -@Description("This is the description for Style class") +@Description("This class contains various styles for skyflow elements.") class Style( - @Description("Description for borderColor param") + @Description("The color of the border.") borderColor: Int? = Color.BLACK, - @Description("Description for cornerRadius param") + @Description("The radius applied to the corners.") cornerRadius: Float? = 20f, - @Description("Description for padding param") + @Description("Padding for the element.") padding: Padding? = Padding(10,10,10,10), - @Description("Description for borderWidth param") + @Description("Width of the border.") borderWidth: Int? = 2, - @Description("Description for font param") + @Description("Type of font used.") font: Int? = Typeface.NORMAL, - @Description("Description for textAlignment param") + @Description("Alignment of the text.") textAlignment: Int? = Gravity.LEFT, - @Description("Description for textColor param") + @Description("Color of the text.") textColor: Int? = Color.BLACK) { var borderColor = borderColor ?: Color.BLACK diff --git a/Skyflow/src/main/kotlin/Skyflow/Styles.kt b/Skyflow/src/main/kotlin/Skyflow/Styles.kt index bf5df402..6e4a20e4 100644 --- a/Skyflow/src/main/kotlin/Skyflow/Styles.kt +++ b/Skyflow/src/main/kotlin/Skyflow/Styles.kt @@ -1,16 +1,16 @@ package Skyflow -@Description("This is the description for Styles class") +@Description("This class contains different styles to apply on a skyflow element.") public class Styles( - @Description("Description for base param") + @Description("The styles applied on skyflow elements in its base form.") base: Style? = Style(), - @Description("Description for complete param") + @Description("The styles applied when value is valid.") complete: Style? = Style(), - @Description("Description for empty param") + @Description("The styles applied when skyflow element is empty.") empty: Style? = Style(), - @Description("Description for focus param") + @Description("The styles applied when skyflow element is focused.") focus: Style? = Style(), - @Description("Description for invalid param") + @Description("The styles applied when value is invalid.") invalid: Style? = Style() ) { var base = base ?: Style() diff --git a/Skyflow/src/main/kotlin/Skyflow/TokenProvider.kt b/Skyflow/src/main/kotlin/Skyflow/TokenProvider.kt index 07506562..f5d58b13 100644 --- a/Skyflow/src/main/kotlin/Skyflow/TokenProvider.kt +++ b/Skyflow/src/main/kotlin/Skyflow/TokenProvider.kt @@ -1,10 +1,10 @@ package Skyflow -@Description("This is the description for TokenProvider interface") +@Description("This interface defines the behavior of a class that can provide a bearer token.") interface TokenProvider { - @Description("This is description for getBearerToken function") + @Description("This function gets a bearer token.") fun getBearerToken( - @Description("Description for callback param") + @Description("This function is called when the bearer token is available.") callback: Callback ) } \ No newline at end of file diff --git a/Skyflow/src/main/kotlin/Skyflow/utils/EventName.kt b/Skyflow/src/main/kotlin/Skyflow/utils/EventName.kt index 25ec377b..8328ff6e 100644 --- a/Skyflow/src/main/kotlin/Skyflow/utils/EventName.kt +++ b/Skyflow/src/main/kotlin/Skyflow/utils/EventName.kt @@ -2,7 +2,7 @@ package Skyflow.utils import Skyflow.Description -@Description("This is the description for EventName enum class") +@Description("Supported event names.") enum class EventName { CHANGE, READY, From 84d44e058dd460c4163ccabf042a8e93bd5765d2 Mon Sep 17 00:00:00 2001 From: kamal-skyflow Date: Wed, 19 Jul 2023 18:44:46 +0530 Subject: [PATCH 5/7] chore: made suggested changes in comments --- Skyflow/src/main/kotlin/Skyflow/Callback.kt | 2 +- Skyflow/src/main/kotlin/Skyflow/Client.kt | 18 ++++++++--------- .../main/kotlin/Skyflow/CollectContainer.kt | 14 ++++++------- .../kotlin/Skyflow/CollectElementInput.kt | 20 +++++++++---------- .../kotlin/Skyflow/CollectElementOptions.kt | 4 ++-- .../src/main/kotlin/Skyflow/CollectOptions.kt | 4 ++-- .../src/main/kotlin/Skyflow/Configuration.kt | 4 ++-- .../src/main/kotlin/Skyflow/ContainerType.kt | 2 +- .../src/main/kotlin/Skyflow/ElementType.kt | 2 +- Skyflow/src/main/kotlin/Skyflow/Init.kt | 4 ++-- .../src/main/kotlin/Skyflow/InsertOptions.kt | 4 ++-- Skyflow/src/main/kotlin/Skyflow/Options.kt | 6 +++--- Skyflow/src/main/kotlin/Skyflow/Padding.kt | 2 +- .../main/kotlin/Skyflow/RevealContainer.kt | 12 +++++------ .../main/kotlin/Skyflow/RevealElementInput.kt | 14 ++++++------- .../kotlin/Skyflow/RevealElementOptions.kt | 6 +++--- Skyflow/src/main/kotlin/Skyflow/Style.kt | 6 +++--- Skyflow/src/main/kotlin/Skyflow/Styles.kt | 12 +++++------ .../src/main/kotlin/Skyflow/TokenProvider.kt | 6 +++--- 19 files changed, 71 insertions(+), 71 deletions(-) diff --git a/Skyflow/src/main/kotlin/Skyflow/Callback.kt b/Skyflow/src/main/kotlin/Skyflow/Callback.kt index d70555c2..a0146045 100644 --- a/Skyflow/src/main/kotlin/Skyflow/Callback.kt +++ b/Skyflow/src/main/kotlin/Skyflow/Callback.kt @@ -1,6 +1,6 @@ package Skyflow -@Description("This interface contains the results of the implementation of callback.") +@Description("Contains the results of the implementation of callback.") interface Callback { @Description("Implementation when callback results in success.") diff --git a/Skyflow/src/main/kotlin/Skyflow/Client.kt b/Skyflow/src/main/kotlin/Skyflow/Client.kt index 6e52e594..5bdef9c3 100644 --- a/Skyflow/src/main/kotlin/Skyflow/Client.kt +++ b/Skyflow/src/main/kotlin/Skyflow/Client.kt @@ -14,9 +14,9 @@ import javax.xml.parsers.DocumentBuilderFactory import kotlin.Exception import kotlin.reflect.KClass -@Description("This class contains an instance of the Skyflow client.") +@Description("Contains an instance of the Skyflow client.") class Client internal constructor( - @Description("The skyflow client initialization includes configuration options.") + @Description("Skyflow client initialization includes configuration options.") val configuration: Configuration, ){ internal val tag = Client::class.qualifiedName @@ -26,7 +26,7 @@ class Client internal constructor( internal val elementMap = HashMap() - @Description("The function inserts data into the vault.") + @Description("Inserts data into the vault.") fun insert( @Description("Inserts records into the vault.") records: JSONObject, @@ -46,9 +46,9 @@ class Client internal constructor( } } - @Description("This function retrieves record the data using tokens.") + @Description("Retrieves record the data using tokens.") fun detokenize( - @Description("This parameter takes a JSON object that contains tokens for fetching record values.") + @Description("Takes a JSON object that contains tokens for fetching record values.") records: JSONObject, @Description("Implementation of Skyflow.Callback.") callback: Callback @@ -63,9 +63,9 @@ class Client internal constructor( } } - @Description("This function retrieves using SkyflowID's.") + @Description("Retrieves using SkyflowID's.") fun getById( - @Description("This parameter takes a JSON object that contains records to fetch.") + @Description("Takes a JSON object that contains records to fetch.") records: JSONObject, @Description("Implementation of Skyflow.Callback.") callback: Callback @@ -196,9 +196,9 @@ class Client internal constructor( return result } - @Description("This method creates a skyflow container.") + @Description("Creates a skyflow container.") fun container( - @Description("This parameter defines the type of the container.") + @Description("Defines the type of the container.") type: KClass ) : Container{ if(type == ContainerType.COLLECT){ diff --git a/Skyflow/src/main/kotlin/Skyflow/CollectContainer.kt b/Skyflow/src/main/kotlin/Skyflow/CollectContainer.kt index 4e145a8f..e5ba3e9d 100644 --- a/Skyflow/src/main/kotlin/Skyflow/CollectContainer.kt +++ b/Skyflow/src/main/kotlin/Skyflow/CollectContainer.kt @@ -10,7 +10,7 @@ import com.Skyflow.core.container.ContainerProtocol import org.json.JSONObject import java.util.* -@Description("This container will contain all collect elements.") +@Description("Contains all the Collect Elements.") open class CollectContainer : ContainerProtocol { } @@ -18,13 +18,13 @@ open class CollectContainer : ContainerProtocol { private val tag = CollectContainer::class.qualifiedName -@Description("This creates a skyflow collect element.") +@Description("Creates a skyflow collect element.") fun Container.create( - @Description("This parameter takes an Android Context object.") + @Description("Takes an Android Context object.") context: Context, - @Description("This parameter takes a Skyflow.CollectElementInput object.") + @Description("Takes a Skyflow.CollectElementInput object.") input : CollectElementInput, - @Description("This parameter takes a Skyflow.CollectElementOptions object.") + @Description("Takes a Skyflow.CollectElementOptions object.") options : CollectElementOptions = CollectElementOptions() ) : TextField { @@ -38,11 +38,11 @@ fun Container.create( return collectElement } -@Description("This function collects data and saves it to a vault.") +@Description("Collects data and saves it to a vault.") fun Container.collect( @Description("Implementation of Skyflow.Callback.") callback: Callback, - @Description("The collect method offers additional options.") + @Description("Collect method offers additional options.") options: CollectOptions? = CollectOptions() ){ try { diff --git a/Skyflow/src/main/kotlin/Skyflow/CollectElementInput.kt b/Skyflow/src/main/kotlin/Skyflow/CollectElementInput.kt index b2c4222b..db019dc4 100644 --- a/Skyflow/src/main/kotlin/Skyflow/CollectElementInput.kt +++ b/Skyflow/src/main/kotlin/Skyflow/CollectElementInput.kt @@ -2,28 +2,28 @@ package Skyflow import com.Skyflow.collect.elements.validations.ValidationSet -@Description("This class contains the parameters that are required for the collect element.") +@Description("Contains the parameters that are required for the collect element.") class CollectElementInput( - @Description("The data belongs to this table.") + @Description("Data belongs to this table.") internal var table: String? = null, - @Description("The data should be inserted into the column.") + @Description("Data should be inserted into the column.") internal var column: String? = null, @Description("Skyflow.ElementType enum.") internal var type: SkyflowElementType, - @Description("The styles that are applied to the form element.") + @Description("Styles that are applied to the form element.") internal var inputStyles: Styles = Styles(), - @Description("the styles that are applied to the label of the collect element.") + @Description("Styles that are applied to the label of the collect element.") internal var labelStyles:Styles=Styles(), - @Description("The styles that are applied to the errorText of the collect element.") + @Description("Styles that are applied to the errorText of the collect element.") internal var errorTextStyles:Styles=Styles(), - @Description("The Label of the form element.") + @Description("Label of the form element.") internal var label: String = "", - @Description("The placeholder for the form element.") + @Description("Placeholder for the form element.") internal var placeholder: String = "", - @Description("the string that acts as an initial value to the collect element.") + @Description("String that acts as an initial value to the collect element.") @Deprecated("altText parameter is deprecated" , level = DeprecationLevel.WARNING) internal var altText: String = "", - @Description("A set of validations to the collect element.") + @Description("Set of validations to the collect element.") internal var validations : ValidationSet = ValidationSet() ) { } \ No newline at end of file diff --git a/Skyflow/src/main/kotlin/Skyflow/CollectElementOptions.kt b/Skyflow/src/main/kotlin/Skyflow/CollectElementOptions.kt index 9d65b369..88642902 100644 --- a/Skyflow/src/main/kotlin/Skyflow/CollectElementOptions.kt +++ b/Skyflow/src/main/kotlin/Skyflow/CollectElementOptions.kt @@ -1,12 +1,12 @@ package Skyflow -@Description("This class contains the additional options for skyflow collect element.") +@Description("Contains the additional options for skyflow collect element.") class CollectElementOptions( @Description("Indicates whether the field is marked as required. Defaults to 'false'.") var required:Boolean = false, @Description("Indicates whether card icon should be enabled (only for CARD_NUMBER inputs).") var enableCardIcon : Boolean = true, - @Description("The format for the element.") + @Description("Format for the element.") var format: String = "" ) { } \ No newline at end of file diff --git a/Skyflow/src/main/kotlin/Skyflow/CollectOptions.kt b/Skyflow/src/main/kotlin/Skyflow/CollectOptions.kt index 8ee87a6f..edb99140 100644 --- a/Skyflow/src/main/kotlin/Skyflow/CollectOptions.kt +++ b/Skyflow/src/main/kotlin/Skyflow/CollectOptions.kt @@ -3,13 +3,13 @@ package Skyflow import org.json.JSONArray import org.json.JSONObject -@Description("This class contains the additional parameters for the collect method.") +@Description("Contains the additional parameters for the collect method.") class CollectOptions( @Description("Indicates whether tokens for the collected data should be returned or not. Defaults to 'true'.") val token:Boolean = true, @Description("Insert the non-PCI elements data into the vault in the format of the records object.") val additionalFields: JSONObject? = null, - @Description("This parameter takes a JSONArray, if provided, upsert operation will be performed instead of insert.") + @Description("Takes a JSONArray, if provided, upsert operation will be performed instead of insert.") val upsert : JSONArray? = null ) { } \ No newline at end of file diff --git a/Skyflow/src/main/kotlin/Skyflow/Configuration.kt b/Skyflow/src/main/kotlin/Skyflow/Configuration.kt index 6a1e9823..7233082a 100644 --- a/Skyflow/src/main/kotlin/Skyflow/Configuration.kt +++ b/Skyflow/src/main/kotlin/Skyflow/Configuration.kt @@ -1,11 +1,11 @@ package Skyflow -@Description("This class contains the parameters required for skyflow client initialisation.") +@Description("Contains the parameters required for skyflow client initialisation.") class Configuration( @Description("Unique ID of a vault.") val vaultID: String = "", - @Description("The URL of the vault.") + @Description("URL of the vault.") var vaultURL: String = "", @Description("An implementation of the token provider interface.") val tokenProvider: TokenProvider, diff --git a/Skyflow/src/main/kotlin/Skyflow/ContainerType.kt b/Skyflow/src/main/kotlin/Skyflow/ContainerType.kt index a88c699d..a2450434 100644 --- a/Skyflow/src/main/kotlin/Skyflow/ContainerType.kt +++ b/Skyflow/src/main/kotlin/Skyflow/ContainerType.kt @@ -1,6 +1,6 @@ package Skyflow -@Description("This class contains the valid skyflow container types.") +@Description("Contains the valid skyflow container types.") class ContainerType { companion object{ val COLLECT = CollectContainer::class; diff --git a/Skyflow/src/main/kotlin/Skyflow/ElementType.kt b/Skyflow/src/main/kotlin/Skyflow/ElementType.kt index 6106cb7d..107a51ba 100644 --- a/Skyflow/src/main/kotlin/Skyflow/ElementType.kt +++ b/Skyflow/src/main/kotlin/Skyflow/ElementType.kt @@ -15,7 +15,7 @@ class Type(var formatPattern:String, var regex: String, } -@Description("This class contains all the supported skyflow element types.") +@Description("Contains all the supported skyflow element types.") enum class SkyflowElementType { diff --git a/Skyflow/src/main/kotlin/Skyflow/Init.kt b/Skyflow/src/main/kotlin/Skyflow/Init.kt index aa7ba6c7..78412dc6 100644 --- a/Skyflow/src/main/kotlin/Skyflow/Init.kt +++ b/Skyflow/src/main/kotlin/Skyflow/Init.kt @@ -4,9 +4,9 @@ import Skyflow.core.Logger import Skyflow.core.Messages import Skyflow.core.getMessage -@Description("This function initialises skyflow client.") +@Description("Initialises skyflow client.") fun init( - @Description("The configuration for the skyflow client.") + @Description("Configuration for the skyflow client.") configuration: Configuration ) : Client{ val tag = Client::class.qualifiedName diff --git a/Skyflow/src/main/kotlin/Skyflow/InsertOptions.kt b/Skyflow/src/main/kotlin/Skyflow/InsertOptions.kt index f2fa7842..f2faf4ad 100644 --- a/Skyflow/src/main/kotlin/Skyflow/InsertOptions.kt +++ b/Skyflow/src/main/kotlin/Skyflow/InsertOptions.kt @@ -2,10 +2,10 @@ package Skyflow import org.json.JSONArray -@Description("This class contains the additional parameters for the insert method.") +@Description("Contains the additional parameters for the insert method.") class InsertOptions( @Description("Indicates whether tokens for the collected data should be returned or not. Defaults to 'true'.") val tokens : Boolean = true, - @Description("This parameter takes a JSONArray, if provided, upsert operation will be performed instead of insert.") + @Description("Takes a JSONArray, if provided, upsert operation will be performed instead of insert.") val upsert : JSONArray? = null ){} \ No newline at end of file diff --git a/Skyflow/src/main/kotlin/Skyflow/Options.kt b/Skyflow/src/main/kotlin/Skyflow/Options.kt index bd1ad003..2e8a6b5d 100644 --- a/Skyflow/src/main/kotlin/Skyflow/Options.kt +++ b/Skyflow/src/main/kotlin/Skyflow/Options.kt @@ -1,10 +1,10 @@ package Skyflow -@Description("This class contains additional parameters for skyflow client configuration.") +@Description("Contains additional parameters for skyflow client configuration.") class Options( - @Description("The log level for the client.") + @Description("Log level for the client.") val logLevel: LogLevel = LogLevel.ERROR, - @Description("The working environment.") + @Description("Working environment.") val env: Env = Env.PROD ) { } \ No newline at end of file diff --git a/Skyflow/src/main/kotlin/Skyflow/Padding.kt b/Skyflow/src/main/kotlin/Skyflow/Padding.kt index 0384495c..ca37c11a 100644 --- a/Skyflow/src/main/kotlin/Skyflow/Padding.kt +++ b/Skyflow/src/main/kotlin/Skyflow/Padding.kt @@ -1,6 +1,6 @@ package Skyflow -@Description("This class sets the padding for the collect element which takes all the left, top, right, bottom padding values.") +@Description("Sets the padding for the collect element which takes all the left, top, right, bottom padding values.") public class Padding( @Description("Value for left padding.") val left:Int=10, diff --git a/Skyflow/src/main/kotlin/Skyflow/RevealContainer.kt b/Skyflow/src/main/kotlin/Skyflow/RevealContainer.kt index 93feb897..4d6578ed 100644 --- a/Skyflow/src/main/kotlin/Skyflow/RevealContainer.kt +++ b/Skyflow/src/main/kotlin/Skyflow/RevealContainer.kt @@ -12,20 +12,20 @@ import Skyflow.utils.Utils.Companion.checkIfElementsMounted import java.lang.Exception import java.util.* -@Description("This container will contain all reveal elements.") +@Description("Will contain all Reveal Elements.") class RevealContainer : ContainerProtocol { private val tag = RevealContainer::class.qualifiedName } private val tag = RevealContainer::class.qualifiedName -@Description("This is description for create function") +@Description("Creates a Skyflow Reveal Element.") fun Container.create( - @Description("This parameter takes android context object.") + @Description("Takes an android context object.") context: Context, - @Description("This parameter takes a Skyflow.RevealElementInput object.") + @Description("Takes a Skyflow.RevealElementInput object.") input: RevealElementInput, - @Description("This parameter takes a Skyflow.RevealElementOptions object.") + @Description("Takes a Skyflow.RevealElementOptions object.") options: RevealElementOptions = RevealElementOptions() ): Label { Logger.info( @@ -45,7 +45,7 @@ fun Container.create( return revealElement } -@Description("This function reveals data in the container.") +@Description("Reveals data in the container.") fun Container.reveal( @Description("Implementation of Skyflow.Callback.") callback: Callback, diff --git a/Skyflow/src/main/kotlin/Skyflow/RevealElementInput.kt b/Skyflow/src/main/kotlin/Skyflow/RevealElementInput.kt index c13ee5d0..f7879566 100644 --- a/Skyflow/src/main/kotlin/Skyflow/RevealElementInput.kt +++ b/Skyflow/src/main/kotlin/Skyflow/RevealElementInput.kt @@ -1,19 +1,19 @@ package Skyflow -@Description("This class contains the parameters required for reveal element.") +@Description("Contains the parameters required for reveal element.") class RevealElementInput( - @Description("The value of the skyflow token.") + @Description("Value of the Skyflow token.") internal var token: String? = null, - @Description("The redaction to apply for retrieved data. E.g. RedactionType.MASKED.") + @Description("Redaction to apply for retrieved data. E.g. RedactionType.MASKED.") internal var redaction: RedactionType? = RedactionType.PLAIN_TEXT, - @Description("The styles applied to the element.") + @Description("Styles applied to the element.") internal var inputStyles: Styles = Styles(), - @Description("The styles applied to the label of the reveal element.") + @Description("Styles applied to the label of the reveal element.") internal var labelStyles: Styles = Styles(), - @Description("The styles applied to the errorText of the reveal element.") + @Description("Styles applied to the errorText of the reveal element.") internal var errorTextStyles: Styles = Styles(), @Description("The label for the element.") internal var label: String = "", - @Description("The string that is shown before reveal, will show token if altText is not provided.") + @Description("String that is shown before reveal, will show token if altText is not provided.") internal var altText: String = "" ) {} \ No newline at end of file diff --git a/Skyflow/src/main/kotlin/Skyflow/RevealElementOptions.kt b/Skyflow/src/main/kotlin/Skyflow/RevealElementOptions.kt index 3235af4b..78172849 100644 --- a/Skyflow/src/main/kotlin/Skyflow/RevealElementOptions.kt +++ b/Skyflow/src/main/kotlin/Skyflow/RevealElementOptions.kt @@ -1,9 +1,9 @@ package Skyflow -@Description("This class contaions additional options for the reveal element.") +@Description("Contaions additional options for the reveal element.") class RevealElementOptions( - @Description("The format for the element.") + @Description("Format for the element.") var formatRegex : String = "", - @Description("The text to replace with, when the format matches.") + @Description("Text to replace with, when the format matches.") var replaceText:String? = null ) {} \ No newline at end of file diff --git a/Skyflow/src/main/kotlin/Skyflow/Style.kt b/Skyflow/src/main/kotlin/Skyflow/Style.kt index 66781594..e1db15d1 100644 --- a/Skyflow/src/main/kotlin/Skyflow/Style.kt +++ b/Skyflow/src/main/kotlin/Skyflow/Style.kt @@ -4,11 +4,11 @@ import android.graphics.Color import android.graphics.Typeface import android.view.Gravity -@Description("This class contains various styles for skyflow elements.") +@Description("Contains various styles for skyflow elements.") class Style( - @Description("The color of the border.") + @Description("Color of the border.") borderColor: Int? = Color.BLACK, - @Description("The radius applied to the corners.") + @Description("Radius applied to the corners.") cornerRadius: Float? = 20f, @Description("Padding for the element.") padding: Padding? = Padding(10,10,10,10), diff --git a/Skyflow/src/main/kotlin/Skyflow/Styles.kt b/Skyflow/src/main/kotlin/Skyflow/Styles.kt index 6e4a20e4..edfed6ef 100644 --- a/Skyflow/src/main/kotlin/Skyflow/Styles.kt +++ b/Skyflow/src/main/kotlin/Skyflow/Styles.kt @@ -1,16 +1,16 @@ package Skyflow -@Description("This class contains different styles to apply on a skyflow element.") +@Description("Contains different styles to apply on a skyflow element.") public class Styles( - @Description("The styles applied on skyflow elements in its base form.") + @Description("Styles applied on skyflow elements in its base form.") base: Style? = Style(), - @Description("The styles applied when value is valid.") + @Description("Styles applied when value is valid.") complete: Style? = Style(), - @Description("The styles applied when skyflow element is empty.") + @Description("Styles applied when skyflow element is empty.") empty: Style? = Style(), - @Description("The styles applied when skyflow element is focused.") + @Description("Styles applied when skyflow element is focused.") focus: Style? = Style(), - @Description("The styles applied when value is invalid.") + @Description("Styles applied when value is invalid.") invalid: Style? = Style() ) { var base = base ?: Style() diff --git a/Skyflow/src/main/kotlin/Skyflow/TokenProvider.kt b/Skyflow/src/main/kotlin/Skyflow/TokenProvider.kt index f5d58b13..8f11bc76 100644 --- a/Skyflow/src/main/kotlin/Skyflow/TokenProvider.kt +++ b/Skyflow/src/main/kotlin/Skyflow/TokenProvider.kt @@ -1,10 +1,10 @@ package Skyflow -@Description("This interface defines the behavior of a class that can provide a bearer token.") +@Description("Defines the behavior of a class that can provide a bearer token.") interface TokenProvider { - @Description("This function gets a bearer token.") + @Description("Gets a bearer token.") fun getBearerToken( - @Description("This function is called when the bearer token is available.") + @Description("Called when the bearer token is available.") callback: Callback ) } \ No newline at end of file From 0a2c63e2feea72df583eb6671a97229f832740e6 Mon Sep 17 00:00:00 2001 From: kamal-skyflow Date: Tue, 1 Aug 2023 21:18:20 +0530 Subject: [PATCH 6/7] chore: made suggested changes --- Skyflow/src/main/kotlin/Skyflow/Client.kt | 10 ++++----- .../main/kotlin/Skyflow/CollectContainer.kt | 6 ++--- .../kotlin/Skyflow/CollectElementInput.kt | 22 +++++++++---------- .../kotlin/Skyflow/CollectElementOptions.kt | 4 ++-- .../src/main/kotlin/Skyflow/CollectOptions.kt | 8 +++---- .../src/main/kotlin/Skyflow/Configuration.kt | 4 ++-- .../src/main/kotlin/Skyflow/ContainerType.kt | 2 +- .../src/main/kotlin/Skyflow/InsertOptions.kt | 6 ++--- .../main/kotlin/Skyflow/RevealElementInput.kt | 16 +++++++------- .../kotlin/Skyflow/RevealElementOptions.kt | 4 ++-- .../src/main/kotlin/Skyflow/TokenProvider.kt | 2 +- 11 files changed, 42 insertions(+), 42 deletions(-) diff --git a/Skyflow/src/main/kotlin/Skyflow/Client.kt b/Skyflow/src/main/kotlin/Skyflow/Client.kt index 5bdef9c3..ddce7764 100644 --- a/Skyflow/src/main/kotlin/Skyflow/Client.kt +++ b/Skyflow/src/main/kotlin/Skyflow/Client.kt @@ -28,9 +28,9 @@ class Client internal constructor( @Description("Inserts data into the vault.") fun insert( - @Description("Inserts records into the vault.") + @Description("Records to insert.") records: JSONObject, - @Description("Additional options for insert method/request.") + @Description("Options for the insertion.") options: InsertOptions? = InsertOptions(), @Description("Implementation of Skyflow.Callback.") callback: Callback @@ -63,7 +63,7 @@ class Client internal constructor( } } - @Description("Retrieves using SkyflowID's.") + @Description("Reveals records by Skyflow ID.") fun getById( @Description("Takes a JSON object that contains records to fetch.") records: JSONObject, @@ -196,9 +196,9 @@ class Client internal constructor( return result } - @Description("Creates a skyflow container.") + @Description("Creates a container.") fun container( - @Description("Defines the type of the container.") + @Description("Type of the container.") type: KClass ) : Container{ if(type == ContainerType.COLLECT){ diff --git a/Skyflow/src/main/kotlin/Skyflow/CollectContainer.kt b/Skyflow/src/main/kotlin/Skyflow/CollectContainer.kt index e5ba3e9d..7550afdb 100644 --- a/Skyflow/src/main/kotlin/Skyflow/CollectContainer.kt +++ b/Skyflow/src/main/kotlin/Skyflow/CollectContainer.kt @@ -18,13 +18,13 @@ open class CollectContainer : ContainerProtocol { private val tag = CollectContainer::class.qualifiedName -@Description("Creates a skyflow collect element.") +@Description("Creates a Collect Element.") fun Container.create( @Description("Takes an Android Context object.") context: Context, - @Description("Takes a Skyflow.CollectElementInput object.") + @Description("Input configuration for a Collect Element.") input : CollectElementInput, - @Description("Takes a Skyflow.CollectElementOptions object.") + @Description("Additional options for a Collect Element.") options : CollectElementOptions = CollectElementOptions() ) : TextField { diff --git a/Skyflow/src/main/kotlin/Skyflow/CollectElementInput.kt b/Skyflow/src/main/kotlin/Skyflow/CollectElementInput.kt index db019dc4..40093d78 100644 --- a/Skyflow/src/main/kotlin/Skyflow/CollectElementInput.kt +++ b/Skyflow/src/main/kotlin/Skyflow/CollectElementInput.kt @@ -2,28 +2,28 @@ package Skyflow import com.Skyflow.collect.elements.validations.ValidationSet -@Description("Contains the parameters that are required for the collect element.") +@Description("Configuration for a Collect Element.") class CollectElementInput( - @Description("Data belongs to this table.") + @Description("Table that the data belongs to.") internal var table: String? = null, - @Description("Data should be inserted into the column.") + @Description("Column that the data belongs to.") internal var column: String? = null, - @Description("Skyflow.ElementType enum.") + @Description("Type of the element.") internal var type: SkyflowElementType, - @Description("Styles that are applied to the form element.") + @Description("Styles for the element.") internal var inputStyles: Styles = Styles(), - @Description("Styles that are applied to the label of the collect element.") + @Description("Styles for the element's label.") internal var labelStyles:Styles=Styles(), - @Description("Styles that are applied to the errorText of the collect element.") + @Description("Styles for the element's error text.") internal var errorTextStyles:Styles=Styles(), - @Description("Label of the form element.") + @Description("Label for the element.") internal var label: String = "", - @Description("Placeholder for the form element.") + @Description("Placeholder text for the element.") internal var placeholder: String = "", - @Description("String that acts as an initial value to the collect element.") + @Description("Alt text for the element.") @Deprecated("altText parameter is deprecated" , level = DeprecationLevel.WARNING) internal var altText: String = "", - @Description("Set of validations to the collect element.") + @Description("Input validation rules for the element.") internal var validations : ValidationSet = ValidationSet() ) { } \ No newline at end of file diff --git a/Skyflow/src/main/kotlin/Skyflow/CollectElementOptions.kt b/Skyflow/src/main/kotlin/Skyflow/CollectElementOptions.kt index 88642902..5167c4ff 100644 --- a/Skyflow/src/main/kotlin/Skyflow/CollectElementOptions.kt +++ b/Skyflow/src/main/kotlin/Skyflow/CollectElementOptions.kt @@ -1,12 +1,12 @@ package Skyflow -@Description("Contains the additional options for skyflow collect element.") +@Description("Contains the additional options for Collect Element.") class CollectElementOptions( @Description("Indicates whether the field is marked as required. Defaults to 'false'.") var required:Boolean = false, @Description("Indicates whether card icon should be enabled (only for CARD_NUMBER inputs).") var enableCardIcon : Boolean = true, - @Description("Format for the element.") + @Description("Format of the Collect element.") var format: String = "" ) { } \ No newline at end of file diff --git a/Skyflow/src/main/kotlin/Skyflow/CollectOptions.kt b/Skyflow/src/main/kotlin/Skyflow/CollectOptions.kt index edb99140..e9321f01 100644 --- a/Skyflow/src/main/kotlin/Skyflow/CollectOptions.kt +++ b/Skyflow/src/main/kotlin/Skyflow/CollectOptions.kt @@ -3,13 +3,13 @@ package Skyflow import org.json.JSONArray import org.json.JSONObject -@Description("Contains the additional parameters for the collect method.") +@Description("Options for a Collect Element.") class CollectOptions( - @Description("Indicates whether tokens for the collected data should be returned or not. Defaults to 'true'.") + @Description("If `true`, returns tokens for the collected data. Defaults to `true`.") val token:Boolean = true, - @Description("Insert the non-PCI elements data into the vault in the format of the records object.") + @Description("Additional, non-sensitive data to insert into the vault. Uses the format of a [`records`](https://docs.skyflow.com/record/#RecordService_InsertRecord) object.") val additionalFields: JSONObject? = null, - @Description("Takes a JSONArray, if provided, upsert operation will be performed instead of insert.") + @Description("Upsert configuration for the element.") val upsert : JSONArray? = null ) { } \ No newline at end of file diff --git a/Skyflow/src/main/kotlin/Skyflow/Configuration.kt b/Skyflow/src/main/kotlin/Skyflow/Configuration.kt index 7233082a..954d52b3 100644 --- a/Skyflow/src/main/kotlin/Skyflow/Configuration.kt +++ b/Skyflow/src/main/kotlin/Skyflow/Configuration.kt @@ -3,9 +3,9 @@ package Skyflow @Description("Contains the parameters required for skyflow client initialisation.") class Configuration( - @Description("Unique ID of a vault.") + @Description("ID of the vault to connect to.") val vaultID: String = "", - @Description("URL of the vault.") + @Description("URL of the vault to connect to.") var vaultURL: String = "", @Description("An implementation of the token provider interface.") val tokenProvider: TokenProvider, diff --git a/Skyflow/src/main/kotlin/Skyflow/ContainerType.kt b/Skyflow/src/main/kotlin/Skyflow/ContainerType.kt index a2450434..d292dec0 100644 --- a/Skyflow/src/main/kotlin/Skyflow/ContainerType.kt +++ b/Skyflow/src/main/kotlin/Skyflow/ContainerType.kt @@ -1,6 +1,6 @@ package Skyflow -@Description("Contains the valid skyflow container types.") +@Description("Contains valid Skyflow container types.") class ContainerType { companion object{ val COLLECT = CollectContainer::class; diff --git a/Skyflow/src/main/kotlin/Skyflow/InsertOptions.kt b/Skyflow/src/main/kotlin/Skyflow/InsertOptions.kt index f2faf4ad..a227e09e 100644 --- a/Skyflow/src/main/kotlin/Skyflow/InsertOptions.kt +++ b/Skyflow/src/main/kotlin/Skyflow/InsertOptions.kt @@ -2,10 +2,10 @@ package Skyflow import org.json.JSONArray -@Description("Contains the additional parameters for the insert method.") +@Description("Contains additional parameters for the insert method.") class InsertOptions( - @Description("Indicates whether tokens for the collected data should be returned or not. Defaults to 'true'.") + @Description("If `true`, returns tokens for the collected data. Defaults to `true`.") val tokens : Boolean = true, - @Description("Takes a JSONArray, if provided, upsert operation will be performed instead of insert.") + @Description("Upsert configuration for the element.") val upsert : JSONArray? = null ){} \ No newline at end of file diff --git a/Skyflow/src/main/kotlin/Skyflow/RevealElementInput.kt b/Skyflow/src/main/kotlin/Skyflow/RevealElementInput.kt index f7879566..a09a1217 100644 --- a/Skyflow/src/main/kotlin/Skyflow/RevealElementInput.kt +++ b/Skyflow/src/main/kotlin/Skyflow/RevealElementInput.kt @@ -1,19 +1,19 @@ package Skyflow -@Description("Contains the parameters required for reveal element.") +@Description("Configuration for Reveal Elements.") class RevealElementInput( - @Description("Value of the Skyflow token.") + @Description("A token to retrieve the value of.") internal var token: String? = null, - @Description("Redaction to apply for retrieved data. E.g. RedactionType.MASKED.") + @Description("Redaction type of the revealed data.") internal var redaction: RedactionType? = RedactionType.PLAIN_TEXT, - @Description("Styles applied to the element.") + @Description("Input styles for the Reveal Element.") internal var inputStyles: Styles = Styles(), - @Description("Styles applied to the label of the reveal element.") + @Description("Styles for the Reveal Element's label.") internal var labelStyles: Styles = Styles(), - @Description("Styles applied to the errorText of the reveal element.") + @Description("Styles for the Reveal Element's error text.") internal var errorTextStyles: Styles = Styles(), - @Description("The label for the element.") + @Description("Label for the Reveal Element.") internal var label: String = "", - @Description("String that is shown before reveal, will show token if altText is not provided.") + @Description("Alternative text for the Reveal Element.") internal var altText: String = "" ) {} \ No newline at end of file diff --git a/Skyflow/src/main/kotlin/Skyflow/RevealElementOptions.kt b/Skyflow/src/main/kotlin/Skyflow/RevealElementOptions.kt index 78172849..51579342 100644 --- a/Skyflow/src/main/kotlin/Skyflow/RevealElementOptions.kt +++ b/Skyflow/src/main/kotlin/Skyflow/RevealElementOptions.kt @@ -1,8 +1,8 @@ package Skyflow -@Description("Contaions additional options for the reveal element.") +@Description("Configuration options for a Reveal Element.") class RevealElementOptions( - @Description("Format for the element.") + @Description("Format of the Reveal element.") var formatRegex : String = "", @Description("Text to replace with, when the format matches.") var replaceText:String? = null diff --git a/Skyflow/src/main/kotlin/Skyflow/TokenProvider.kt b/Skyflow/src/main/kotlin/Skyflow/TokenProvider.kt index 8f11bc76..026a52de 100644 --- a/Skyflow/src/main/kotlin/Skyflow/TokenProvider.kt +++ b/Skyflow/src/main/kotlin/Skyflow/TokenProvider.kt @@ -2,7 +2,7 @@ package Skyflow @Description("Defines the behavior of a class that can provide a bearer token.") interface TokenProvider { - @Description("Gets a bearer token.") + @Description("Function that retrieves a Skyflow bearer token from your backend.") fun getBearerToken( @Description("Called when the bearer token is available.") callback: Callback From 43b820ec81bb1ad2a8ea287b37faee9b2492a6ec Mon Sep 17 00:00:00 2001 From: kamal-skyflow Date: Tue, 22 Aug 2023 12:22:28 +0530 Subject: [PATCH 7/7] DEX-208 chore: made suggested changes --- Skyflow/src/main/kotlin/Skyflow/Client.kt | 6 +++--- Skyflow/src/main/kotlin/Skyflow/CollectContainer.kt | 6 +++--- Skyflow/src/main/kotlin/Skyflow/CollectElementOptions.kt | 4 ++-- Skyflow/src/main/kotlin/Skyflow/Configuration.kt | 2 +- Skyflow/src/main/kotlin/Skyflow/ContainerType.kt | 2 +- Skyflow/src/main/kotlin/Skyflow/ElementType.kt | 2 +- Skyflow/src/main/kotlin/Skyflow/Init.kt | 4 ++-- Skyflow/src/main/kotlin/Skyflow/InsertOptions.kt | 2 +- Skyflow/src/main/kotlin/Skyflow/Options.kt | 2 +- Skyflow/src/main/kotlin/Skyflow/Padding.kt | 2 +- Skyflow/src/main/kotlin/Skyflow/RevealContainer.kt | 8 ++++---- Skyflow/src/main/kotlin/Skyflow/RevealElementInput.kt | 2 +- Skyflow/src/main/kotlin/Skyflow/RevealOptions.kt | 2 +- Skyflow/src/main/kotlin/Skyflow/Style.kt | 2 +- Skyflow/src/main/kotlin/Skyflow/Styles.kt | 2 +- 15 files changed, 24 insertions(+), 24 deletions(-) diff --git a/Skyflow/src/main/kotlin/Skyflow/Client.kt b/Skyflow/src/main/kotlin/Skyflow/Client.kt index ddce7764..f53856f9 100644 --- a/Skyflow/src/main/kotlin/Skyflow/Client.kt +++ b/Skyflow/src/main/kotlin/Skyflow/Client.kt @@ -48,7 +48,7 @@ class Client internal constructor( @Description("Retrieves record the data using tokens.") fun detokenize( - @Description("Takes a JSON object that contains tokens for fetching record values.") + @Description("Tokens to return values for.") records: JSONObject, @Description("Implementation of Skyflow.Callback.") callback: Callback @@ -63,9 +63,9 @@ class Client internal constructor( } } - @Description("Reveals records by Skyflow ID.") + @Description("Reveal records by Skyflow ID.") fun getById( - @Description("Takes a JSON object that contains records to fetch.") + @Description("Records to fetch.") records: JSONObject, @Description("Implementation of Skyflow.Callback.") callback: Callback diff --git a/Skyflow/src/main/kotlin/Skyflow/CollectContainer.kt b/Skyflow/src/main/kotlin/Skyflow/CollectContainer.kt index 7550afdb..449a1d4a 100644 --- a/Skyflow/src/main/kotlin/Skyflow/CollectContainer.kt +++ b/Skyflow/src/main/kotlin/Skyflow/CollectContainer.kt @@ -22,7 +22,7 @@ private val tag = CollectContainer::class.qualifiedName fun Container.create( @Description("Takes an Android Context object.") context: Context, - @Description("Input configuration for a Collect Element.") + @Description("Configuration for a Collect Element.") input : CollectElementInput, @Description("Additional options for a Collect Element.") options : CollectElementOptions = CollectElementOptions() @@ -38,11 +38,11 @@ fun Container.create( return collectElement } -@Description("Collects data and saves it to a vault.") +@Description("Collects data and inserts it into a vault.") fun Container.collect( @Description("Implementation of Skyflow.Callback.") callback: Callback, - @Description("Collect method offers additional options.") + @Description("Additional collect options.") options: CollectOptions? = CollectOptions() ){ try { diff --git a/Skyflow/src/main/kotlin/Skyflow/CollectElementOptions.kt b/Skyflow/src/main/kotlin/Skyflow/CollectElementOptions.kt index 5167c4ff..420b2fec 100644 --- a/Skyflow/src/main/kotlin/Skyflow/CollectElementOptions.kt +++ b/Skyflow/src/main/kotlin/Skyflow/CollectElementOptions.kt @@ -2,9 +2,9 @@ package Skyflow @Description("Contains the additional options for Collect Element.") class CollectElementOptions( - @Description("Indicates whether the field is marked as required. Defaults to 'false'.") + @Description("If `true`, the field is required. Defaults to `false`.") var required:Boolean = false, - @Description("Indicates whether card icon should be enabled (only for CARD_NUMBER inputs).") + @Description("If `true`, enables the card icon. Defaults to `true`.") var enableCardIcon : Boolean = true, @Description("Format of the Collect element.") var format: String = "" diff --git a/Skyflow/src/main/kotlin/Skyflow/Configuration.kt b/Skyflow/src/main/kotlin/Skyflow/Configuration.kt index 954d52b3..aec0a116 100644 --- a/Skyflow/src/main/kotlin/Skyflow/Configuration.kt +++ b/Skyflow/src/main/kotlin/Skyflow/Configuration.kt @@ -1,7 +1,7 @@ package Skyflow -@Description("Contains the parameters required for skyflow client initialisation.") +@Description("Parameters to initialize a Skyflow client.") class Configuration( @Description("ID of the vault to connect to.") val vaultID: String = "", diff --git a/Skyflow/src/main/kotlin/Skyflow/ContainerType.kt b/Skyflow/src/main/kotlin/Skyflow/ContainerType.kt index d292dec0..d5f464fa 100644 --- a/Skyflow/src/main/kotlin/Skyflow/ContainerType.kt +++ b/Skyflow/src/main/kotlin/Skyflow/ContainerType.kt @@ -1,6 +1,6 @@ package Skyflow -@Description("Contains valid Skyflow container types.") +@Description("Skyflow container types.") class ContainerType { companion object{ val COLLECT = CollectContainer::class; diff --git a/Skyflow/src/main/kotlin/Skyflow/ElementType.kt b/Skyflow/src/main/kotlin/Skyflow/ElementType.kt index 107a51ba..45168d31 100644 --- a/Skyflow/src/main/kotlin/Skyflow/ElementType.kt +++ b/Skyflow/src/main/kotlin/Skyflow/ElementType.kt @@ -15,7 +15,7 @@ class Type(var formatPattern:String, var regex: String, } -@Description("Contains all the supported skyflow element types.") +@Description("Skyflow Element types.") enum class SkyflowElementType { diff --git a/Skyflow/src/main/kotlin/Skyflow/Init.kt b/Skyflow/src/main/kotlin/Skyflow/Init.kt index 78412dc6..14b93476 100644 --- a/Skyflow/src/main/kotlin/Skyflow/Init.kt +++ b/Skyflow/src/main/kotlin/Skyflow/Init.kt @@ -4,9 +4,9 @@ import Skyflow.core.Logger import Skyflow.core.Messages import Skyflow.core.getMessage -@Description("Initialises skyflow client.") +@Description("Initializes the Skyflow client.") fun init( - @Description("Configuration for the skyflow client.") + @Description("Configuration for the Skyflow client.") configuration: Configuration ) : Client{ val tag = Client::class.qualifiedName diff --git a/Skyflow/src/main/kotlin/Skyflow/InsertOptions.kt b/Skyflow/src/main/kotlin/Skyflow/InsertOptions.kt index a227e09e..ea09540b 100644 --- a/Skyflow/src/main/kotlin/Skyflow/InsertOptions.kt +++ b/Skyflow/src/main/kotlin/Skyflow/InsertOptions.kt @@ -2,7 +2,7 @@ package Skyflow import org.json.JSONArray -@Description("Contains additional parameters for the insert method.") +@Description("Additional parameters for the insert method.") class InsertOptions( @Description("If `true`, returns tokens for the collected data. Defaults to `true`.") val tokens : Boolean = true, diff --git a/Skyflow/src/main/kotlin/Skyflow/Options.kt b/Skyflow/src/main/kotlin/Skyflow/Options.kt index 2e8a6b5d..9c50ceca 100644 --- a/Skyflow/src/main/kotlin/Skyflow/Options.kt +++ b/Skyflow/src/main/kotlin/Skyflow/Options.kt @@ -1,6 +1,6 @@ package Skyflow -@Description("Contains additional parameters for skyflow client configuration.") +@Description("Additional configuration for the Skyflow client.") class Options( @Description("Log level for the client.") val logLevel: LogLevel = LogLevel.ERROR, diff --git a/Skyflow/src/main/kotlin/Skyflow/Padding.kt b/Skyflow/src/main/kotlin/Skyflow/Padding.kt index ca37c11a..fb1685ea 100644 --- a/Skyflow/src/main/kotlin/Skyflow/Padding.kt +++ b/Skyflow/src/main/kotlin/Skyflow/Padding.kt @@ -1,6 +1,6 @@ package Skyflow -@Description("Sets the padding for the collect element which takes all the left, top, right, bottom padding values.") +@Description("Padding for Collect Elements. Accepts left, top, right, and bottom padding values.") public class Padding( @Description("Value for left padding.") val left:Int=10, diff --git a/Skyflow/src/main/kotlin/Skyflow/RevealContainer.kt b/Skyflow/src/main/kotlin/Skyflow/RevealContainer.kt index 4d6578ed..c31bb68d 100644 --- a/Skyflow/src/main/kotlin/Skyflow/RevealContainer.kt +++ b/Skyflow/src/main/kotlin/Skyflow/RevealContainer.kt @@ -12,7 +12,7 @@ import Skyflow.utils.Utils.Companion.checkIfElementsMounted import java.lang.Exception import java.util.* -@Description("Will contain all Reveal Elements.") +@Description("Contains Reveal Elements.") class RevealContainer : ContainerProtocol { private val tag = RevealContainer::class.qualifiedName } @@ -21,11 +21,11 @@ private val tag = RevealContainer::class.qualifiedName @Description("Creates a Skyflow Reveal Element.") fun Container.create( - @Description("Takes an android context object.") + @Description("An Android context element.") context: Context, - @Description("Takes a Skyflow.RevealElementInput object.") + @Description("A Skyflow.RevealElementInput object.") input: RevealElementInput, - @Description("Takes a Skyflow.RevealElementOptions object.") + @Description("A Skyflow.RevealElementOptions object.") options: RevealElementOptions = RevealElementOptions() ): Label { Logger.info( diff --git a/Skyflow/src/main/kotlin/Skyflow/RevealElementInput.kt b/Skyflow/src/main/kotlin/Skyflow/RevealElementInput.kt index a09a1217..bf0fa3a3 100644 --- a/Skyflow/src/main/kotlin/Skyflow/RevealElementInput.kt +++ b/Skyflow/src/main/kotlin/Skyflow/RevealElementInput.kt @@ -4,7 +4,7 @@ package Skyflow class RevealElementInput( @Description("A token to retrieve the value of.") internal var token: String? = null, - @Description("Redaction type of the revealed data.") + @Description("Redaction type applied to the data. Defaults to `RedactionType.PLAIN_TEXT`.") internal var redaction: RedactionType? = RedactionType.PLAIN_TEXT, @Description("Input styles for the Reveal Element.") internal var inputStyles: Styles = Styles(), diff --git a/Skyflow/src/main/kotlin/Skyflow/RevealOptions.kt b/Skyflow/src/main/kotlin/Skyflow/RevealOptions.kt index 05bc8da9..74b347b4 100644 --- a/Skyflow/src/main/kotlin/Skyflow/RevealOptions.kt +++ b/Skyflow/src/main/kotlin/Skyflow/RevealOptions.kt @@ -1,5 +1,5 @@ package Skyflow -@Description("Additional options for the reveal elements.") +@Description("Additional options for Reveal Elements.") class RevealOptions { } \ No newline at end of file diff --git a/Skyflow/src/main/kotlin/Skyflow/Style.kt b/Skyflow/src/main/kotlin/Skyflow/Style.kt index e1db15d1..e7f8a754 100644 --- a/Skyflow/src/main/kotlin/Skyflow/Style.kt +++ b/Skyflow/src/main/kotlin/Skyflow/Style.kt @@ -4,7 +4,7 @@ import android.graphics.Color import android.graphics.Typeface import android.view.Gravity -@Description("Contains various styles for skyflow elements.") +@Description("Style options for elements.") class Style( @Description("Color of the border.") borderColor: Int? = Color.BLACK, diff --git a/Skyflow/src/main/kotlin/Skyflow/Styles.kt b/Skyflow/src/main/kotlin/Skyflow/Styles.kt index edfed6ef..0fb174ca 100644 --- a/Skyflow/src/main/kotlin/Skyflow/Styles.kt +++ b/Skyflow/src/main/kotlin/Skyflow/Styles.kt @@ -1,6 +1,6 @@ package Skyflow -@Description("Contains different styles to apply on a skyflow element.") +@Description("Styles to apply to elements.") public class Styles( @Description("Styles applied on skyflow elements in its base form.") base: Style? = Style(),