@types/twitter

v1.7.4
  • Types
  • ESM
  • CJS

TypeScript definitions for twitter

License
MIT
Install Size
6.8 kB/-
Vulns
0
Published

Get started

$npm install @types/twitter@1.7.4
$pnpm add @types/twitter@1.7.4
$yarn add @types/twitter@1.7.4
$bun add @types/twitter@1.7.4
$deno add npm:@types/twitter@1.7.4
$vlt install @types/twitter@1.7.4
# Usually installed as a dev dependency
$npm install -D @types/twitter@1.7.4
$pnpm add -D @types/twitter@1.7.4
$yarn add -D @types/twitter@1.7.4
$bun add -d @types/twitter@1.7.4
$deno add -D npm:@types/twitter@1.7.4
$vlt install -D @types/twitter@1.7.4

Readme

Installation

npm install --save @types/twitter

Summary

This package contains type definitions for twitter (https://github.com/desmondmorris/node-twitter).

Details

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

index.d.ts

/// <reference types="node" />

import request = require("request");
import { EventEmitter } from "events";

export = Twitter;

declare class Twitter {
    readonly VERSION: string;
    readonly allow_promise: boolean;
    readonly request: typeof request;

    constructor(options: Twitter.AccessTokenOptions | Twitter.BearerTokenOptions);

    get(path: string, params: Twitter.RequestParams, callback: Twitter.Callback): void;
    get(path: string, callback: Twitter.Callback): void;
    get(path: string, params?: Twitter.RequestParams): Promise<Twitter.ResponseData>;

    post(path: string, params: Twitter.RequestParams, callback: Twitter.Callback): void;
    post(path: string, callback: Twitter.Callback): void;
    post(path: string, params?: Twitter.RequestParams): Promise<Twitter.ResponseData>;

    stream(
        method: "user" | "site" | string,
        params: { [key: string]: any },
        callback: (stream: EventEmitter) => void,
    ): void;
    stream(method: "user" | "site" | string, callback: (stream: EventEmitter) => void): void;
    stream(method: "user" | "site" | string, params?: { [key: string]: any }): EventEmitter;
}

declare namespace Twitter {
    interface Options {
        consumer_key: string;
        consumer_secret: string;
        rest_base?: string | undefined;
        stream_base?: string | undefined;
        user_stream_base?: string | undefined;
        site_stream_base?: string | undefined;
        media_base?: string | undefined;
        request_options?: request.CoreOptions | undefined;
    }

    interface AccessTokenOptions extends Options {
        access_token_key: string;
        access_token_secret: string;
    }

    interface BearerTokenOptions extends Options {
        bearer_token: string;
    }

    type Callback = (error: any, data: ResponseData, response: request.Response) => void;

    interface RequestParams {
        [key: string]: any;
        base?: string | undefined;
    }

    interface ResponseData {
        [key: string]: any;
    }
}
Additional Details

Credits

These definitions were written by BendingBender.

Weekly DownloadsAcross all versions

Versions

1.7.4
latestts4.5ts4.6ts4.7ts4.8ts4.9ts5.0ts5.1ts5.2ts5.3ts5.4ts5.5ts5.6ts5.7ts5.8ts5.9ts6.0
1.7.2
ts4.3ts4.4
1.7.1
ts3.6ts3.7ts3.8ts3.9ts4.0ts4.1ts4.2
1.7.0
ts2.3ts2.4ts2.5ts2.6ts2.7ts2.8ts2.9ts3.0ts3.1ts3.2ts3.3ts3.4ts3.5
0.0.28
ts2.0ts2.1ts2.2