import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js"; import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.js"; import * as core from "../../../../core/index.js"; import * as Whop from "../../../index.js"; export declare namespace ExperimentsClient { type Options = BaseClientOptions; interface RequestOptions extends BaseRequestOptions { } } /** * An Experiment is a feature flag or A/B test owned by an account. Treatments take stable percentage ranges of traffic and everyone else gets control, so growing an allocation never moves an existing user to another arm. * * Use the Experiments API to create a draft, configure its weights, targeting, and resource bindings, then activate, pause, or end it, and to evaluate which arm a user, account, or anonymous visitor gets. Managing experiments requires `experiment:read` or `experiment:manage`; evaluation works without authentication. */ export declare class ExperimentsClient { protected readonly _options: NormalizedClientOptionsWithAuth; constructor(options?: ExperimentsClient.Options); /** * Lists the experiments and feature flags owned by an account. Requires `experiment:read` on the account. * * @param {Whop.ListExperimentsRequest} request * @param {ExperimentsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Whop.BadRequestError} * @throws {@link errors.WhopError} * @throws {@link errors.WhopTimeoutError} * * @example * await client.experiments.list() */ list(request?: Whop.ListExperimentsRequest, requestOptions?: ExperimentsClient.RequestOptions): Promise>; /** * Creates an experiment or feature flag in `draft` status for an account. Nothing is served until you activate it with `POST /experiments/:id/activate`. Requires `experiment:manage` on the account. * * @param {Whop.CreateExperimentsRequest} request * @param {ExperimentsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Whop.ConflictError} * @throws {@link errors.WhopError} * @throws {@link errors.WhopTimeoutError} * * @example * await client.experiments.create({ * account_id: "biz_xxxxxxxxxxxxxx", * flag_key: "checkout_redesign_v2" * }) */ create(request: Whop.CreateExperimentsRequest, requestOptions?: ExperimentsClient.RequestOptions): core.HttpResponsePromise; private __create; /** * Evaluates experiments and feature flags for a subject and records an exposure. Pass `flag_key` to evaluate one flag, or omit it to evaluate every active flag in the account and related resource scope. Requires no authentication; when a credential resolves, its authentication method, API key ID, and signed-in user ID are recorded on the exposure event. * * @param {Whop.ExposuresExperimentsRequest} request * @param {ExperimentsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link errors.WhopError} * @throws {@link errors.WhopTimeoutError} * * @example * await client.experiments.exposures() */ exposures(request?: Whop.ExposuresExperimentsRequest, requestOptions?: ExperimentsClient.RequestOptions): core.HttpResponsePromise; private __exposures; /** * Retrieves an experiment or feature flag by its `expt_` ID or `flag_key` handle. Requires `experiment:read` on the owning account. * * @param {Whop.RetrieveExperimentsRequest} request * @param {ExperimentsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Whop.NotFoundError} * @throws {@link errors.WhopError} * @throws {@link errors.WhopTimeoutError} * * @example * await client.experiments.retrieve({ * id: "id" * }) */ retrieve(request: Whop.RetrieveExperimentsRequest, requestOptions?: ExperimentsClient.RequestOptions): core.HttpResponsePromise; private __retrieve; /** * Updates the targeting rules, treatment allocation, or hypothesis of an existing experiment or feature flag. To change its lifecycle, use the `activate`, `pause`, and `end` endpoints instead. Requires `experiment:manage` on the owning account. * * @param {Whop.UpdateExperimentsRequest} request * @param {ExperimentsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Whop.NotFoundError} * @throws {@link errors.WhopError} * @throws {@link errors.WhopTimeoutError} * * @example * await client.experiments.update({ * id: "id" * }) */ update(request: Whop.UpdateExperimentsRequest, requestOptions?: ExperimentsClient.RequestOptions): core.HttpResponsePromise; private __update; /** * Starts (or resumes) an experiment or feature flag so evaluation begins serving it. Activating a draft stamps `started_at`; resuming a paused experiment keeps the original start. Only drafts and paused experiments can be activated. Requires `experiment:manage` on the owning account. * * @param {Whop.ActivateExperimentsRequest} request * @param {ExperimentsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Whop.BadRequestError} * @throws {@link Whop.ConflictError} * @throws {@link errors.WhopError} * @throws {@link errors.WhopTimeoutError} * * @example * await client.experiments.activate({ * id: "id" * }) */ activate(request: Whop.ActivateExperimentsRequest, requestOptions?: ExperimentsClient.RequestOptions): core.HttpResponsePromise; private __activate; /** * Concludes the experiment and records required `findings`. Pass `winning_arm` to serve the winning treatment to everyone; omit it when control won. Ended experiments cannot restart, but may be ended again to correct the winner. Requires `experiment:manage` on the owning account. * * @param {Whop.EndExperimentsRequest} request * @param {ExperimentsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Whop.BadRequestError} * @throws {@link Whop.ConflictError} * @throws {@link errors.WhopError} * @throws {@link errors.WhopTimeoutError} * * @example * await client.experiments.end({ * id: "id", * findings: "Treatment lifted signups 12%, shipping it to everyone." * }) */ end(request: Whop.EndExperimentsRequest, requestOptions?: ExperimentsClient.RequestOptions): core.HttpResponsePromise; private __end; /** * Pauses an active experiment or feature flag: evaluation stops serving it and exposures stop flowing. Assignments are keyed on stable identity, so users return to their original arm when the experiment resumes. Requires `experiment:manage` on the owning account. * * @param {Whop.PauseExperimentsRequest} request * @param {ExperimentsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Whop.ConflictError} * @throws {@link errors.WhopError} * @throws {@link errors.WhopTimeoutError} * * @example * await client.experiments.pause({ * id: "id" * }) */ pause(request: Whop.PauseExperimentsRequest, requestOptions?: ExperimentsClient.RequestOptions): core.HttpResponsePromise; private __pause; }