@types/httpsnippet
TypeScript icon, indicating that this package has built-in type declarations

1.23.4 • Public • Published

Installation

npm install --save @types/httpsnippet

Summary

This package contains type definitions for httpsnippet (https://github.com/Kong/httpsnippet).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/httpsnippet.

index.d.ts

import { Har, Request } from "har-format";

/*~ This declaration specifies that the class constructor function
 *~ is the exported object from the file
 */
export = HTTPSnippet;

/*~ Write your module's methods and properties in this class */
declare class HTTPSnippet {
    constructor(data: HTTPSnippet.Data);

    convert(target: string, options?: HTTPSnippet.Options): string | false;

    convert(target: string, client?: string, options?: HTTPSnippet.Options): string | false;

    static addTarget(target: HTTPSnippet.Target): void;

    static addTargetClient(target: string, client: HTTPSnippet.TargetClient): void;

    static availableTargets: string[];

    static extName(target: string): string;
}

declare namespace HTTPSnippet {
    type Data = Har | Request;

    type Options = object;

    interface TargetClientInfo {
        key: string;
        title: string;
        link?: string | undefined;
        description?: string | undefined;
    }

    interface TargetClient {
        (source: Request, options: Options): string;
        info: TargetClientInfo;
    }

    interface TargetInfo<C extends string> {
        key: string;
        title: string;
        extname: string;
        default: C;
    }

    type Target<C extends string = string> = {
        info: TargetInfo<C>;
    } & Record<C, TargetClient>;
}

Additional Details

Credits

These definitions were written by Marcell Toth.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/httpsnippet

Weekly Downloads

1,284

Version

1.23.4

License

MIT

Unpacked Size

5.33 kB

Total Files

5

Last publish

Collaborators

  • types