kutt - v4.0.0
    Preparing search index...

    Interface KuttConfig

    Stores a base URL, API key, and request timeout with optional per-setting seals.

    New configurations default to https://kutt.to/api/, an empty API key, and a timeout of 5,000 milliseconds. Sealed settings cannot be changed.

    interface KuttConfig {
        getAPIKey(): string;
        getBaseURL(): string;
        getTimeout(): number;
        setAPIKey(apiKey: string, seal?: boolean): this;
        setBaseURL(baseURL: string, seal?: boolean): this;
        setTimeout(timeout: number, seal?: boolean): this;
    }

    Hierarchy (View Summary)

    Index
    • Gets the API key sent in the X-API-KEY request header.

      Returns string

      The configured API key, or an empty string when no key is set.

    • Gets the API base URL used to resolve endpoint paths such as v2/links.

      Returns string

      The configured API base URL.

    • Gets the request timeout in milliseconds.

      Returns number

      The configured timeout passed to AbortSignal.timeout.

    • Sets the API key sent in the X-API-KEY request header.

      Parameters

      • apiKey: string

        API key to send. An empty string omits the header.

      • Optionalseal: boolean

        Whether to prevent further changes to this setting. Defaults to false.

      Returns this

      This instance for chained configuration calls.

      If the API key setting is already sealed.

      import { Kutt } from "kutt";

      const kutt = new Kutt().setAPIKey("YOUR_API_KEY");
    • Sets the API base URL used to resolve endpoint paths such as v2/links.

      Parameters

      • baseURL: string

        API root URL, such as https://kutt.to/api/.

      • Optionalseal: boolean

        Whether to prevent further changes to this setting. Defaults to false.

      Returns this

      This instance for chained configuration calls.

      If the base URL setting is already sealed.

      import { Kutt } from "kutt";

      const kutt = new Kutt().setBaseURL("https://kutt.example.com/api/", true);
    • Sets the request timeout in milliseconds.

      Parameters

      • timeout: number

        Timeout passed to AbortSignal.timeout when a request starts.

      • Optionalseal: boolean

        Whether to prevent further changes to this setting. Defaults to false.

      Returns this

      This instance for chained configuration calls.

      If the timeout setting is already sealed.

      import { Kutt } from "kutt";

      const kutt = new Kutt().setTimeout(10_000);