Skip to content

Commit

Permalink
Add tags for install wizard to all server sdks (#634)
Browse files Browse the repository at this point in the history
  • Loading branch information
emmawillis authored Apr 26, 2024
1 parent 70ac7ca commit ecb7e70
Show file tree
Hide file tree
Showing 33 changed files with 268 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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('<DEVCYCLE_CLIENT_SDK_KEY>')
// 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
Expand Down Expand Up @@ -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('<DEVCYCLE_CLIENT_SDK_KEY>', options)
await OpenFeature.setProviderAndWait(devcycleProvider)
```

Expand Down
4 changes: 2 additions & 2 deletions docs/sdk/client-side-sdks/react/react-openfeature.md
Original file line number Diff line number Diff line change
Expand Up @@ -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('<DEVCYCLE_CLIENT_SDK_KEY>'))

function App() {
return (
Expand Down Expand Up @@ -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('<DEVCYCLE_CLIENT_SDK_KEY>', options)
await OpenFeature.setProviderAndWait(devcycleProvider)
```

Expand Down
4 changes: 2 additions & 2 deletions docs/sdk/client-side-sdks/react/react-usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions docs/sdk/server-side-sdks/dotnet/dotnet-gettingstarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ namespace Example {
```

## Local Bucketing - Initializing SDK
[//]: # (wizard-initialize-start)

To start, initialize a client using the SDK key.

Expand All @@ -53,6 +54,7 @@ namespace Example {
}
}
```
[//]: # (wizard-initialize-end)

### Initialization With Callback

Expand Down
4 changes: 4 additions & 0 deletions docs/sdk/server-side-sdks/dotnet/dotnet-install.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down
42 changes: 42 additions & 0 deletions docs/sdk/server-side-sdks/dotnet/dotnet-openfeature.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down Expand Up @@ -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.
Expand Down
3 changes: 3 additions & 0 deletions docs/sdk/server-side-sdks/dotnet/dotnet-usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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`.

Expand Down
3 changes: 3 additions & 0 deletions docs/sdk/server-side-sdks/go/go-gettingstarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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.
Expand Down
3 changes: 3 additions & 0 deletions docs/sdk/server-side-sdks/go/go-install.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
16 changes: 15 additions & 1 deletion docs/sdk/server-side-sdks/go/go-openfeature.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
3 changes: 3 additions & 0 deletions docs/sdk/server-side-sdks/go/go-usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand Down
4 changes: 4 additions & 0 deletions docs/sdk/server-side-sdks/java/java-gettingstarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -23,6 +25,8 @@ public class MyClass {
}
}
```
[//]: # (wizard-initialize-end)


**NOTE: use `DevCycleCloudClient` for Cloud Bucketing mode.**

Expand Down
3 changes: 3 additions & 0 deletions docs/sdk/server-side-sdks/java/java-install.md
Original file line number Diff line number Diff line change
Expand Up @@ -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_:
Expand All @@ -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

Expand Down
52 changes: 47 additions & 5 deletions docs/sdk/server-side-sdks/java/java-openfeature.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
<dependency>
<groupId>com.devcycle</groupId>
<artifactId>java-server-sdk</artifactId>
<version>LATEST</version>
<scope>compile</scope>
</dependency>
```

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.

Expand All @@ -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
Expand Down
3 changes: 3 additions & 0 deletions docs/sdk/server-side-sdks/java/java-usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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`.

Expand Down
3 changes: 3 additions & 0 deletions docs/sdk/server-side-sdks/nestjs/nestjs-gettingstarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -59,6 +61,7 @@ DevCycleModule.forRoot({
}
})
```
[//]: # (wizard-initialize-end)

## Initialization Options

Expand Down
Loading

0 comments on commit ecb7e70

Please sign in to comment.