Scoop API

scoop:scoop.http.client:0.1.0

src/authentication/http_authentication_options_builder.scoop

Selected production source · src/authentication/http_authentication_options_builder.scoop

1package scoop.http.client
3import scoop.collections.emptyList
4import scoop.http.HttpAuthChallenge
5import scoop.url.Url
6import scoop.url.UrlOrigin
7import scoop.http.*
8import scoop.http.asyncio.*
9import scoop.asyncio.*
11/** Configures one complete value; execution remains explicit. */
12public fun httpAuthenticationOptions(
13 configure: HttpAuthenticationOptionsBuilder.() -> Unit = {}
14): HttpAuthenticationOptions {
15 val builder = HttpAuthenticationOptionsBuilder()
16 builder.configure()
17 return builder.snapshot()
20public fun HttpAuthenticationOptions.copy(
21 configure: HttpAuthenticationOptionsBuilder.() -> Unit = {}
22): HttpAuthenticationOptions {
23 val builder = HttpAuthenticationOptionsBuilder()
24 builder.providers = this.providers
25 builder.maxAttempts = this.maxAttempts
26 builder.configure()
27 return builder.snapshot()
30public class HttpAuthenticationOptionsBuilder internal constructor() {
31 public var providers: List<HttpAuthenticator> = emptyList<HttpAuthenticator>()
32 public var maxAttempts: Long = 3L
34 public fun provider(value: HttpAuthenticator): Unit {
35 val next = ArrayList<HttpAuthenticator>()
36 for (item in providers)
37 next.add(item)
38 next.add(value)
39 providers = next.toArray()
40 }
41 internal fun snapshot(): HttpAuthenticationOptions =
42 HttpAuthenticationOptions(providers, maxAttempts)