From 8507c71f8874d8f31801aa169f3f8aa71757ce8a Mon Sep 17 00:00:00 2001 From: Peter Csajtai Date: Thu, 30 Jan 2020 19:19:55 +0100 Subject: [PATCH 1/2] Update sdk docs --- docs/sdk-reference/android.md | 11 +++++------ docs/sdk-reference/go.md | 10 ++-------- docs/sdk-reference/ios.md | 7 ++----- docs/sdk-reference/java.md | 5 ++--- 4 files changed, 11 insertions(+), 22 deletions(-) diff --git a/docs/sdk-reference/android.md b/docs/sdk-reference/android.md index a92691c4..9a519e34 100644 --- a/docs/sdk-reference/android.md +++ b/docs/sdk-reference/android.md @@ -34,7 +34,7 @@ val client = ConfigCatClient("#YOUR-API-KEY#") ``` ### 4. Get your setting value ```kotlin -val isMyAwesomeFeatureEnabled = client.getValue(Boolean::class.javaObjectType, "", false) +val isMyAwesomeFeatureEnabled = client.getValue(Boolean::class.java "", false) if(isMyAwesomeFeatureEnabled) { doTheNewThing() } else { @@ -82,7 +82,7 @@ val client = ConfigCatClient.newBuilder() | `defaultValue` | **REQUIRED.** This value will be returned in case of an error. | ```kotlin val value = client.getValue( - Boolean::class.javaObjectType, // Setting type + Boolean::class.java, // Setting type "keyOfMySetting", // Setting Key User.newBuilder().build("435170f4-8a8b-4b67-a723-505ac7cdea92"), // Optional User Object false // Default value @@ -98,7 +98,7 @@ val value = client.getValue( | `defaultValue` | **REQUIRED.** This value will be returned in case of an error. | ```kotlin client.getValueAsync( - Boolean::class.javaObjectType, // Setting type + Boolean::class.java, // Setting type "keyOfMySetting", // Setting Key User.newBuilder().build("435170f4-8a8b-4b67-a723-505ac7cdea92"), // Optional User Object false // Default value @@ -158,9 +158,8 @@ Adding a callback to `configurationChangeListener` option parameter will get you val client = ConfigCatClient.newBuilder() .mode(PollingModes.AutoPoll( 120 /* polling interval in seconds */, - {parser, newConfiguration -> - // here you can parse the new configuration like this: - // parser.parseValue(Boolean::class.java, newConfiguration, ) + { + // here you can subscribe to configuration changes }) ) .build("#YOUR-API-KEY#") diff --git a/docs/sdk-reference/go.md b/docs/sdk-reference/go.md index cb138b25..b6de4763 100644 --- a/docs/sdk-reference/go.md +++ b/docs/sdk-reference/go.md @@ -183,14 +183,8 @@ client := configcat.NewCustomClient( // The auto poll interval time.Second * 120, // The callback called when the configuration changes - func(config string, parser *configcat.ConfigParser) { - result, err := parser.Parse(config, "key-of-my-awesome-feature") - if err != nil { - isMyAwesomeFeatureEnabled, ok := result.(bool) - if ok && isMyAwesomeFeatureEnabled { - //show your awesome feature to the world! - } - } + func() { + // here you can subscribe to configuration changes }) )} ) diff --git a/docs/sdk-reference/ios.md b/docs/sdk-reference/ios.md index a975aeec..8e89334f 100644 --- a/docs/sdk-reference/ios.md +++ b/docs/sdk-reference/ios.md @@ -144,11 +144,8 @@ let client = ConfigCatClient( apiKey: "", refreshMode: PollingModes.autoPoll( autoPollIntervalInSeconds: 120, // polling interval in seconds - onConfigChanged: { (config, parser) in - let isMyAwesomeFeatureEnabled: String = try! parser.parseValue(for: "key-of-my-awesome-feature", json: configString) - if(isMyAwesomeFeatureEnabled) { - //show your awesome feature to the world! - } + onConfigChanged: { + // here you can subscribe to configuration changes } ) ) diff --git a/docs/sdk-reference/java.md b/docs/sdk-reference/java.md index 4ad86899..817a12f0 100644 --- a/docs/sdk-reference/java.md +++ b/docs/sdk-reference/java.md @@ -155,9 +155,8 @@ Adding a callback to `configurationChangeListener` option parameter will get you ConfigCatClient client = ConfigCatClient.newBuilder() .mode(PollingModes.AutoPoll( 120 /* polling interval in seconds */, - (parser, newConfiguration) -> { - // here you can parse the new configuration like this: - // parser.parseValue(Boolean.class, newConfiguration, ) + () -> { + // here you can subscribe to configuration changes }) ) .build(""); From f8b63db31fb2926f23ba57f88ab9aff7f090cd1f Mon Sep 17 00:00:00 2001 From: Peter Csajtai Date: Fri, 31 Jan 2020 19:19:25 +0100 Subject: [PATCH 2/2] Update manual polling docs --- docs/sdk-reference/android.md | 6 +++++- docs/sdk-reference/go.md | 5 ++++- docs/sdk-reference/ios.md | 5 ++++- docs/sdk-reference/java.md | 8 ++++++-- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/docs/sdk-reference/android.md b/docs/sdk-reference/android.md index 9a519e34..b0da176f 100644 --- a/docs/sdk-reference/android.md +++ b/docs/sdk-reference/android.md @@ -187,12 +187,16 @@ val client = ConfigCatClient.newBuilder() If you set the `asyncRefresh` to `false`, the refresh operation will be awaited until the fetching of the new configuration is completed. ### Manual polling -With this policy every new configuration request on the ConfigCatClient will trigger a new fetch over HTTP. +Manual polling gives you full control over when the setting values are downloaded. ConfigCat SDK will not update them automatically. Calling `forceRefresh()` is your application's responsibility. ```java val client = ConfigCatClient.newBuilder() .mode(PollingModes.ManualPoll()) .build("#YOUR-API-KEY#") + +client.forceRefresh() ``` +> `getValue()` returns `defaultValue` if the cache is empty. Call `forceRefresh()` to update the cache. + ## Custom cache diff --git a/docs/sdk-reference/go.md b/docs/sdk-reference/go.md index b6de4763..820ac30e 100644 --- a/docs/sdk-reference/go.md +++ b/docs/sdk-reference/go.md @@ -208,13 +208,16 @@ client := configcat.NewCustomClient( >If you set the `asyncRefresh` to `false`, the refresh operation will be awaited until the fetching of the new configuration is completed. ### Manual polling -With this policy every new configuration request on the ConfigCatClient will trigger a new fetch over HTTP. +Manual polling gives you full control over when the setting values are downloaded. ConfigCat SDK will not update them automatically. Calling `Refresh()` is your application's responsibility. ```go client := configcat.NewCustomClient( "", configcat.ClientConfig{ Mode: configcat.ManualPoll() } ) + +client.ForceRefresh() ``` +> `GetValue()` returns `defaultValue` if the cache is empty. Call `Refresh()` to update the cache. ## Custom Cache You have the option to inject your custom cache implementation into the client. All you have to do is to satisfy the `ConfigCache` interface: diff --git a/docs/sdk-reference/ios.md b/docs/sdk-reference/ios.md index 8e89334f..f2855163 100644 --- a/docs/sdk-reference/ios.md +++ b/docs/sdk-reference/ios.md @@ -174,13 +174,16 @@ let client = ConfigCatClient( If you set the `asyncRefresh` to `false`, the refresh operation will be awaited until the fetching of the new configuration is completed. ### Manual polling -With this policy every new configuration request on the ConfigCatClient will trigger a new fetch over HTTP. +Manual polling gives you full control over when the setting values are downloaded. ConfigCat SDK will not update them automatically. Calling `forceRefresh()` is your application's responsibility. ```swift let client = ConfigCatClient( apiKey: "", refreshMode: PollingModes.manualPoll() ) + +client.forceRefresh() ``` +> `getValue()` returns `defaultValue` if the cache is empty. Call `forceRefresh()` to update the cache. ## Custom cache You have the option to inject your custom cache implementation into the client. All you have to do is to inherit from the `ConfigCache` open class: diff --git a/docs/sdk-reference/java.md b/docs/sdk-reference/java.md index 817a12f0..8aa6a065 100644 --- a/docs/sdk-reference/java.md +++ b/docs/sdk-reference/java.md @@ -184,12 +184,16 @@ ConfigCatClient client = ConfigCatClient.newBuilder() If you set the `asyncRefresh` to `false`, the refresh operation will be awaited until the fetching of the new configuration is completed. ### Manual polling -With this policy every new configuration request on the ConfigCatClient will trigger a new fetch over HTTP. +Manual polling gives you full control over when the setting values are downloaded. ConfigCat SDK will not update them automatically. Calling `forceRefresh()` is your application's responsibility. ```java ConfigCatClient client = ConfigCatClient.newBuilder() .mode(PollingModes.ManualPoll()) - .build(""); + .build("#YOUR-API-KEY#"); + +client.forceRefresh(); ``` +> `getValue()` returns `defaultValue` if the cache is empty. Call `forceRefresh()` to update the cache. + ## Custom cache You have the option to inject your custom cache implementation into the client. All you have to do is to inherit from the `ConfigCache` abstract class: ```java