Skip to content

Latest commit

 

History

History
201 lines (172 loc) · 5.87 KB

File metadata and controls

201 lines (172 loc) · 5.87 KB

API Report File for "@friendlycaptcha/server-sdk"

Do not edit this file. It is a report generated by API Extractor.

// @public (undocumented)
export type ClientErrorCode = typeof FAILED_TO_ENCODE_ERROR_CODE | typeof REQUEST_FAILED_ERROR_CODE | typeof REQUEST_FAILED_TIMEOUT_ERROR_CODE | typeof FAILED_DUE_TO_CLIENT_ERROR_CODE | typeof FAILED_TO_DECODE_RESPONSE_ERROR_CODE;

// @public
export const FAILED_DUE_TO_CLIENT_ERROR_CODE = "request_failed_due_to_client_error";

// @public
export const FAILED_TO_DECODE_RESPONSE_ERROR_CODE = "verification_response_could_not_be_decoded";

// @public
export const FAILED_TO_ENCODE_ERROR_CODE = "failed_to_encode_request";

// @public
export class FriendlyCaptchaClient {
    constructor(opts: FriendlyCaptchaOptions);
    // @internal
    getSiteverifyEndpoint(): string;
    retrieveRiskIntelligence(token: string, opts?: {
        timeout?: number;
        sitekey?: string;
    }): Promise<RiskIntelligenceRetrieveResult>;
    verifyCaptchaResponse(response: string, opts?: {
        timeout?: number;
        sitekey?: string;
    }): Promise<VerifyResult>;
}

// @public
export interface FriendlyCaptchaOptions {
    apiEndpoint?: string;
    apiKey: string;
    fetch?: typeof globalThis.fetch;
    // (undocumented)
    sitekey?: string;
    // @deprecated (undocumented)
    siteverifyEndpoint?: string;
    strict?: boolean;
}

// @public
export const REQUEST_FAILED_ERROR_CODE = "request_failed";

// @public
export const REQUEST_FAILED_TIMEOUT_ERROR_CODE = "request_failed_due_to_timeout";

// @public (undocumented)
export interface RiskIntelligenceRetrieveErrorResponse {
    // (undocumented)
    error: RiskIntelligenceRetrieveErrorResponseErrorData;
    // (undocumented)
    success: false;
}

// @public (undocumented)
export interface RiskIntelligenceRetrieveErrorResponseErrorData {
    // (undocumented)
    detail: string;
    // Warning: (ae-forgotten-export) The symbol "APIErrorCode" needs to be exported by the entry point index.d.ts
    //
    // (undocumented)
    error_code: APIErrorCode;
}

// Warning: (ae-internal-missing-underscore) The name "RiskIntelligenceRetrieveRequest" should be prefixed with an underscore because the declaration is marked as @internal
//
// @internal
export interface RiskIntelligenceRetrieveRequest {
    sitekey?: string;
    token: string;
}

// @public (undocumented)
export type RiskIntelligenceRetrieveResponse = RiskIntelligenceRetrieveSuccessResponse | RiskIntelligenceRetrieveErrorResponse;

// @public
export interface RiskIntelligenceRetrieveResponseData {
    // (undocumented)
    event_id: string;
    // Warning: (ae-forgotten-export) The symbol "RiskIntelligenceData" needs to be exported by the entry point index.d.ts
    risk_intelligence: RiskIntelligenceData;
    token: RiskIntelligenceTokenData;
}

// @public
export class RiskIntelligenceRetrieveResult {
    // (undocumented)
    clientErrorType: ClientErrorCode | null;
    // (undocumented)
    getResponse(): RiskIntelligenceRetrieveResponse | null;
    // (undocumented)
    getResponseError(): RiskIntelligenceRetrieveErrorResponseErrorData | null;
    isClientError(): boolean;
    // (undocumented)
    isValid(): boolean;
    response: RiskIntelligenceRetrieveResponse | null;
    status: number;
    wasAbleToRetrieve(): boolean;
}

// @public (undocumented)
export interface RiskIntelligenceRetrieveSuccessResponse {
    // (undocumented)
    data: RiskIntelligenceRetrieveResponseData;
    // (undocumented)
    success: true;
}

// @public
export interface RiskIntelligenceTokenData {
    expires_at: string;
    num_uses: number;
    origin: string;
    timestamp: string;
}

// @public (undocumented)
export interface SiteverifyErrorResponse {
    // (undocumented)
    error: SiteverifyErrorResponseErrorData;
    // (undocumented)
    success: false;
}

// @public (undocumented)
export interface SiteverifyErrorResponseErrorData {
    // (undocumented)
    detail: string;
    // (undocumented)
    error_code: APIErrorCode;
}

// Warning: (ae-internal-missing-underscore) The name "SiteverifyRequest" should be prefixed with an underscore because the declaration is marked as @internal
//
// @internal
export interface SiteverifyRequest {
    response: string;
    sitekey?: string;
}

// @public (undocumented)
export type SiteverifyResponse = SiteverifySuccessResponse | SiteverifyErrorResponse;

// @public (undocumented)
export interface SiteverifyResponseChallengeData {
    origin: string;
    timestamp: string;
}

// @public (undocumented)
export interface SiteverifyResponseData {
    challenge: SiteverifyResponseChallengeData;
    event_id: string;
    risk_intelligence: RiskIntelligenceData | null;
}

// @public (undocumented)
export interface SiteverifySuccessResponse {
    // (undocumented)
    data: SiteverifyResponseData;
    // (undocumented)
    success: true;
}

// @public @deprecated (undocumented)
export type VerifyClientErrorCode = ClientErrorCode;

// @public
export class VerifyResult {
    constructor(strict: boolean);
    // (undocumented)
    clientErrorType: ClientErrorCode | null;
    // (undocumented)
    getErrorCode(): ClientErrorCode | null;
    // (undocumented)
    getResponse(): SiteverifyResponse | null;
    // (undocumented)
    getResponseError(): SiteverifyErrorResponseErrorData | null;
    isClientError(): boolean;
    isDecodeError(): boolean;
    isEncodeError(): boolean;
    isRequestOrTimeoutError(): boolean;
    // (undocumented)
    isStrict(): boolean;
    response: SiteverifyResponse | null;
    // (undocumented)
    shouldAccept(): boolean;
    // (undocumented)
    shouldReject(): boolean;
    status: number;
    wasAbleToVerify(): boolean;
}

// (No @packageDocumentation comment for this package)