diff --git a/docs/sdk/client-side-sdks/javascript/javascript-openfeature.md b/docs/sdk/client-side-sdks/javascript/javascript-openfeature.md index 510b92f8..f3a23d00 100644 --- a/docs/sdk/client-side-sdks/javascript/javascript-openfeature.md +++ b/docs/sdk/client-side-sdks/javascript/javascript-openfeature.md @@ -54,7 +54,7 @@ import { OpenFeature } from '@openfeature/web-sdk' const user = { user_id: 'user_id' } // Initialize the DevCycle Provider -const devcycleProvider = new DevCycleProvider(DEVCYCLE_CLIENT_SDK_KEY) +const devcycleProvider = new DevCycleProvider('') // Set the context before the provider is set to ensure the DevCycle SDK is initialized with a user context. await OpenFeature.setContext(user) // Set the DevCycleProvider for OpenFeature @@ -83,7 +83,7 @@ Ensure that you pass any custom DevCycleOptions to the DevCycleProvider construc const user = { user_id: 'user_id' } const options = { logger: dvcDefaultLogger({ level: 'debug' }) } -const devcycleProvider = new DevCycleProvider(DEVCYCLE_CLIENT_SDK_KEY, options) +const devcycleProvider = new DevCycleProvider('', options) await OpenFeature.setProviderAndWait(devcycleProvider) ``` diff --git a/docs/sdk/client-side-sdks/react/react-openfeature.md b/docs/sdk/client-side-sdks/react/react-openfeature.md index 0a8b4298..8ede424a 100644 --- a/docs/sdk/client-side-sdks/react/react-openfeature.md +++ b/docs/sdk/client-side-sdks/react/react-openfeature.md @@ -51,7 +51,7 @@ import { OpenFeatureProvider, useBooleanFlagValue, OpenFeature } from '@openfeat import DevCycleProvider from '@devcycle/openfeature-web-provider' await OpenFeature.setContext({ user_id: 'user_id' }) -await OpenFeature.setProviderAndWait(new DevCycleProvider(DEVCYCLE_CLIENT_SDK_KEY)) +await OpenFeature.setProviderAndWait(new DevCycleProvider('')) function App() { return ( @@ -93,7 +93,7 @@ Ensure that you pass any custom DevCycleOptions to the DevCycleProvider construc const user = { user_id: 'user_id' } const options = { logger: dvcDefaultLogger({ level: 'debug' }) } -const devcycleProvider = new DevCycleProvider(DEVCYCLE_CLIENT_SDK_KEY, options) +const devcycleProvider = new DevCycleProvider('', options) await OpenFeature.setProviderAndWait(devcycleProvider) ``` diff --git a/docs/sdk/client-side-sdks/react/react-usage.md b/docs/sdk/client-side-sdks/react/react-usage.md index 6c40b19d..a60b7d42 100644 --- a/docs/sdk/client-side-sdks/react/react-usage.md +++ b/docs/sdk/client-side-sdks/react/react-usage.md @@ -38,10 +38,10 @@ const DevCycleFeaturePage = () => { } ``` -If a change on the dashboard triggers your variable value to change, it will rerender any components calling this hook in order to reflect your new variable value. To learn more, visit the [Realtime Updates](/sdk/features#realtime-updates) page. - [//]: # (wizard-evaluate-end) +If a change on the dashboard triggers your variable value to change, it will rerender any components calling this hook in order to reflect your new variable value. To learn more, visit the [Realtime Updates](/sdk/features#realtime-updates) page. + ## Getting the DevCycle Client The SDK provides a hook to access the underlying DevCycle client. This allows you to identify users, track events, and directly access diff --git a/docs/sdk/server-side-sdks/dotnet/dotnet-gettingstarted.md b/docs/sdk/server-side-sdks/dotnet/dotnet-gettingstarted.md index 93c23364..8548f863 100644 --- a/docs/sdk/server-side-sdks/dotnet/dotnet-gettingstarted.md +++ b/docs/sdk/server-side-sdks/dotnet/dotnet-gettingstarted.md @@ -34,6 +34,7 @@ namespace Example { ``` ## Local Bucketing - Initializing SDK +[//]: # (wizard-initialize-start) To start, initialize a client using the SDK key. @@ -53,6 +54,7 @@ namespace Example { } } ``` +[//]: # (wizard-initialize-end) ### Initialization With Callback diff --git a/docs/sdk/server-side-sdks/dotnet/dotnet-install.md b/docs/sdk/server-side-sdks/dotnet/dotnet-install.md index cbb6be17..24f9fe4e 100644 --- a/docs/sdk/server-side-sdks/dotnet/dotnet-install.md +++ b/docs/sdk/server-side-sdks/dotnet/dotnet-install.md @@ -12,6 +12,8 @@ sidebar_custom_props: { icon: material-symbols:install-desktop } ## Local Bucketing +[//]: # (wizard-install-start) + Use the following command to install the NuGet package: ```bash dotnet add package DevCycle.SDK.Server.Local @@ -23,6 +25,8 @@ and use the namespaces: `using DevCycle.SDK.Server.Local.Api;` +[//]: # (wizard-install-end) + ## Cloud Bucketing Use the following command to install the NuGet package: diff --git a/docs/sdk/server-side-sdks/dotnet/dotnet-openfeature.md b/docs/sdk/server-side-sdks/dotnet/dotnet-openfeature.md index f6cf5046..3e4ddb31 100644 --- a/docs/sdk/server-side-sdks/dotnet/dotnet-openfeature.md +++ b/docs/sdk/server-side-sdks/dotnet/dotnet-openfeature.md @@ -18,7 +18,39 @@ DevCycle provides a C# implementation of the [OpenFeature](https://openfeature.d The OpenFeature Provider is included in the DevCycle SDK for .NET / C# natively. It's included for both Cloud and Local Bucketing. +## Local Bucketing + +[//]: # (wizard-install-start) + +Use the following command to install the NuGet package: +```bash +dotnet add package DevCycle.SDK.Server.Local +``` + +or download the SDK from Nuget - https://nuget.info/packages/DevCycle.SDK.Server.Local/ + +and use the namespaces: + +`using DevCycle.SDK.Server.Local.Api;` + +[//]: # (wizard-install-end) + +## Cloud Bucketing + +Use the following command to install the NuGet package: +```bash +dotnet add package DevCycle.SDK.Server.Cloud +``` + +or download the SDK from Nuget - https://www.nuget.org/packages/DevCycle.SDK.Server.Cloud/ + +and use the namespaces: + +`using DevCycle.SDK.Server.Cloud.Api;` +`using DevCycle.SDK.Server.Common.Model;` + ### Getting Started +[//]: # (wizard-initialize-start) Initialize the DevCycle SDK and set the DevCycleProvider as the provider for OpenFeature: @@ -48,10 +80,20 @@ EvaluationContext ctx = EvaluationContext.Builder() .Set("nonSetValueBubbledCustomData3", 1) .Set("nonSetValueBubbledCustomData4", new Value((object)null)) .Build(); +``` +[//]: # (wizard-initialize-end) +### Evaluate a Variable +Use a Variable value by passing the Variable key, default value, and EvaluationContext to one of the OpenFeature flag evaluation methods + +[//]: # (wizard-evaluate-start) + +```csharp var variableResult = await oFeatureClient.GetStringDetails(readOnlyVariable.Key, "default", ctx); ``` +[//]: # (wizard-evaluate-end) + ### Required TargetingKey For DevCycle SDK to work we require either a `targetingKey` or `user_id` to be set on the OpenFeature context. diff --git a/docs/sdk/server-side-sdks/dotnet/dotnet-usage.md b/docs/sdk/server-side-sdks/dotnet/dotnet-usage.md index 72813df9..d068183f 100644 --- a/docs/sdk/server-side-sdks/dotnet/dotnet-usage.md +++ b/docs/sdk/server-side-sdks/dotnet/dotnet-usage.md @@ -10,6 +10,8 @@ sidebar_custom_props: { icon: material-symbols:toggle-on } [![Nuget Local](https://badgen.net/nuget/v/DevCycle.SDK.Server.Cloud)](https://www.nuget.org/packages/DevCycle.SDK.Server.Local/) [![GitHub](https://img.shields.io/github/stars/devcyclehq/dotnet-server-sdk.svg?style=social&label=Star&maxAge=2592000)](https://github.com/DevCycleHQ/dotnet-server-sdk) +[//]: # (wizard-evaluate-start) + ## DevCycleUser Object The user object is required for all methods. The only required field in the user object is userId @@ -29,6 +31,7 @@ In that case it will return a variable value with the value set to whatever was ```csharp bool result = await client.VariableValue(user, "your-variable-key", true); ``` +[//]: # (wizard-evaluate-end) The default value can be of type `String`, `Boolean`, `Number`, or `Object`. diff --git a/docs/sdk/server-side-sdks/go/go-gettingstarted.md b/docs/sdk/server-side-sdks/go/go-gettingstarted.md index 3cceea8c..32ef85c2 100644 --- a/docs/sdk/server-side-sdks/go/go-gettingstarted.md +++ b/docs/sdk/server-side-sdks/go/go-gettingstarted.md @@ -10,6 +10,8 @@ sidebar_custom_props: { icon: material-symbols:rocket } ## Initializing SDK +[//]: # (wizard-initialize-start) + When initializing the Go SDK, you can choose to use `Cloud` or `Local` bucketing. The default mode is `Local`. To use `Cloud` bucketing, set the `devcycle.Options` setting `EnableCloudBucketing` to true. @@ -43,6 +45,7 @@ func main() { } } ``` +[//]: # (wizard-initialize-end) If using local bucketing, be sure to check the error return from creating a new Client - if the local bucketing engine fails to initialize for any reason- it'll return as an error here. diff --git a/docs/sdk/server-side-sdks/go/go-install.md b/docs/sdk/server-side-sdks/go/go-install.md index c725b097..4f36da77 100644 --- a/docs/sdk/server-side-sdks/go/go-install.md +++ b/docs/sdk/server-side-sdks/go/go-install.md @@ -8,6 +8,9 @@ sidebar_custom_props: { icon: material-symbols:install-desktop } [![GitHub](https://img.shields.io/github/stars/devcyclehq/go-server-sdk.svg?style=social&label=Star&maxAge=2592000)](https://github.com/DevCycleHQ/go-server-sdk) +[//]: # (wizard-install-start) + ```bash go get "github.com/devcyclehq/go-server-sdk/v2" ``` +[//]: # (wizard-install-end) diff --git a/docs/sdk/server-side-sdks/go/go-openfeature.md b/docs/sdk/server-side-sdks/go/go-openfeature.md index 171fa15a..8809624f 100644 --- a/docs/sdk/server-side-sdks/go/go-openfeature.md +++ b/docs/sdk/server-side-sdks/go/go-openfeature.md @@ -18,14 +18,19 @@ DevCycle provides a Go implementation of the [OpenFeature](https://openfeature.d ### Installation +[//]: # (wizard-install-start) + Install the OpenFeature Go SDK and DevCycle Provider: ```bash go get "github.com/devcyclehq/go-server-sdk/v2" ``` +[//]: # (wizard-install-end) ### Getting Started +[//]: # (wizard-initialize-start) + Initialize the DevCycle SDK and set the DevCycleProvider as the provider for OpenFeature: ```go @@ -62,13 +67,22 @@ func main() { log.Fatalf("Failed to set DevCycle provider: %v", err) } client := openfeature.NewClient("devcycle") +} +``` +[//]: # (wizard-initialize-end) +### Evaluate a Variable +Use a Variable value by passing the Variable key, default value, and EvaluationContext to one of the OpenFeature flag evaluation methods + +[//]: # (wizard-evaluate-start) + +```go evalCtx := openfeature.NewEvaluationContext("user_id", map[string]interface{}{}) booleanVar, err := client.BooleanValue(context.Background(), "boolean-flag", false, evalCtx) log.Printf("The boolean variable value is: %v", booleanVar) -} ``` +[//]: # (wizard-evaluate-end) ### Required TargetingKey diff --git a/docs/sdk/server-side-sdks/go/go-usage.md b/docs/sdk/server-side-sdks/go/go-usage.md index 992fb271..aee40471 100644 --- a/docs/sdk/server-side-sdks/go/go-usage.md +++ b/docs/sdk/server-side-sdks/go/go-usage.md @@ -8,6 +8,8 @@ sidebar_custom_props: { icon: material-symbols:toggle-on } [![GitHub](https://img.shields.io/github/stars/devcyclehq/go-server-sdk.svg?style=social&label=Star&maxAge=2592000)](https://github.com/DevCycleHQ/go-server-sdk) +[//]: # (wizard-evaluate-start) + ## User Object The user object is required for all methods. This is the basis of how segmentation and bucketing decisions are made. @@ -29,6 +31,7 @@ value unless an error occurs. In that case it will return a variable value set t ```go variableValue, err := devcycleClient.VariableValue(user, "my-variable-key", "test") ``` +[//]: # (wizard-evaluate-end) `variableValue` is an `interface{}` - so you'll need to cast it to your proper variable type. When using `JSON` as the variable type, you'll have to have JSON to unmarshal it to a proper type instead of accessing it raw. diff --git a/docs/sdk/server-side-sdks/java/java-gettingstarted.md b/docs/sdk/server-side-sdks/java/java-gettingstarted.md index a18ac696..be3c1a18 100644 --- a/docs/sdk/server-side-sdks/java/java-gettingstarted.md +++ b/docs/sdk/server-side-sdks/java/java-gettingstarted.md @@ -9,6 +9,8 @@ sidebar_custom_props: { icon: material-symbols:rocket } [![Maven](https://badgen.net/maven/v/maven-central/com.devcycle/java-server-sdk)](https://search.maven.org/artifact/com.devcycle/java-server-sdk) [![GitHub](https://img.shields.io/github/stars/devcyclehq/java-server-sdk.svg?style=social&label=Star&maxAge=2592000)](https://github.com/DevCycleHQ/java-server-sdk) +[//]: # (wizard-initialize-start) + To use the DevCycle Java SDK, initialize a client object. ```java @@ -23,6 +25,8 @@ public class MyClass { } } ``` +[//]: # (wizard-initialize-end) + **NOTE: use `DevCycleCloudClient` for Cloud Bucketing mode.** diff --git a/docs/sdk/server-side-sdks/java/java-install.md b/docs/sdk/server-side-sdks/java/java-install.md index 9cf629b3..058d8a9e 100644 --- a/docs/sdk/server-side-sdks/java/java-install.md +++ b/docs/sdk/server-side-sdks/java/java-install.md @@ -37,6 +37,8 @@ ldd --version ::: +[//]: # (wizard-install-start) + ### Maven You can use the SDK in your Maven project by adding the following to your _pom.xml_: @@ -63,6 +65,7 @@ Alternatively you can use the SDK in your Gradle project by adding the following ```yaml implementation("com.devcycle:java-server-sdk:+") ``` +[//]: # (wizard-install-end) ## DNS Caching diff --git a/docs/sdk/server-side-sdks/java/java-openfeature.md b/docs/sdk/server-side-sdks/java/java-openfeature.md index 23cfa637..462b6d57 100644 --- a/docs/sdk/server-side-sdks/java/java-openfeature.md +++ b/docs/sdk/server-side-sdks/java/java-openfeature.md @@ -15,9 +15,41 @@ DevCycle provides a Java implementation of the [OpenFeature](https://openfeature [![Maven](https://badgen.net/maven/v/maven-central/com.devcycle/java-server-sdk)](https://search.maven.org/artifact/com.devcycle/java-server-sdk) [![GitHub](https://img.shields.io/github/stars/devcyclehq/java-server-sdk.svg?style=social&label=Star&maxAge=2592000)](https://github.com/DevCycleHQ/java-server-sdk) -## Usage +## Installation +The Provider implementation is built into the Java SDK. + +[//]: # (wizard-install-start) + +### Maven + +You can use the Java SDK in your Maven project by adding the following to your _pom.xml_: + +```xml + + com.devcycle + java-server-sdk + LATEST + compile + +``` -The Provider implementation is built into the Java SDK. See the [Java Server SDK Installation](https://docs.devcycle.com/sdk/server-side-sdks/java/java-local-install) documentation for more information on how to install and the SDK in your project. +:::info + +Refer to the latest version of the SDK on [maven central](https://maven.org/artifact/com.devcycle/java-server-sdk) if you would not prefer Maven or Gradle to pull the latest version automatically by using `+` + +::: + +### Gradle + +Alternatively you can use the SDK in your Gradle project by adding the following to _build.gradle_: + +```yaml +implementation("com.devcycle:java-server-sdk:+") +``` +[//]: # (wizard-install-end) + +## Usage +[//]: # (wizard-initialize-start) Start by creating and configuring the `DevCycleLocalClient`. Once the DevCycle client is configured, call the `getOpenFeatureProvider()` function to obtain the OpenFeature provider and set it into the OpenFeature API. @@ -38,13 +70,23 @@ public class OpenFeatureExample { // Get the OpenFeature client Client openFeatureClient = api.getClient(); - - // Retrieve a boolean flag from the OpenFeature client - Boolean variableValue = openFeatureClient.getBooleanValue("boolean-flag", false, new MutableContext("user-1234")); } } ``` +[//]: # (wizard-initialize-end) + +## Evaluate a Variable +[//]: # (wizard-evaluate-start) + +Use a Variable value by passing the Variable key, default value, and EvaluationContext to one of the OpenFeature flag evaluation methods. + +```java +// Retrieve a boolean flag from the OpenFeature client +Boolean variableValue = openFeatureClient.getBooleanValue("boolean-flag", false, new MutableContext("user-1234")); +``` +[//]: # (wizard-evaluate-end) + **NOTE: use `DevCycleCloudClient` \ `DevCycleCloudOptions` for Cloud Bucketing mode.** ### Required Targeting Key diff --git a/docs/sdk/server-side-sdks/java/java-usage.md b/docs/sdk/server-side-sdks/java/java-usage.md index 4f04b56d..175f33cd 100644 --- a/docs/sdk/server-side-sdks/java/java-usage.md +++ b/docs/sdk/server-side-sdks/java/java-usage.md @@ -9,6 +9,8 @@ sidebar_custom_props: { icon: material-symbols:toggle-on } [![Maven](https://badgen.net/maven/v/maven-central/com.devcycle/java-server-sdk)](https://search.maven.org/artifact/com.devcycle/java-server-sdk) [![GitHub](https://img.shields.io/github/stars/devcyclehq/java-server-sdk.svg?style=social&label=Star&maxAge=2592000)](https://github.com/DevCycleHQ/java-server-sdk) +[//]: # (wizard-evaluate-start) + ## DevCycleUser Object The user object is required for all methods. The only required field in the user object is userId. @@ -38,6 +40,7 @@ if (variableValue.booleanValue()) { // Old code here } ``` +[//]: # (wizard-evaluate-end) The default value can be of type `String`, `Boolean`, `Number`, or `Object`. diff --git a/docs/sdk/server-side-sdks/nestjs/nestjs-gettingstarted.md b/docs/sdk/server-side-sdks/nestjs/nestjs-gettingstarted.md index 63543a63..4566bc3d 100644 --- a/docs/sdk/server-side-sdks/nestjs/nestjs-gettingstarted.md +++ b/docs/sdk/server-side-sdks/nestjs/nestjs-gettingstarted.md @@ -9,6 +9,8 @@ sidebar_custom_props: { icon: material-symbols:rocket } [![Npm package version](https://badgen.net/npm/v/@devcycle/nestjs-server-sdk)](https://www.npmjs.com/package/@devcycle/nestjs-server-sdk) [![GitHub](https://img.shields.io/github/stars/devcyclehq/js-sdks.svg?style=social&label=Star&maxAge=2592000)](https://github.com/devcyclehq/js-sdks) +[//]: # (wizard-initialize-start) + To use the DevCycle Server SDK in your project, import the `DevCycleModule` from the `@devcycle/nestjs-server-sdk`. We recommend adding the module to the imports of your root app module, so that the DevCycle client is available globally within your application. @@ -59,6 +61,7 @@ DevCycleModule.forRoot({ } }) ``` +[//]: # (wizard-initialize-end) ## Initialization Options diff --git a/docs/sdk/server-side-sdks/nestjs/nestjs-install.md b/docs/sdk/server-side-sdks/nestjs/nestjs-install.md index 4fc01520..ba585088 100644 --- a/docs/sdk/server-side-sdks/nestjs/nestjs-install.md +++ b/docs/sdk/server-side-sdks/nestjs/nestjs-install.md @@ -12,10 +12,14 @@ sidebar_custom_props: { icon: material-symbols:install-desktop } Our library can be found on npm and installed by the following: #### NPM +[//]: # (wizard-install-start) + ``` npm install --save @devcycle/nestjs-server-sdk ``` +[//]: # (wizard-install-end) + #### Yarn ```bash diff --git a/docs/sdk/server-side-sdks/nestjs/nestjs-usage.md b/docs/sdk/server-side-sdks/nestjs/nestjs-usage.md index 42476f4f..015738d0 100644 --- a/docs/sdk/server-side-sdks/nestjs/nestjs-usage.md +++ b/docs/sdk/server-side-sdks/nestjs/nestjs-usage.md @@ -10,6 +10,8 @@ sidebar_custom_props: { icon: material-symbols:toggle-on } [![GitHub](https://img.shields.io/github/stars/devcyclehq/js-sdks.svg?style=social&label=Star&maxAge=2592000)](https://github.com/devcyclehq/js-sdks) ## DevCycle Client +[//]: # (wizard-evaluate-start) + With the DevCycleModule imported, the `DevCycleClient` can be injected into your controllers or providers. The Nest.js SDK is a wrapper for DevCycle's Node.js SDK. For more information about methods available on the DevCycleClient, see the [Node.js Usage documentation](/sdk/server-side-sdks/node/node-usage). @@ -34,6 +36,7 @@ export class MyController { } } ``` +[//]: # (wizard-evaluate-end) ## DevCycle Service With the DevCycleModule imported, the `DevCycleService` can be injected into your controllers or providers. The DevCycleService methods evaluate variables with the user returned from your [userFactory](/sdk/server-side-sdks/nestjs/nestjs-gettingstarted#user-factory), so you don't need to specify a user each time a method is called. diff --git a/docs/sdk/server-side-sdks/node/node-gettingstarted.md b/docs/sdk/server-side-sdks/node/node-gettingstarted.md index d2aceba1..82823375 100644 --- a/docs/sdk/server-side-sdks/node/node-gettingstarted.md +++ b/docs/sdk/server-side-sdks/node/node-gettingstarted.md @@ -9,6 +9,8 @@ sidebar_custom_props: { icon: material-symbols:rocket } [![Npm package version](https://badgen.net/npm/v/@devcycle/nodejs-server-sdk)](https://www.npmjs.com/package/@devcycle/nodejs-server-sdk) [![GitHub](https://img.shields.io/github/stars/devcyclehq/js-sdks.svg?style=social&label=Star&maxAge=2592000)](https://github.com/devcyclehq/js-sdks) +[//]: # (wizard-initialize-start) + To use the DevCycle Server SDK in your project, import the `@devcycle/nodejs-server-sdk` package and call `initializeDevCycle` with your DevCycle SDK server key. You may optionally `await` for the client to be initialized. @@ -22,6 +24,7 @@ const devcycleClient = await DevCycle.initializeDevCycle( '', ).onClientInitialized() ``` +[//]: # (wizard-initialize-end) Typescript Example: diff --git a/docs/sdk/server-side-sdks/node/node-install.md b/docs/sdk/server-side-sdks/node/node-install.md index cb96b40a..6c7b7b68 100644 --- a/docs/sdk/server-side-sdks/node/node-install.md +++ b/docs/sdk/server-side-sdks/node/node-install.md @@ -12,9 +12,12 @@ sidebar_custom_props: { icon: material-symbols:install-desktop } Our library can be found on npm and installed by the following: #### NPM +[//]: # (wizard-install-start) + ``` npm install --save @devcycle/nodejs-server-sdk ``` +[//]: # (wizard-install-end) #### Yarn diff --git a/docs/sdk/server-side-sdks/node/node-openfeature.md b/docs/sdk/server-side-sdks/node/node-openfeature.md index feb62adf..57f389d9 100644 --- a/docs/sdk/server-side-sdks/node/node-openfeature.md +++ b/docs/sdk/server-side-sdks/node/node-openfeature.md @@ -20,9 +20,12 @@ directly from the SDK using the `getOpenFeatureProvider()` method. Install the DevCycle NodeJS Server SDK and the OpenFeature Server SDK peer dependencies: #### NPM +[//]: # (wizard-install-start) + ```bash npm install --save @devcycle/nodejs-server-sdk @openfeature/server-sdk @openfeature/core ``` +[//]: # (wizard-install-end) #### Yarn @@ -32,6 +35,8 @@ yarn add @devcycle/nodejs-server-sdk @openfeature/server-sdk @openfeature/core ### Getting Started +[//]: # (wizard-initialize-start) + Initialize the DevCycle SDK and set the DevCycleProvider as the provider for OpenFeature: ```typescript @@ -47,13 +52,23 @@ const devcycleClient = initializeDevCycle(DEVCYCLE_SERVER_SDK_KEY) await OpenFeature.setProviderAndWait(await devcycleClient.getOpenFeatureProvider()) // Create the OpenFeature client openFeatureClient = OpenFeature.getClient() +``` +[//]: # (wizard-initialize-end) + +### Evaluate a Variable +[//]: # (wizard-evaluate-start) + +Use a Variable value by setting the EvaluationContext, then passing the Variable key and default value to one of the OpenFeature flag evaluation methods. + +```typescript // Set the context for the OpenFeature client, you can use 'targetingKey' or 'user_id' openFeatureClient.setContext({ targetingKey: 'node_sdk_test' }) - // Retrieve a boolean flag from the OpenFeature client const boolFlag = await openFeatureClient.getBooleanValue('boolean-flag', false) + ``` +[//]: # (wizard-evaluate-end) ### Passing DevCycleOptions to the DevCycleProvider diff --git a/docs/sdk/server-side-sdks/node/node-usage.md b/docs/sdk/server-side-sdks/node/node-usage.md index 485423a9..c891db96 100644 --- a/docs/sdk/server-side-sdks/node/node-usage.md +++ b/docs/sdk/server-side-sdks/node/node-usage.md @@ -9,6 +9,8 @@ sidebar_custom_props: { icon: material-symbols:toggle-on } [![Npm package version](https://badgen.net/npm/v/@devcycle/nodejs-server-sdk)](https://www.npmjs.com/package/@devcycle/nodejs-server-sdk) [![GitHub](https://img.shields.io/github/stars/devcyclehq/js-sdks.svg?style=social&label=Star&maxAge=2592000)](https://github.com/devcyclehq/js-sdks) +[//]: # (wizard-evaluate-start) + ## User Object The full user data must be passed into every method. The only required field is the `user_id`. @@ -40,6 +42,7 @@ if (value) { // Feature Flag on } ``` +[//]: # (wizard-evaluate-end) The default value can be of type string, boolean, number, or object. diff --git a/docs/sdk/server-side-sdks/php/php-gettingstarted.md b/docs/sdk/server-side-sdks/php/php-gettingstarted.md index ce583400..1d6d7151 100644 --- a/docs/sdk/server-side-sdks/php/php-gettingstarted.md +++ b/docs/sdk/server-side-sdks/php/php-gettingstarted.md @@ -12,6 +12,7 @@ sidebar_custom_props: { icon: material-symbols:rocket } Please follow the [installation procedure](/sdk/server-side-sdks/php/php-install) and then run the following: ## Initializing SDK +[//]: # (wizard-initialize-start) ```php require_once(__DIR__ . '/vendor/autoload.php'); @@ -35,3 +36,4 @@ try { echo 'Exception when calling DevCycleClient->allFeatures: ', $e->getMessage(), PHP_EOL; } ``` +[//]: # (wizard-initialize-end) diff --git a/docs/sdk/server-side-sdks/php/php-install.md b/docs/sdk/server-side-sdks/php/php-install.md index 94f3f1e4..07bcadec 100644 --- a/docs/sdk/server-side-sdks/php/php-install.md +++ b/docs/sdk/server-side-sdks/php/php-install.md @@ -12,6 +12,7 @@ sidebar_custom_props: { icon: material-symbols:install-desktop } Requires PHP 7.3 and later. ### Composer Installation +[//]: # (wizard-install-start) To install the bindings via [Composer](https://getcomposer.org/), add the following to `composer.json`: @@ -30,6 +31,7 @@ Once the composer install is complete, a `vendor` folder should be generated at ```php require_once(__DIR__ . '/vendor/autoload.php'); ``` +[//]: # (wizard-install-end) ## SDK Proxy diff --git a/docs/sdk/server-side-sdks/php/php-openfeature.md b/docs/sdk/server-side-sdks/php/php-openfeature.md index 153b74be..dc819f3c 100644 --- a/docs/sdk/server-side-sdks/php/php-openfeature.md +++ b/docs/sdk/server-side-sdks/php/php-openfeature.md @@ -21,7 +21,30 @@ to use the OpenFeature API. The OpenFeature Provider is included in the DevCycle SDK for PHP natively. It's compatible with both Cloud, and SDK proxy modes. +[//]: # (wizard-install-start) + +To install the bindings via [Composer](https://getcomposer.org/), add the following to `composer.json`: + +```json +{ + "require": { + "devcycle/php-server-sdk": "*" + } +} +``` + +Then run `composer install` + +Once the composer install is complete, a `vendor` folder should be generated at the root of your project. Include this at the start of your app index file: + +```php +require_once(__DIR__ . '/vendor/autoload.php'); +``` +[//]: # (wizard-install-end) + + ### Getting Started +[//]: # (wizard-initialize-start) Initialize the DevCycle SDK and set the DevCycleProvider as the provider for OpenFeature: @@ -35,6 +58,26 @@ $api = OpenFeatureAPI::getInstance(); $api->setProvider($devCycleClient->getOpenFeatureProvider()); $openFeatureClient = $api->getClient(); ``` +[//]: # (wizard-initialize-end) + +### Evaluate a Variable +[//]: # (wizard-evaluate-start) + +Use a Variable value by setting the EvaluationContext, then passing the Variable key and default value to one of the OpenFeature flag evaluation methods. + +```csharp +// Create a new user attribute object that can be used by OpenFeature as part of the flag evaluation process. +$user_attributes = new Attributes(array("user_id" => "my-user")); + +// Create a new evaluation context for the feature flag evaluations. This context is used to provide user or environment details for flag evaluations in OpenFeature. +$openfeature_context = new EvaluationContext(attributes: $user_attributes); + +// Use the OpenFeature client to get the string value of the "string-flag" feature flag. +$flag_value = $openfeature_client->getStringValue("string-flag", "default", $openfeature_context); + +``` +[//]: # (wizard-evaluate-end) + ### Required TargetingKey diff --git a/docs/sdk/server-side-sdks/php/php-usage.md b/docs/sdk/server-side-sdks/php/php-usage.md index a41ad580..4fcaa452 100644 --- a/docs/sdk/server-side-sdks/php/php-usage.md +++ b/docs/sdk/server-side-sdks/php/php-usage.md @@ -9,6 +9,8 @@ sidebar_custom_props: { icon: material-symbols:toggle-on } [![Packagist](https://badgen.net/packagist/v/devcycle/php-server-sdk/latest)](https://packagist.org/packages/devcycle/php-server-sdk) [![GitHub](https://img.shields.io/github/stars/devcyclehq/php-server-sdk.svg?style=social&label=Star&maxAge=2592000)](https://github.com/DevCycleHQ/php-server-sdk) +[//]: # (wizard-evaluate-start) + ## User Object The full user data must be passed into every method. The only required field is `user_id`. @@ -37,6 +39,7 @@ try { echo 'Exception when calling DevCycleClient->variableValue: ', $e->getMessage(), PHP_EOL; } ``` +[//]: # (wizard-evaluate-end) The default value can be of type string, boolean, number, or object. diff --git a/docs/sdk/server-side-sdks/python/python-gettingstarted.md b/docs/sdk/server-side-sdks/python/python-gettingstarted.md index bbba9e8c..78098538 100644 --- a/docs/sdk/server-side-sdks/python/python-gettingstarted.md +++ b/docs/sdk/server-side-sdks/python/python-gettingstarted.md @@ -12,6 +12,7 @@ sidebar_custom_props: { icon: material-symbols:rocket } ## Initializing Local Bucketing SDK Code sample for importing and setting up the DevCycleLocalClient. +[//]: # (wizard-initialize-start) ```python from devcycle_python_sdk import DevCycleLocalClient, DevCycleLocalOptions @@ -21,7 +22,7 @@ from devcycle_python_sdk.models.user import DevCycleUser options = DevCycleLocalOptions() # create an instance of the DevCycleLocalClient class -devcycle_client = DevCycleLocalClient('DEVCYCLE_SERVER_SDK_KEY', options) +devcycle_client = DevCycleLocalClient('', options) # all client functions require user data to be an instance of the DevCycleUser class user = DevCycleUser( @@ -30,6 +31,7 @@ user = DevCycleUser( country='CA' ) ``` +[//]: # (wizard-initialize-end) ## Initializing Cloud Bucketing SDK @@ -43,7 +45,7 @@ from devcycle_python_sdk.models.user import DevCycleUser options = DevCycleCloudOptions(enable_edge_db=True) # create an instance of the DevCycleCloudClient class -devcycle_client = DevCycleCloudClient('DEVCYCLE_SERVER_SDK_KEY', options) +devcycle_client = DevCycleCloudClient('', options) # all client functions require user data to be an instance of the DevCycleUser class user = DevCycleUser( diff --git a/docs/sdk/server-side-sdks/python/python-install.md b/docs/sdk/server-side-sdks/python/python-install.md index b4690f4d..0bc3129d 100644 --- a/docs/sdk/server-side-sdks/python/python-install.md +++ b/docs/sdk/server-side-sdks/python/python-install.md @@ -9,6 +9,8 @@ sidebar_custom_props: { icon: material-symbols:install-desktop } [![PyPI](https://badgen.net/pypi/v/devcycle-python-server-sdk)](https://pypi.org/project/devcycle-python-server-sdk/) [![GitHub](https://img.shields.io/github/stars/devcyclehq/python-server-sdk.svg?style=social&label=Star&maxAge=2592000)](https://github.com/DevCycleHQ/python-server-sdk) +[//]: # (wizard-install-start) + The DevCycle Python Server SDK requires For Python 3.8 and above. ```shell-session @@ -22,3 +24,4 @@ Then import the package: ```python import devcycle_python_sdk ``` +[//]: # (wizard-install-end) diff --git a/docs/sdk/server-side-sdks/python/python-openfeature.md b/docs/sdk/server-side-sdks/python/python-openfeature.md index 82a0fd29..38e9d5cd 100644 --- a/docs/sdk/server-side-sdks/python/python-openfeature.md +++ b/docs/sdk/server-side-sdks/python/python-openfeature.md @@ -17,6 +17,7 @@ DevCycle provides a Python implementation of the [OpenFeature](https://openfeatu ## Usage ### Installation +[//]: # (wizard-install-start) Install the OpenFeature Python SDK and DevCycle Provider: @@ -26,7 +27,10 @@ $ pip install devcycle-python-server-sdk (you may need to run `pip` with root permission: `sudo pip install devcycle-python-server-sdk`) +[//]: # (wizard-install-end) + ### Getting Started +[//]: # (wizard-initialize-start) Initialize the DevCycle SDK and set the DevCycleProvider as the provider for OpenFeature: @@ -40,7 +44,7 @@ from openfeature.evaluation_context import EvaluationContext options = DevCycleLocalOptions() # create an instance of the DevCycleLocalClient class -devcycle_client = DevCycleLocalClient('DEVCYCLE_SERVER_SDK_KEY', options) +devcycle_client = DevCycleLocalClient('', options) # set the provider for OpenFeature api.set_provider(devcycle_client.get_openfeature_provider()) @@ -48,6 +52,26 @@ api.set_provider(devcycle_client.get_openfeature_provider()) # get the OpenFeature client open_feature_client = api.get_client() ``` +[//]: # (wizard-initialize-end) + +### Evaluate a Variable +Use a Variable value by setting the EvaluationContext, then passing the Variable key and default value to one of the OpenFeature flag evaluation methods. + +[//]: # (wizard-evaluate-start) + +```python +context = EvaluationContext( + targeting_key="test-1234", + attributes={ + "email": "test-user@domain.com", + "name": "Test User", + }, + ) +open_feature_client.context = context + +flag_value = client.get_boolean_value("boolean_flag", False) +``` +[//]: # (wizard-evaluate-end) ### Required Targeting Key diff --git a/docs/sdk/server-side-sdks/python/python-usage.md b/docs/sdk/server-side-sdks/python/python-usage.md index cbae0863..5accfdfe 100644 --- a/docs/sdk/server-side-sdks/python/python-usage.md +++ b/docs/sdk/server-side-sdks/python/python-usage.md @@ -9,6 +9,8 @@ sidebar_custom_props: { icon: material-symbols:toggle-on } [![PyPI](https://badgen.net/pypi/v/devcycle-python-server-sdk)](https://pypi.org/project/devcycle-python-server-sdk/) [![GitHub](https://img.shields.io/github/stars/devcyclehq/python-server-sdk.svg?style=social&label=Star&maxAge=2592000)](https://github.com/DevCycleHQ/python-server-sdk) +[//]: # (wizard-evaluate-start) + ## DevCycleUser Object The full user data must be passed into every method. The only required field is `user_id`. @@ -42,6 +44,7 @@ try: except Exception as e: print(f"Exception when calling DevCycleLocalClient->variable_value: {e}") ``` +[//]: # (wizard-evaluate-end) The default value can be of type string, boolean, number, or dictionary. @@ -142,7 +145,7 @@ from devcycle_python_sdk.models.user import User options = DevCycleCloudOptions(enable_edge_db=True) # create an instance of the DevCycleCloudClient class -devcycle_client = DevCycleCloudClient('DEVCYCLE_SERVER_SDK_KEY', options) +devcycle_client = DevCycleCloudClient('', options) # all functions require user data to be an instance of the User class user = User( diff --git a/docs/sdk/server-side-sdks/ruby/ruby-gettingstarted.md b/docs/sdk/server-side-sdks/ruby/ruby-gettingstarted.md index 1f759ec6..2a674f8b 100644 --- a/docs/sdk/server-side-sdks/ruby/ruby-gettingstarted.md +++ b/docs/sdk/server-side-sdks/ruby/ruby-gettingstarted.md @@ -16,6 +16,8 @@ Please note; the default mode is to use Local Bucketing - to use cloud bucketing The last argument to `DevCycle::Client.new` tells the sdk whether you want to wait for initialization - meaning that the method will block until the first config is fetched and set successfully or an unrecoverable error occurs during initialization. +[//]: # (wizard-initialize-start) + ```ruby # Load the gem require 'devcycle-ruby-server-sdk' @@ -33,6 +35,7 @@ rescue DevCycle::ApiError => e end ``` +[//]: # (wizard-initialize-end) ## Configure SDK diff --git a/docs/sdk/server-side-sdks/ruby/ruby-install.md b/docs/sdk/server-side-sdks/ruby/ruby-install.md index 83a3126c..e54a3212 100644 --- a/docs/sdk/server-side-sdks/ruby/ruby-install.md +++ b/docs/sdk/server-side-sdks/ruby/ruby-install.md @@ -9,8 +9,11 @@ sidebar_custom_props: { icon: material-symbols:install-desktop } [![RubyGems](https://badgen.net/rubygems/v/devcycle-ruby-server-sdk/latest)](https://rubygems.org/gems/devcycle-ruby-server-sdk) [![GitHub](https://img.shields.io/github/stars/devcyclehq/ruby-server-sdk.svg?style=social&label=Star&maxAge=2592000)](https://github.com/DevCycleHQ/ruby-server-sdk) +[//]: # (wizard-install-start) + Install the gem: ```ruby gem install devcycle-ruby-server-sdk ``` +[//]: # (wizard-install-end) diff --git a/docs/sdk/server-side-sdks/ruby/ruby-usage.md b/docs/sdk/server-side-sdks/ruby/ruby-usage.md index e77204dd..ec746c08 100644 --- a/docs/sdk/server-side-sdks/ruby/ruby-usage.md +++ b/docs/sdk/server-side-sdks/ruby/ruby-usage.md @@ -9,6 +9,8 @@ sidebar_custom_props: { icon: simple-icons:ruby } [![RubyGems](https://badgen.net/rubygems/v/devcycle-ruby-server-sdk/latest)](https://rubygems.org/gems/devcycle-ruby-server-sdk) [![GitHub](https://img.shields.io/github/stars/devcyclehq/ruby-server-sdk.svg?style=social&label=Star&maxAge=2592000)](https://github.com/DevCycleHQ/ruby-server-sdk) +[//]: # (wizard-evaluate-start) + ## User Object The full user data must be passed into every method. The only required field is `user_id`. @@ -37,6 +39,7 @@ rescue puts "Exception when calling DevCycle::Client->variable_value" end ``` +[//]: # (wizard-evaluate-end) The default value can be of type string, boolean, number, or object.