Skip to content

Commit

Permalink
docs: rebuild doc v1.30.0
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Poignant <thomas.poignant@gofeatureflag.org>
  • Loading branch information
thomaspoignant committed Jun 20, 2024
1 parent ff66030 commit 5993193
Show file tree
Hide file tree
Showing 16 changed files with 211 additions and 55 deletions.
2 changes: 1 addition & 1 deletion website/.ci/sdkVersions.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func main() {
log.Fatal(err)
}

err = os.WriteFile("./website/sdk-versions.json", content, 0644)
err = os.WriteFile("./website/static/sdk-versions.json", content, 0644)
if err != nil {
log.Fatal(err)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: How to use the OpenFeature Kotlin SDK for your Android application
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import versions from '../../../sdk-versions.json';
import versions from '@site/static/sdk-versions.json';
import CodeBlock from '@theme/CodeBlock';

[![Maven Central Version](https://img.shields.io/maven-central/v/org.gofeatureflag.openfeature/gofeatureflag-kotlin-provider?color=blue&style=flat-square)](https://search.maven.org/artifact/org.gofeatureflag.openfeature/gofeatureflag-kotlin-provider)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ sidebar_position: 20
title: GO
description: How to use the OpenFeature GO SDK
---
import versions from '../../../sdk-versions.json';

# GO SDK usage
[![GO Version](https://img.shields.io/badge/dynamic/json?color=blue&style=flat-square&url=https%3A%2F%2Fproxy.golang.org%2Fgithub.51.al%2Fopen-feature%2Fgo-sdk-contrib%2Fproviders%2Fgo-feature-flag%2F%40latest&query=%24.Version&label=GO)](https://github.com/open-feature/go-sdk-contrib/tree/main/providers/go-feature-flag)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: How to use the OpenFeature JAVA SDK
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import versions from '../../../sdk-versions.json';
import versions from '@site/static/sdk-versions.json';
import CodeBlock from '@theme/CodeBlock';

# JAVA SDK usage
Expand Down
1 change: 1 addition & 0 deletions website/static/sdk-versions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"maven":{"sdk":"1.8.0","providerKt":"0.0.1-beta.2","providerJava":"0.2.21","android":"0.3.0"},"npm":{"core":"1.3.0","webSDK":"1.2.1","providerServer":"0.7.0","providerWeb":"0.2.0"},"pypi":{"sdk":"0.7.0","provider":"0.2.0"},"nuget":{"sdk":"1.5.1","provider":"0.1.6"},"go":{"provider":"v0.1.37","sdk":"v1.12.0"}}
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
---
sidebar_position: 51
sidebar_position: 30
title: Android / Kotlin
description: How to use the OpenFeature Kotlin SDK for your Android application
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import versions from '@site/static/sdk-versions.json';
import CodeBlock from '@theme/CodeBlock';


![Static Badge](https://img.shields.io/badge/status-experimental-red)
[![Maven Central Version](https://img.shields.io/maven-central/v/org.gofeatureflag.openfeature/gofeatureflag-kotlin-provider?color=blue&style=flat-square)](https://search.maven.org/artifact/org.gofeatureflag.openfeature/gofeatureflag-kotlin-provider)
![Static Badge](https://img.shields.io/badge/status-experimental-red?style=flat-square)

This OpenFeature provider has a Kotlin implementation for Android to communicate with the GO Feature
Flag Server.
Expand All @@ -32,18 +34,35 @@ the [`Java` provider](/docs/openfeature_sdk/server_providers/openfeature_java).
```json
implementation("org.gofeatureflag.openfeature:gofeatureflag-kotlin-provider:0.0.1-beta.1")
```
<CodeBlock
language="toml"
showLineNumbers>
{
`api("dev.openfeature:android-sdk:${versions.maven.android}")
implementation("org.gofeatureflag.openfeature:gofeatureflag-kotlin-provider${versions.maven.providerKt}")`
}
</CodeBlock>

</TabItem>
<TabItem value="maven" label="maven">

```xml
<dependency>
<groupId>org.gofeatureflag.openfeature</groupId>
<artifactId>gofeatureflag-kotlin-provider</artifactId>
<version>:0.0.1-beta.1</version>
</dependency>
```

</TabItem>
<TabItem value="maven" label="maven">
<CodeBlock
language="xml"
showLineNumbers>
{
`<dependency>
<groupId>dev.openfeature</groupId>
<artifactId>sdk</artifactId>
<artifactId>${versions.maven.android}</artifactId>
</dependency>
<dependency>
<groupId>org.gofeatureflag.openfeature</groupId>
<artifactId>gofeatureflag-kotlin-provider</artifactId>
<version>${versions.maven.providerKt}</version>
</dependency>`
}
</CodeBlock>
</TabItem>
</Tabs>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
---
sidebar_position: 51
sidebar_position: 10
title: Javascript / Typescript
description: How to use the OpenFeature Javascript web SDK for your client application
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# Javascript / Typescript SDK usage
[![NPM Version](https://img.shields.io/npm/v/%40openfeature%2Fgo-feature-flag-web-provider?color=blue&style=flat-square)](https://www.npmjs.com/package/@openfeature/go-feature-flag-web-provider)
![NPM Downloads](https://img.shields.io/npm/d18m/%40openfeature%2Fgo-feature-flag-web-provider?style=flat-square)


This page describes how to use the OpenFeature Javascript web SDK for your client application.

## About this provider
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
---
sidebar_position: 11
title: React
description: How to use the OpenFeature Javascript React SDK for your React application
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# React SDK usage
[![NPM Version](https://img.shields.io/npm/v/%40openfeature%2Fgo-feature-flag-web-provider?color=blue&style=flat-square)](https://www.npmjs.com/package/@openfeature/go-feature-flag-web-provider)
![NPM Downloads](https://img.shields.io/npm/d18m/%40openfeature%2Fgo-feature-flag-web-provider?style=flat-square)


This page describes how to use the OpenFeature React SDK for your client application.

## About this provider
OpenFeature React SDK allows you to connect to your GO Feature Flag instance with the `@openfeature/react-sdk`.

If you work with React the `@openfeature/react-sdk` will give you a better integration with your React application.
To integrate it with GO Feature Flag, you need to use the `@openfeature/go-feature-flag-web-provider` provider.



## Install the provider

```shell
npm install @openfeature/go-feature-flag-web-provider
npm install @openfeature/web-sdk
npm install @openfeature/react-sdk
npm install @openfeature/core
```

## How to use the provider?

### OpenFeatureProvider context provider
The OpenFeatureProvider is a React context provider which represents a scope for feature flag evaluations within a React application.
It binds an OpenFeature client to all evaluations within child components, and allows the use of evaluation hooks.

```typescript
import { EvaluationContext, OpenFeature, OpenFeatureProvider, useFlag } from "@openfeature/react-sdk";
import { GoFeatureFlagWebProvider } from "@openfeature/go-feature-flag-web-provider";

const goFeatureFlagWebProvider = new GoFeatureFlagWebProvider({
endpoint: "http://localhost:1031"
});

// Set the initial context for your evaluations
OpenFeature.setContext({
targetingKey: "user-1",
admin: false
});

// Instantiate and set our provider (be sure this only happens once)!
// Note: there's no need to await its initialization, the React SDK handles re-rendering and suspense for you!
OpenFeature.setProvider(goFeatureFlagWebProvider);

// Enclose your content in the configured provider
function App() {
return (
<OpenFeatureProvider>
<Page />
</OpenFeatureProvider>
);
}
```

### Evaluation hooks

Within the provider, you can use the various evaluation hooks to evaluate flags.
```typescript
function Page() {
// Use the "query-style" flag evaluation hook, specifying a flag-key and a default value.
const { value: showNewMessage } = useFlag('new-message', true);
return (
<div className="App">
<header className="App-header">
{showNewMessage ? <p>Welcome to this OpenFeature-enabled React app!</p> : <p>Welcome to this React app.</p>}
</header>
</div>
)
}
```

### Advanced usage
You can check the [OpenFeature React SDK documentation](https://openfeature.dev/docs/reference/technologies/client/web/react) to see all the available hooks and how to use them.

## Available options
Check the available options for the provider in the [web provider page](./openfeature_javascript).

## Example
If you want to see some code, you can check the [example](https://github.com/thomaspoignant/go-feature-flag/tree/main/examples/openfeature_react) in the GO Feature Flag repository.

## Contribute to the provider
You can find the source of the provider in the [`open-feature/js-sdk-contrib`](https://github.com/open-feature/js-sdk-contrib/tree/main/libs/providers/go-feature-flag-web) repository.
39 changes: 31 additions & 8 deletions website/versioned_docs/version-v1.30.0/openfeature_sdk/sdk.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,35 +23,45 @@ Rest assured, working with OpenFeature SDKs alongside GO Feature Flag providers
title:"GO",
badges:["Server"],
docLink: "./server_providers/openfeature_go",
content: <SdkCardContent features={["remoteEval", "localCache"]}/>
content: <SdkCardContent
badgeUrl={"https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fproxy.golang.org%2Fgithub.51.al%2Fopen-feature%2Fgo-sdk-contrib%2Fproviders%2Fgo-feature-flag%2F%40latest&query=%24.Version&label=GO&color=blue&style=flat-square"}
features={["remoteEval", "localCache"]}/>
},
{
logoCss: "devicon-nodejs-plain colored",
title:"Node.JS",
badges:["Server"],
docLink: "./server_providers/openfeature_javascript",
content: <SdkCardContent features={["remoteEval", "localCache"]}/>
content: <SdkCardContent
badgeUrl={"https://img.shields.io/npm/v/%40openfeature%2Fgo-feature-flag-provider?color=blue&style=flat-square"}
features={["remoteEval", "localCache"]}/>
},
{
logoCss: "devicon-java-plain colored",
title:"Java / Kotlin",
badges:["Server"],
docLink: "./server_providers/openfeature_java",
content: <SdkCardContent features={["remoteEval", "localCache"]}/>
content: <SdkCardContent
badgeUrl={"https://img.shields.io/maven-central/v/dev.openfeature.contrib.providers/go-feature-flag?color=blue&style=flat-square"}
features={["remoteEval", "localCache", "dynamicRefresh"]}/>
},
{
logoCss: "devicon-dot-net-plain-wordmark colored",
title:".Net",
badges:["Server"],
docLink: "./server_providers/openfeature_javascript",
content: <SdkCardContent features={["remoteEval"]}/>
docLink: "./server_providers/openfeature_dotnet",
content: <SdkCardContent
badgeUrl={"https://img.shields.io/nuget/v/OpenFeature.Contrib.GOFeatureFlag?color=blue&style=flat-square"}
features={["remoteEval"]}/>
},
{
logoCss: "devicon-python-plain colored",
title:"Python",
badges:["Server"],
docLink: "./server_providers/openfeature_python",
content: <SdkCardContent features={["remoteEval", "localCache", "dynamicRefresh"]}/>
content: <SdkCardContent
badgeUrl={"https://img.shields.io/pypi/v/gofeatureflag-python-provider?color=blue&style=flat-square"}
features={["remoteEval", "localCache", "dynamicRefresh"]}/>
}
]}/>

Expand All @@ -62,15 +72,28 @@ Rest assured, working with OpenFeature SDKs alongside GO Feature Flag providers
title:"Typescript",
badges:["Client"],
docLink: "./client_providers/openfeature_javascript",
content: <SdkCardContent features={["remoteEval", "localCache", "dynamicRefresh"]}/>
content: <SdkCardContent
badgeUrl={"https://img.shields.io/npm/v/%40openfeature%2Fgo-feature-flag-web-provider?color=blue&style=flat-square"}
features={["remoteEval", "localCache", "dynamicRefresh"]}/>
},
{
logoCss: "devicon-react-original-wordmark colored",
title:"React",
badges:["Client"],
docLink: "./client_providers/openfeature_react",
content: <SdkCardContent
badgeUrl={"https://img.shields.io/npm/v/%40openfeature%2Fgo-feature-flag-web-provider?color=blue&style=flat-square"}
features={["remoteEval", "localCache", "dynamicRefresh"]}/>
},
{
logoCss: "devicon-android-plain colored",
title:"Android / Kotlin",
badges:["Client"],
docLink: "./client_providers/openfeature_android",
warningBadges: ["experimental"],
content: <SdkCardContent features={["remoteEval", "localCache", "dynamicRefresh"]}/>
content: <SdkCardContent
badgeUrl={"https://img.shields.io/maven-central/v/org.gofeatureflag.openfeature/gofeatureflag-kotlin-provider?color=blue&style=flat-square"}
features={["remoteEval", "localCache", "dynamicRefresh"]}/>
}
]}/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ import TabItem from '@theme/TabItem';


# .Net SDK usage
[![NuGet Version](https://img.shields.io/nuget/v/OpenFeature.Contrib.GOFeatureFlag?color=blue&style=flat-square)](https://nuget.info/packages/OpenFeature.Contrib.GOFeatureFlag)
![NuGet Downloads](https://img.shields.io/nuget/dt/OpenFeature.Contrib.GOFeatureFlag?style=flat-square)


## Install dependencies

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ description: How to use the OpenFeature GO SDK
---

# GO SDK usage
[![GO Version](https://img.shields.io/badge/dynamic/json?color=blue&style=flat-square&url=https%3A%2F%2Fproxy.golang.org%2Fgithub.51.al%2Fopen-feature%2Fgo-sdk-contrib%2Fproviders%2Fgo-feature-flag%2F%40latest&query=%24.Version&label=GO)](https://github.com/open-feature/go-sdk-contrib/tree/main/providers/go-feature-flag)


## Install dependencies

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,43 +5,52 @@ description: How to use the OpenFeature JAVA SDK
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import versions from '@site/static/sdk-versions.json';
import CodeBlock from '@theme/CodeBlock';

# JAVA SDK usage
[![Maven Central Version](https://img.shields.io/maven-central/v/dev.openfeature.contrib.providers/go-feature-flag?color=blue&style=flat-square)](https://search.maven.org/artifact/dev.openfeature.contrib.providers/go-feature-flag)

## Install dependencies

The first things we will do is install the **Open Feature SDK** and the **GO Feature Flag provider**.
The first thing we will do is install the **Open Feature SDK** and the **GO Feature Flag provider**.


<Tabs groupId="code">
<TabItem value="maven" label="maven">

```xml
<dependency>
<CodeBlock
language="xml"
showLineNumbers>
{
`<dependency>
<groupId>dev.openfeature</groupId>
<artifactId>sdk</artifactId>
<version>[1,)</version>
<artifactId>${versions.maven.sdk}</artifactId>
</dependency>
<dependency>
<groupId>dev.openfeature.contrib.providers</groupId>
<artifactId>go-feature-flag</artifactId>
<version>[0,)</version>
</dependency>
```
<version>${versions.maven.providerJava}</version>
</dependency>`
}
</CodeBlock>

</TabItem>
<TabItem value="gradle" label="gradle">

```gradle
implementation group: 'dev.openfeature', name: 'javasdk', version: '0.+'
implementation group: 'dev.openfeature.contrib.providers', name: 'go-feature-flag', version: '0.+'
```
<CodeBlock
language="toml"
showLineNumbers>
{
`implementation group: 'dev.openfeature', name: 'javasdk', version: '${versions.maven.sdk}'
implementation group: 'dev.openfeature.contrib.providers', name: 'go-feature-flag', version: '${versions.maven.providerJava}'`}
</CodeBlock>

</TabItem>
</Tabs>


## Initialize your Open Feature client
To evaluate the flags you need to have an Open Feature configured in you app.
To evaluate the flag you need to have an Open Feature configured in your app.
This code block shows you how you can create a client that you can use in your application.

<Tabs groupId="code">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ description: How to use the OpenFeature Javascript SDK
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';



# Node.js
[![NPM Version](https://img.shields.io/npm/v/%40openfeature%2Fgo-feature-flag-provider?color=blue&style=flat-square)](https://www.npmjs.com/package/@openfeature/go-feature-flag-provider)
![NPM Downloads](https://img.shields.io/npm/d18m/%40openfeature%2Fgo-feature-flag-provider?style=flat-square)


## Install dependencies

Expand Down
Loading

0 comments on commit 5993193

Please sign in to comment.