### Query Documentation API Source: https://docs.hypertune.com/sdk-reference/shut-down This example shows how to query the documentation dynamically using an HTTP GET request. Append the `ask` query parameter with your question to retrieve specific information. ```http GET https://docs.hypertune.com/sdk-reference/shut-down.md?ask= ``` -------------------------------- ### Install hypertune-go-gen Source: https://docs.hypertune.com/getting-started/go-quickstart Install the hypertune-go-gen tool using the Go toolchain. ```bash go get -tool github.com/hypertunehq/hypertune-go/cmd/hypertune-go-gen ``` -------------------------------- ### Install Hypertune with npm Source: https://docs.hypertune.com/getting-started/javascript-quickstart Install the Hypertune JavaScript SDK using npm. ```bash npm install hypertune ``` -------------------------------- ### Install Hypertune with yarn Source: https://docs.hypertune.com/getting-started/javascript-quickstart Install the Hypertune JavaScript SDK using yarn. ```bash yarn add hypertune ``` -------------------------------- ### Install Hypertune with npm Source: https://docs.hypertune.com/getting-started/next.js-app-router-quickstart Install the hypertune and server-only packages using npm. ```bash npm install hypertune server-only ``` -------------------------------- ### Install Hypertune with pnpm Source: https://docs.hypertune.com/getting-started/next.js-app-router-quickstart Install the hypertune and server-only packages using pnpm. ```bash pnpm add hypertune server-only ``` -------------------------------- ### Install Hypertune with pnpm Source: https://docs.hypertune.com/getting-started/javascript-quickstart Install the Hypertune JavaScript SDK using pnpm. ```bash pnpm add hypertune ``` -------------------------------- ### Install Hypertune CLI Source: https://docs.hypertune.com/getting-started/python-quickstart Install the Hypertune Command Line Interface (CLI) using a curl script. This CLI is used for generating clients and managing your Hypertune setup. ```bash curl -fsSL https://app.hypertune.com/install-cli.sh | sh ``` -------------------------------- ### Install Hypertune CLI Source: https://docs.hypertune.com/getting-started/node.js-quickstart Install the Hypertune command-line interface globally using npm. ```bash npm install -g hypertune ``` -------------------------------- ### Get help for Hypertune CLI with npm Source: https://docs.hypertune.com/sdk-reference/type-safe-client-generation Run this command to view all available options and commands for the Hypertune CLI when using npm. ```bash npx hypertune --help ``` -------------------------------- ### Use Hypertune client in Rust Source: https://docs.hypertune.com/getting-started/rust-quickstart Example of using the generated Hypertune client in a Rust application. It demonstrates creating a source, setting up context, waiting for initialization, getting a flag value, and closing the client. ```rust mod hypertune; fn main() { let root_node = hypertune::create_source(hypertune::VariableValues {}, None) .unwrap() .root(hypertune::RootArgs { context: hypertune::Context { environment: hypertune::Environment::DEVELOPMENT, user: hypertune::User { id: "test_id".to_string(), name: "Test".to_string(), email: "test@test.com".to_string(), }, }, }); root_node.wait_for_initialization(); let example_flag = root_node.exampleFlag().get(false); root_node.close(); } ``` -------------------------------- ### Querying Documentation Source: https://docs.hypertune.com/getting-started/react-quickstart Perform an HTTP GET request to query the documentation dynamically. Include your question as the 'ask' query parameter. ```bash GET https://docs.hypertune.com/getting-started/react-quickstart.md?ask= ``` -------------------------------- ### Install hypertune-sdk Source: https://docs.hypertune.com/getting-started/python-quickstart Install the Hypertune Python SDK using pip. This is the first step to integrate Hypertune into your Python application. ```bash pip install hypertune-sdk ``` -------------------------------- ### Install Dependencies with pnpm Source: https://docs.hypertune.com/getting-started/next.js-app-router-quickstart Install the necessary packages for integrating Hypertune with Vercel's Flags SDK using pnpm. ```bash pnpm add flags @flags-sdk/hypertune @vercel/edge-config ``` -------------------------------- ### Install @vercel/edge-config with pnpm Source: https://docs.hypertune.com/getting-started/next.js-pages-router-quickstart Install the @vercel/edge-config package using pnpm. ```bash pnpm add @vercel/edge-config ``` -------------------------------- ### Query Documentation via HTTP GET Source: https://docs.hypertune.com/example-apps/next.js-and-vercel-example-app To get information not explicitly on the page, make an HTTP GET request to the page URL with an 'ask' query parameter. The response includes a direct answer and relevant excerpts. ```bash GET https://docs.hypertune.com/example-apps/next.js-and-vercel-example-app.md?ask= ``` -------------------------------- ### Install Dependencies with npm Source: https://docs.hypertune.com/getting-started/next.js-app-router-quickstart Install the necessary packages for integrating Hypertune with Vercel's Flags SDK using npm. ```bash npm install flags @flags-sdk/hypertune @vercel/edge-config ``` -------------------------------- ### Install @vercel/edge-config with npm Source: https://docs.hypertune.com/getting-started/next.js-pages-router-quickstart Install the @vercel/edge-config package using npm. ```bash npm install @vercel/edge-config ``` -------------------------------- ### Install dotenv and types with npm Source: https://docs.hypertune.com/getting-started/javascript-quickstart Install the dotenv package and its types for loading environment variables using npm. ```bash npm install dotenv npm install -D @types/dotenv ``` -------------------------------- ### HTTP GET Request for Querying Documentation Source: https://docs.hypertune.com/concepts/schema Demonstrates how to query the documentation dynamically by appending an 'ask' query parameter to the page URL. ```http GET https://docs.hypertune.com/concepts/schema.md?ask= ``` -------------------------------- ### Basic Setup with getServerSideProps Source: https://docs.hypertune.com/getting-started/next.js-pages-router-quickstart This snippet shows the fundamental setup for using Hypertune within `getServerSideProps` in a Next.js Pages Router application. It fetches Hypertune data and provides it to the client-side components. ```tsx import { GetServerSideProps, InferGetServerSidePropsType, } from 'next' import ExampleComponent from '@/components/ExampleComponent' import { DehydratedState, RootArgs } from '@/generated/hypertune' import { HypertuneHydrator, HypertuneRootProvider, } from '@/generated/hypertune.react' import getHypertune from '@/lib/getHypertune' type Props = { dehydratedState: DehydratedState | null rootArgs: RootArgs } export const getServerSideProps = (async () => { const hypertune = await getHypertune() const dehydratedState = hypertune.dehydrate() const rootArgs = hypertune.getRootArgs() return { props: { dehydratedState, rootArgs } } }) satisfies GetServerSideProps export default function Page({ dehydratedState, rootArgs, }: InferGetServerSidePropsType) { return ( ) } ``` -------------------------------- ### Query Documentation Dynamically Source: https://docs.hypertune.com/entitlements/overview To get information not explicitly on the page, query the documentation using an HTTP GET request with the `ask` query parameter. The response includes direct answers and relevant excerpts. ```http GET https://docs.hypertune.com/entitlements/overview.md?ask= ``` -------------------------------- ### Query Documentation via HTTP GET Source: https://docs.hypertune.com/getting-started/javascript-quickstart Send an HTTP GET request to a documentation URL with the 'ask' query parameter to ask a question. The response will include a direct answer and relevant documentation excerpts. ```http GET https://docs.hypertune.com/getting-started/javascript-quickstart.md?ask= ``` -------------------------------- ### Querying Documentation Source: https://docs.hypertune.com/getting-started/next.js-pages-router-quickstart To get more information not present on the page, make an HTTP GET request to the page URL with the `ask` query parameter. The question should be specific and self-contained. ```bash GET https://docs.hypertune.com/getting-started/next.js-pages-router-quickstart.md?ask= ``` -------------------------------- ### Install dotenv and types with yarn Source: https://docs.hypertune.com/getting-started/javascript-quickstart Install the dotenv package and its types for loading environment variables using yarn. ```bash yarn add dotenv yarn add -D @types/dotenv ``` -------------------------------- ### Install dotenv and types with pnpm Source: https://docs.hypertune.com/getting-started/javascript-quickstart Install the dotenv package and its types for loading environment variables using pnpm. ```bash pnpm add dotenv pnpm add -D @types/dotenv ``` -------------------------------- ### Install Dependencies with yarn Source: https://docs.hypertune.com/getting-started/next.js-app-router-quickstart Install the necessary packages for integrating Hypertune with Vercel's Flags SDK using yarn. ```bash yarn add flags @flags-sdk/hypertune @vercel/edge-config ``` -------------------------------- ### Get help for Hypertune CLI with pnpm Source: https://docs.hypertune.com/sdk-reference/type-safe-client-generation Execute this command with pnpm to display the help message for the Hypertune CLI, detailing available options. ```bash pnpm hypertune --help ``` -------------------------------- ### Query Documentation Dynamically Source: https://docs.hypertune.com/guides/use-hypertune-on-static-pages Perform an HTTP GET request on the current page URL with the `ask` query parameter to get dynamic information. The question should be specific and in natural language. ```http GET https://docs.hypertune.com/guides/use-hypertune-on-static-pages.md?ask= ``` -------------------------------- ### Query Hypertune Documentation Source: https://docs.hypertune.com/concepts/analytics-views Perform an HTTP GET request to query the documentation dynamically. Use the 'ask' query parameter with a specific, self-contained question in natural language to get direct answers and relevant excerpts. ```http GET https://docs.hypertune.com/concepts/analytics-views.md?ask= ``` -------------------------------- ### API for Querying Documentation Source: https://docs.hypertune.com/concepts/reduction Demonstrates how to query Hypertune documentation dynamically using an HTTP GET request with an 'ask' parameter. ```http GET https://docs.hypertune.com/concepts/reduction.md?ask= ``` -------------------------------- ### Get User Agent and Pass to Hypertune Source: https://docs.hypertune.com/guides/pass-the-user-agent-to-hypertune Retrieve the user agent from the `user-agent` header and pass it to Hypertune. This example uses Next.js `headers()` and `createSource` from Hypertune. ```typescript import "server-only"; import { unstable_noStore as noStore } from "next/cache"; import { headers } from "next/headers"; import { createSource } from "@/generated/hypertune"; const hypertuneSource = createSource({ token: process.env.NEXT_PUBLIC_HYPERTUNE_TOKEN!, }); export default async function getHypertune() { noStore(); await hypertuneSource.initIfNeeded(); // Check for flag updates const headersList = await headers(); const userAgent = headersList.get("user-agent") ?? ""; return hypertuneSource.root({ args: { context: { environment: process.env.NODE_ENV, user: { id: "1", name: "Test", email: "hi@test.com", userAgent }, }, }, }); } ``` -------------------------------- ### Use Hypertune Go Client Source: https://docs.hypertune.com/getting-started/go-quickstart Instantiate the Hypertune client, wait for initialization, and evaluate flags within your Go application. Remember to update the import path to your project's path. ```go package main import ( "fmt" "log" "os" // Update to your project path. "github.com/myTeam/myProject/pkg/hypertune" ) func main() { if err := run(); err != nil { log.Fatal(err) } } func run() error { var token = os.Getenv("HYPERTUNE_TOKEN") source, err := hypertune.CreateSource(&token) if err != nil { return err } defer source.Close() source.WaitForInitialization() rootNode := source.Root(hypertune.RootArgs{ Context: hypertune.Context{ Environment: hypertune.Development, User: hypertune.User{ Id: "test_id", Name: "Test", Email: "hi@test.com", }, }, }) fmt.Printf("ExampleFlag: %v\n", rootNode.ExampleFlag(false)) return nil } ``` -------------------------------- ### cURL Example for GraphQL Query Source: https://docs.hypertune.com/getting-started/graphql-quickstart Use this cURL command to make a GET request to Hypertune Edge with a GraphQL query. Ensure you replace YOUR_URL_ENCODED_PROJECT_TOKEN with your actual token. ```bash curl --location --request GET 'https://edge.hypertune.com/graphql?token=${YOUR_URL_ENCODED_PROJECT_TOKEN}&body=%7B%22query%22%3A%22query%20TestQuery%7Broot(context%3A%7Benvironment%3A%20%5C%22development%5C%22%2C%20user%3A%7Bid%3A%20%5C%22test_id%5C%22%20name%3A%20%5C%22Test%5C%22%20email%3A%20%5C%22test%40test.com%5C%22%7D%7D)%7BexampleFlag%7D%7D%22%2C%22variables%22%3A%7B%7D%7D' ``` -------------------------------- ### Node.js Serverless Environment Flag Updates Source: https://docs.hypertune.com/sdk-reference/get-flag-updates Retrieve flag updates in Node.js serverless environments. This example shows how to initialize the Hypertune source and get the root node with context. ```typescript import { createSource } from '../generated/hypertune' const hypertuneSource = createSource({ token: process.env.HYPERTUNE_TOKEN!, shouldRefreshInitData: false, }) export default async function getHypertune() { // Get flag updates in serverless environments // await hypertuneSource.initIfNeeded(); return hypertuneSource.root({ args: { context: { environment: process.env.NODE_ENV === 'development' ? 'development' : 'production', user: { id: 'e23cc9a8-0287-40aa-8500-6802df91e56a', name: 'Example User', email: 'user@example.com', }, }, }, }) } ``` -------------------------------- ### Access Hypertune flags in your application Source: https://docs.hypertune.com/getting-started/javascript-quickstart Import and use the getHypertune function in your main application file to retrieve flag values. This example shows how to get 'exampleFlag' with a fallback value. ```typescript import './lib/loadEnv' import getHypertune from './lib/getHypertune' async function main() { const hypertune = await getHypertune() const exampleFlag = hypertune.exampleFlag({ fallback: false }) console.log(`Example Flag: ${exampleFlag}`) } main() ``` -------------------------------- ### React HypertuneProvider for Local-Only Mode Source: https://docs.hypertune.com/sdk-reference/local-only-offline-mode Configure the HypertuneProvider in React to run in local-only mode by setting `initDataProvider` to `null` and `remoteLogging.mode` to `off`. This example demonstrates the setup within a custom provider component. ```tsx import { HypertuneProvider } from '../generated/hypertune.react' export default function AppHypertuneProvider({ children, }: { children: React.ReactNode }) { return ( {children} ) } ``` -------------------------------- ### Call trackHypertuneExposure after getting feature flag Source: https://docs.hypertune.com/integrations/google-analytics-integration Call the trackHypertuneExposure function immediately after retrieving a feature flag value to log the experiment exposure. This example demonstrates usage within a React component. ```typescript import trackHypertuneExposure from "../lib/trackHypertuneExposure"; import useHypertune from "../lib/useHypertune"; export default function Editor() { const rootNode = useHypertune(); const showNewEditor = rootNode.showNewEditor({ fallback: false }); trackHypertuneExposure("ht_new_editor_test", showNewEditor); return showNewEditor ? : ; } ``` -------------------------------- ### Query Documentation with `ask` Parameter Source: https://docs.hypertune.com/integrations/webhooks/creating-webhooks Use this method to ask questions about the documentation dynamically. The response includes a direct answer and relevant excerpts. ```bash GET https://docs.hypertune.com/integrations/webhooks/creating-webhooks.md?ask= ``` -------------------------------- ### Client-side Rendering Setup in Gatsby Source: https://docs.hypertune.com/getting-started/gatsby-quickstart This snippet shows how to fetch Hypertune data on the server and hydrate it on the client for CSR pages in Gatsby. It uses `getServerData` to get dehydrated state and root arguments, then passes them to Hypertune providers. ```tsx import { GetServerData } from 'gatsby' import * as React from 'react' import ClientComponent from '../components/ClientComponent' import { DehydratedState, RootArgs, } from '../generated/hypertune' import { HypertuneHydrator, HypertuneRootProvider, } from '../generated/hypertune.react' import getHypertune from '../lib/getHypertune' type ServerData = { dehydratedState: DehydratedState | null rootArgs: RootArgs } export const getServerData: GetServerData< ServerData > = async () => { const hypertune = await getHypertune() const dehydratedState = hypertune.dehydrate() const rootArgs = hypertune.getRootArgs() return { props: { dehydratedState, rootArgs }, } } export default function Page({ serverData, }: { serverData: ServerData }) { const { dehydratedState, rootArgs } = serverData return ( ) } ``` -------------------------------- ### Querying Documentation with GET Request Source: https://docs.hypertune.com/concepts/event-types To get information not directly on the page, perform an HTTP GET request to the page URL with an 'ask' query parameter containing your question. ```http GET https://docs.hypertune.com/concepts/event-types.md?ask= ``` -------------------------------- ### Go Hypertune Initialization and Root Node Source: https://docs.hypertune.com/sdk-reference/get-flag-updates Initialize Hypertune in Go, using `sdk.WithInitDataRefreshInterval(0)` for immediate data loading. This example shows creating a root node with context and deferring source closure. ```go package main import ( "fmt" "log" "os" sdk "github.com/hypertunehq/hypertune-go" // Update to your project path. "github.com/myTeam/myProject/pkg/hypertune" ) func main() { var token = os.Getenv("HYPERTUNE_TOKEN") source, err := hypertune.CreateSource( &token, sdk.WithInitDataRefreshInterval(0), ) if err != nil { panic(err) } defer source.Close() source.WaitForInitialization() rootNode := source.Root(hypertune.RootArgs{ Context: hypertune.Context{ Environment: hypertune.Development, User: hypertune.User{ Id: "test_id", Name: "Test", Email: "hi@test.com", }, }, }) } ``` -------------------------------- ### Enable build-time snapshot for Hypertune Source: https://docs.hypertune.com/getting-started/react-quickstart To prevent flicker or layout shifts caused by delayed SDK initialization, set HYPERTUNE_INCLUDE_INIT_DATA to true in your .env file. This includes a snapshot of flag logic in the generated client, allowing immediate initialization. ```bash HYPERTUNE_INCLUDE_INIT_DATA=true ``` -------------------------------- ### Install @vercel/edge-config with yarn Source: https://docs.hypertune.com/getting-started/next.js-pages-router-quickstart Install the @vercel/edge-config package using yarn. ```bash yarn add @vercel/edge-config ``` -------------------------------- ### Get help for Hypertune CLI with yarn Source: https://docs.hypertune.com/sdk-reference/type-safe-client-generation Use this command with Yarn to access the help documentation for the Hypertune CLI, listing all configuration options. ```bash yarn hypertune --help ``` -------------------------------- ### Query Documentation Source: https://docs.hypertune.com/getting-started/go-quickstart Perform an HTTP GET request with the 'ask' query parameter to dynamically query the documentation. The response will contain an answer and relevant excerpts. ```http GET https://docs.hypertune.com/getting-started/go-quickstart.md?ask= ``` -------------------------------- ### Initialize Hypertune Project Source: https://docs.hypertune.com/getting-started/node.js-quickstart Initialize a new Hypertune project in your Node.js application. ```bash hypertune init ``` -------------------------------- ### Customize client generation with environment variables Source: https://docs.hypertune.com/sdk-reference/type-safe-client-generation Configure these environment variables to customize the client generation process, such as including build-time snapshots or the project token. ```bash # Set whether Hypertune should include a build-time snapshot of your flag logic HYPERTUNE_INCLUDE_INIT_DATA=true # Set whether Hypertune should include your token in the generated code HYPERTUNE_INCLUDE_TOKEN=true # Set where Hypertune should find your query file path HYPERTUNE_QUERY_FILE_PATH=hypertune.graphql ``` -------------------------------- ### Enable Build-Time Snapshot for Hypertune Source: https://docs.hypertune.com/getting-started/react-native-quickstart Include a snapshot of flag logic at build time by setting HYPERTUNE_INCLUDE_INIT_DATA to true in your .env file. This ensures immediate initialization before fetching from Hypertune Edge. ```bash HY উত্তেজনা_INCLUDE_INIT_DATA=true ``` -------------------------------- ### Configure Hypertune environment variables Source: https://docs.hypertune.com/getting-started/javascript-quickstart Define HYPERTUNE_TOKEN and HYPERTUNE_OUTPUT_DIRECTORY_PATH in your .env file. Replace 'token' with your actual project token. ```bash HYPERTUNE_TOKEN=token HYPERTUNE_OUTPUT_DIRECTORY_PATH=src/generated ``` -------------------------------- ### Query Documentation via HTTP GET Source: https://docs.hypertune.com/sdk-reference/hypertune-toolbar To get information not directly on a page, perform an HTTP GET request to the page URL with the `ask` query parameter. The question should be specific and in natural language. ```http GET https://docs.hypertune.com/sdk-reference/hypertune-toolbar.md?ask= ``` -------------------------------- ### Query Documentation with GET Request Source: https://docs.hypertune.com/ai-configuration/guide To get additional information not present on the current page, perform an HTTP GET request to the page URL with the 'ask' query parameter. The question should be specific and self-contained. ```http GET https://docs.hypertune.com/ai-configuration/guide.md?ask= ``` -------------------------------- ### Querying Documentation Source: https://docs.hypertune.com/getting-started/react-native-quickstart Use this GET request to query the documentation dynamically with a specific question. The response includes a direct answer and relevant excerpts. ```bash GET https://docs.hypertune.com/getting-started/react-native-quickstart.md?ask= ``` -------------------------------- ### Query Documentation with GET Request Source: https://docs.hypertune.com/ai-configuration/overview Use this method to ask specific questions about the documentation. The response includes direct answers and relevant excerpts. ```http GET https://docs.hypertune.com/ai-configuration/overview.md?ask= ``` -------------------------------- ### Use Hypertune Client in Python Source: https://docs.hypertune.com/getting-started/python-quickstart Example of using the generated Hypertune client in a Python application. It demonstrates creating a source, setting context, waiting for initialization, and retrieving a flag's value. ```python import generated.hypertune as hypertune def main(): root_node = hypertune.create_source().root({ "context": { "environment": "development", "user": { "id": "test_id", "name": "Test", "email": "hi@test.com", } } }) root_node.wait_for_initialization() example_flag = root_node.exampleFlag().get(False) if __name__ == "__main__": main() ``` -------------------------------- ### Query Documentation with `ask` Parameter Source: https://docs.hypertune.com/getting-started/html-quickstart To ask questions about the documentation, perform an HTTP GET request on the current page URL with the `ask` query parameter. The question should be specific and in natural language. ```bash GET https://docs.hypertune.com/getting-started/html-quickstart.md?ask= ``` -------------------------------- ### Query Documentation Dynamically Source: https://docs.hypertune.com/sdk-reference/local-synchronous-evaluation Use this method to ask questions about the documentation. The response includes a direct answer, relevant excerpts, and sources. ```http GET https://docs.hypertune.com/sdk-reference/local-synchronous-evaluation.md?ask= ``` -------------------------------- ### Query Documentation with HTTP GET Source: https://docs.hypertune.com/in-app-content/guide Use this method to ask specific questions about the documentation. The response includes a direct answer and relevant excerpts. ```http GET https://docs.hypertune.com/in-app-content/guide.md?ask= ``` -------------------------------- ### Install flags package with pnpm Source: https://docs.hypertune.com/getting-started/next.js-app-router-quickstart Install the 'flags' package using pnpm. This is a prerequisite for integrating Hypertune with the Vercel Toolbar. ```bash pnpm add flags ``` -------------------------------- ### Install flags package with yarn Source: https://docs.hypertune.com/getting-started/next.js-app-router-quickstart Install the 'flags' package using yarn. This is a prerequisite for integrating Hypertune with the Vercel Toolbar. ```bash yarn add flags ``` -------------------------------- ### Install flags package with npm Source: https://docs.hypertune.com/getting-started/next.js-app-router-quickstart Install the 'flags' package using npm. This is a prerequisite for integrating Hypertune with the Vercel Toolbar. ```bash npm install flags ``` -------------------------------- ### Install Babel Preset for Gatsby Source: https://docs.hypertune.com/getting-started/gatsby-quickstart Install the necessary Babel preset as a development dependency using npm, yarn, or pnpm. ```bash npm install -D babel-preset-gatsby ``` ```bash yarn add -D babel-preset-gatsby ``` ```bash pnpm add -D babel-preset-gatsby ```