cloudflare
Version:
The official TypeScript library for the Cloudflare API
51 lines • 1.8 kB
TypeScript
import { APIResource } from "../../../core/resource.js";
import { APIPromise } from "../../../core/api-promise.js";
import { RequestOptions } from "../../../internal/request-options.js";
export declare class BaseEvaluate extends APIResource {
static readonly _key: readonly ['flagship', 'apps', 'evaluate'];
/**
* Evaluates a flag against the provided context. Pass context attributes as query
* parameters; values are coerced to numbers or booleans where unambiguous. For
* low-latency in-Worker evaluation, prefer the Flagship binding over this
* endpoint.
*/
get(appID: string, params: EvaluateGetParams, options?: RequestOptions): APIPromise<EvaluateGetResponse>;
}
export declare class Evaluate extends BaseEvaluate {
}
export interface EvaluateGetResponse {
/**
* Key of the evaluated flag.
*/
flagKey: string;
/**
* Reason the evaluator selected this variation.
*/
reason: 'STATIC' | 'TARGETING_MATCH' | 'DEFAULT' | 'DISABLED' | 'SPLIT';
/**
* Name of the variation that supplied the resolved value.
*/
variant: string;
value?: string | null | number | boolean | {
[key: string]: unknown;
} | Array<unknown>;
}
export interface EvaluateGetParams {
/**
* Path param: Cloudflare account ID that owns the Flagship app.
*/
account_id: string;
/**
* Query param: The flag key to evaluate.
*/
flagKey: string;
/**
* Query param: Context targeting key (per OpenFeature spec); used for percentage
* rollout bucketing.
*/
targetingKey?: string;
}
export declare namespace Evaluate {
export { type EvaluateGetResponse as EvaluateGetResponse, type EvaluateGetParams as EvaluateGetParams };
}
//# sourceMappingURL=evaluate.d.ts.map