EnvironmentBuilder

class EnvironmentBuilder(baseEnvironment: BaseEnvironment) : IResourceBuilder<Environment>

Environment resource builder

Samples

import com.yamilovs.insomnia.exporter.model.*
import com.yamilovs.insomnia.exporter.model.Collection
import com.yamilovs.insomnia.exporter.model.request.FollowRedirect
import com.yamilovs.insomnia.exporter.model.request.Method
import com.yamilovs.insomnia.exporter.model.request.authentication.EmptyAuthentication
import com.yamilovs.insomnia.exporter.model.request.body.EmptyBody
import com.yamilovs.insomnia.exporter.model.request.header.Header
import com.yamilovs.insomnia.exporter.model.request.parameter.Parameter
import java.net.URL
fun main() { 
   //sampleStart 
   val workspace = Workspace()
val baseEnvironment = BaseEnvironment(workspace)

Environment.build(baseEnvironment) {

    // setting up resource name
    // next function call will rewrite previous value
    name("Environment name")
    name { "Environment name" }

    env("BASE_URL", "https://yamilovs.com") // added first env value
    env { "USERNAME" to "yamilovs" } // added second env value
    +("PASSWORD" to "qwerty") // added third env value

    // setting up environment color
    // next function call will rewrite previous value
    color("#FF00FF")
    color { "#00FF00" }

    // setting private value
    // next function call will rewrite previous value
    private(true)
    private { true }

    // setting environment resource position
    // next function call will rewrite previous value
    metaSortKey(10)
    metaSortKey { 10 }
} 
   //sampleEnd
}

Constructors

Link copied to clipboard
fun EnvironmentBuilder(baseEnvironment: BaseEnvironment)

Functions

Link copied to clipboard
open override fun build(): Environment
Link copied to clipboard
fun color(init: () -> String): EnvironmentBuilder
fun color(color: String): EnvironmentBuilder
Link copied to clipboard
fun env(init: () -> Pair<String, Any>): EnvironmentBuilder
fun env(key: String, value: Any): EnvironmentBuilder
Link copied to clipboard
fun metaSortKey(init: () -> Long): EnvironmentBuilder
fun metaSortKey(metaSortKey: Long): EnvironmentBuilder
Link copied to clipboard
fun name(init: () -> String): EnvironmentBuilder
fun name(name: String): EnvironmentBuilder
Link copied to clipboard
fun private(isPrivate: Boolean): EnvironmentBuilder
fun private(init: () -> Boolean): EnvironmentBuilder
Link copied to clipboard
operator fun Pair<String, Any>.unaryPlus(): EnvironmentBuilder