1
0
mirror of https://github.com/node-red/node-red-nodes.git synced 2023-10-10 13:36:58 +02:00

Add files via upload

This commit is contained in:
shahramdj 2022-10-07 15:47:29 -04:00 committed by GitHub
parent 91c72d107e
commit 79774054df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
36 changed files with 1681 additions and 0 deletions

View File

@ -0,0 +1,63 @@
import type TwitterApi from '../client';
import { TypeOrArrayOf } from './shared.types';
export declare type TOAuth2Scope = 'tweet.read' | 'tweet.write' | 'tweet.moderate.write' | 'users.read' | 'follows.read' | 'follows.write' | 'offline.access' | 'space.read' | 'mute.read' | 'mute.write' | 'like.read' | 'like.write' | 'list.read' | 'list.write' | 'block.read' | 'block.write' | 'bookmark.read' | 'bookmark.write';
export interface BuildOAuth2RequestLinkArgs {
scope?: TypeOrArrayOf<TOAuth2Scope> | TypeOrArrayOf<string>;
state?: string;
}
export interface AccessOAuth2TokenArgs {
/** The same URI given to generate link at previous step. */
redirectUri: string;
/** The code obtained in link generation step. */
codeVerifier: string;
/** The code given by Twitter in query string, after redirection to your callback URL. */
code: string;
}
export interface AccessOAuth2TokenResult {
token_type: 'bearer';
expires_in: number;
access_token: string;
scope: string;
refresh_token?: string;
}
export interface RequestTokenArgs {
authAccessType: 'read' | 'write';
linkMode: 'authenticate' | 'authorize';
forceLogin: boolean;
screenName: string;
}
export interface RequestTokenResult {
oauth_token: string;
oauth_token_secret: string;
oauth_callback_confirmed: 'true';
}
export interface IOAuth2RequestTokenResult {
url: string;
state: string;
codeVerifier: string;
codeChallenge: string;
}
export interface AccessTokenResult {
oauth_token: string;
oauth_token_secret: string;
user_id: string;
screen_name: string;
}
export interface BearerTokenResult {
token_type: 'bearer';
access_token: string;
}
export interface LoginResult {
userId: string;
screenName: string;
accessToken: string;
accessSecret: string;
client: TwitterApi;
}
export interface IParsedOAuth2TokenResult {
client: TwitterApi;
expiresIn: number;
accessToken: string;
scope: TOAuth2Scope[];
refreshToken?: string;
}

View File

@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View File

@ -0,0 +1,63 @@
/// <reference types="node" />
import type { Agent } from 'http';
import type { ITwitterApiClientPlugin } from './plugins';
import type { TRequestCompressionLevel } from './request-maker.mixin.types';
export declare enum ETwitterStreamEvent {
Connected = "connected",
ConnectError = "connect error",
ConnectionError = "connection error",
ConnectionClosed = "connection closed",
ConnectionLost = "connection lost",
ReconnectAttempt = "reconnect attempt",
Reconnected = "reconnected",
ReconnectError = "reconnect error",
ReconnectLimitExceeded = "reconnect limit exceeded",
DataKeepAlive = "data keep-alive",
Data = "data event content",
DataError = "data twitter error",
TweetParseError = "data tweet parse error",
Error = "stream error"
}
export interface TwitterApiTokens {
appKey: string;
appSecret: string;
accessToken?: string;
accessSecret?: string;
}
export interface TwitterApiOAuth2Init {
clientId: string;
clientSecret?: string;
}
export interface TwitterApiBasicAuth {
username: string;
password: string;
}
export interface IClientTokenBearer {
bearerToken: string;
type: 'oauth2';
}
export interface IClientOAuth2UserClient {
clientId: string;
type: 'oauth2-user';
}
export interface IClientTokenBasic {
token: string;
type: 'basic';
}
export interface IClientTokenOauth {
appKey: string;
appSecret: string;
accessToken?: string;
accessSecret?: string;
type: 'oauth-1.0a';
}
export interface IClientTokenNone {
type: 'none';
}
export declare type TClientTokens = IClientTokenNone | IClientTokenBearer | IClientTokenOauth | IClientTokenBasic | IClientOAuth2UserClient;
export interface IClientSettings {
/** Used to send HTTPS requests. This is mostly used to make requests work behind a proxy. */
httpAgent: Agent;
plugins: ITwitterApiClientPlugin[];
compression: TRequestCompressionLevel;
}

View File

@ -0,0 +1,20 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ETwitterStreamEvent = void 0;
var ETwitterStreamEvent;
(function (ETwitterStreamEvent) {
ETwitterStreamEvent["Connected"] = "connected";
ETwitterStreamEvent["ConnectError"] = "connect error";
ETwitterStreamEvent["ConnectionError"] = "connection error";
ETwitterStreamEvent["ConnectionClosed"] = "connection closed";
ETwitterStreamEvent["ConnectionLost"] = "connection lost";
ETwitterStreamEvent["ReconnectAttempt"] = "reconnect attempt";
ETwitterStreamEvent["Reconnected"] = "reconnected";
ETwitterStreamEvent["ReconnectError"] = "reconnect error";
ETwitterStreamEvent["ReconnectLimitExceeded"] = "reconnect limit exceeded";
ETwitterStreamEvent["DataKeepAlive"] = "data keep-alive";
ETwitterStreamEvent["Data"] = "data event content";
ETwitterStreamEvent["DataError"] = "data twitter error";
ETwitterStreamEvent["TweetParseError"] = "data tweet parse error";
ETwitterStreamEvent["Error"] = "stream error";
})(ETwitterStreamEvent = exports.ETwitterStreamEvent || (exports.ETwitterStreamEvent = {}));

View File

@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View File

@ -0,0 +1,23 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./v1"), exports);
__exportStar(require("./v2"), exports);
__exportStar(require("./errors.types"), exports);
__exportStar(require("./responses.types"), exports);
__exportStar(require("./client.types"), exports);
__exportStar(require("./auth.types"), exports);
__exportStar(require("./plugins"), exports);

View File

@ -0,0 +1,59 @@
/// <reference types="node" />
import type { ClientRequestArgs } from 'http';
import type { IGetHttpRequestArgs } from '../request-maker.mixin.types';
import type { TwitterResponse } from '../responses.types';
import type { IComputedHttpRequestArgs } from '../request-maker.mixin.types';
import type { IOAuth2RequestTokenResult, RequestTokenResult } from '../auth.types';
import type { PromiseOrType } from '../shared.types';
import type { ApiResponseError, ApiRequestError, ApiPartialResponseError } from '../errors.types';
import type { ClientRequestMaker } from '../../client-mixins/request-maker.mixin';
export declare class TwitterApiPluginResponseOverride {
value: any;
constructor(value: any);
}
export interface ITwitterApiClientPlugin {
onBeforeRequestConfig?: TTwitterApiBeforeRequestConfigHook;
onBeforeRequest?: TTwitterApiBeforeRequestHook;
onAfterRequest?: TTwitterApiAfterRequestHook;
onRequestError?: TTwitterApiRequestErrorHook;
onResponseError?: TTwitterApiResponseErrorHook;
onBeforeStreamRequestConfig?: TTwitterApiBeforeStreamRequestConfigHook;
onOAuth1RequestToken?: TTwitterApiAfterOAuth1RequestTokenHook;
onOAuth2RequestToken?: TTwitterApiAfterOAuth2RequestTokenHook;
}
export interface ITwitterApiBeforeRequestConfigHookArgs {
client: ClientRequestMaker;
url: URL;
params: IGetHttpRequestArgs;
}
export interface ITwitterApiBeforeRequestHookArgs extends ITwitterApiBeforeRequestConfigHookArgs {
computedParams: IComputedHttpRequestArgs;
requestOptions: Partial<ClientRequestArgs>;
}
export interface ITwitterApiAfterRequestHookArgs extends ITwitterApiBeforeRequestHookArgs {
response: TwitterResponse<any>;
}
export interface ITwitterApiRequestErrorHookArgs extends ITwitterApiBeforeRequestHookArgs {
error: ApiRequestError | ApiPartialResponseError;
}
export interface ITwitterApiResponseErrorHookArgs extends ITwitterApiBeforeRequestHookArgs {
error: ApiResponseError;
}
export declare type TTwitterApiBeforeRequestConfigHook = (args: ITwitterApiBeforeRequestConfigHookArgs) => PromiseOrType<TwitterResponse<any> | void>;
export declare type TTwitterApiBeforeRequestHook = (args: ITwitterApiBeforeRequestHookArgs) => void | Promise<void>;
export declare type TTwitterApiAfterRequestHook = (args: ITwitterApiAfterRequestHookArgs) => PromiseOrType<TwitterApiPluginResponseOverride | void>;
export declare type TTwitterApiRequestErrorHook = (args: ITwitterApiRequestErrorHookArgs) => PromiseOrType<TwitterApiPluginResponseOverride | void>;
export declare type TTwitterApiResponseErrorHook = (args: ITwitterApiResponseErrorHookArgs) => PromiseOrType<TwitterApiPluginResponseOverride | void>;
export declare type TTwitterApiBeforeStreamRequestConfigHook = (args: ITwitterApiBeforeRequestConfigHookArgs) => void;
export interface ITwitterApiAfterOAuth1RequestTokenHookArgs {
client: ClientRequestMaker;
url: string;
oauthResult: RequestTokenResult;
}
export interface ITwitterApiAfterOAuth2RequestTokenHookArgs {
client: ClientRequestMaker;
result: IOAuth2RequestTokenResult;
redirectUri: string;
}
export declare type TTwitterApiAfterOAuth1RequestTokenHook = (args: ITwitterApiAfterOAuth1RequestTokenHookArgs) => void | Promise<void>;
export declare type TTwitterApiAfterOAuth2RequestTokenHook = (args: ITwitterApiAfterOAuth2RequestTokenHookArgs) => void | Promise<void>;

View File

@ -0,0 +1,9 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TwitterApiPluginResponseOverride = void 0;
class TwitterApiPluginResponseOverride {
constructor(value) {
this.value = value;
}
}
exports.TwitterApiPluginResponseOverride = TwitterApiPluginResponseOverride;

View File

@ -0,0 +1 @@
export * from './client.plugins.types';

View File

@ -0,0 +1,17 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./client.plugins.types"), exports);

View File

@ -0,0 +1,73 @@
/// <reference types="node" />
import type { RequestOptions } from 'https';
import type { TwitterApiBasicAuth, TwitterApiOAuth2Init, TwitterApiTokens } from './client.types';
import type { TwitterRateLimit } from './responses.types';
export declare type TRequestDebuggerHandlerEvent = 'abort' | 'close' | 'socket' | 'socket-error' | 'socket-connect' | 'socket-close' | 'socket-end' | 'socket-lookup' | 'socket-timeout' | 'request-error' | 'response' | 'response-aborted' | 'response-error' | 'response-close' | 'response-end';
export declare type TRequestDebuggerHandler = (event: TRequestDebuggerHandlerEvent, data?: any) => void;
/**
* Request compression level. `true` means `'brotli'`, `false` means `'identity'`.
* When `brotli` is unavailable (f.e. in streams), it will fallback to `gzip`.
*/
export declare type TRequestCompressionLevel = boolean | 'brotli' | 'gzip' | 'deflate' | 'identity';
export declare type TRequestFullData = {
url: URL;
options: RequestOptions;
body?: any;
rateLimitSaver?: (rateLimit: TwitterRateLimit) => any;
requestEventDebugHandler?: TRequestDebuggerHandler;
compression?: TRequestCompressionLevel;
forceParseMode?: TResponseParseMode;
};
export declare type TRequestFullStreamData = TRequestFullData & {
payloadIsError?: (data: any) => boolean;
};
export declare type TRequestQuery = Record<string, string | number | boolean | string[] | undefined>;
export declare type TRequestStringQuery = Record<string, string>;
export declare type TRequestBody = Record<string, any> | Buffer;
export declare type TBodyMode = 'json' | 'url' | 'form-data' | 'raw';
export declare type TResponseParseMode = 'json' | 'url' | 'text' | 'buffer' | 'none';
export interface IWriteAuthHeadersArgs {
headers: Record<string, string>;
bodyInSignature: boolean;
url: URL;
method: string;
query: TRequestQuery;
body: TRequestBody;
}
export interface IGetHttpRequestArgs {
url: string;
method: string;
query?: TRequestQuery;
/** The URL parameters, if you specify an endpoint with `:id`, for example. */
params?: TRequestQuery;
body?: TRequestBody;
headers?: Record<string, string>;
forceBodyMode?: TBodyMode;
forceParseMode?: TResponseParseMode;
enableAuth?: boolean;
enableRateLimitSave?: boolean;
timeout?: number;
requestEventDebugHandler?: TRequestDebuggerHandler;
compression?: TRequestCompressionLevel;
}
export interface IComputedHttpRequestArgs {
rawUrl: string;
url: URL;
method: string;
headers: Record<string, string>;
body: string | Buffer | undefined;
}
export interface IGetStreamRequestArgs {
payloadIsError?: (data: any) => boolean;
autoConnect?: boolean;
}
export interface IGetStreamRequestArgsAsync {
payloadIsError?: (data: any) => boolean;
autoConnect?: true;
}
export interface IGetStreamRequestArgsSync {
payloadIsError?: (data: any) => boolean;
autoConnect: false;
}
export declare type TCustomizableRequestArgs = Pick<IGetHttpRequestArgs, 'forceParseMode' | 'compression' | 'timeout' | 'headers' | 'params' | 'forceBodyMode' | 'enableAuth' | 'enableRateLimitSave'>;
export declare type TAcceptedInitToken = TwitterApiTokens | TwitterApiOAuth2Init | TwitterApiBasicAuth | string;

View File

@ -0,0 +1,12 @@
/// <reference types="node" />
import type { IncomingHttpHeaders } from 'http';
export interface TwitterResponse<T> {
headers: IncomingHttpHeaders;
data: T;
rateLimit?: TwitterRateLimit;
}
export interface TwitterRateLimit {
limit: number;
reset: number;
remaining: number;
}

View File

@ -0,0 +1,21 @@
export declare type TAppRateLimitResourceV1 = 'help' | 'statuses' | 'friends' | 'followers' | 'users' | 'search' | 'trends' | 'favorites' | 'friendships' | 'direct_messages' | 'lists' | 'geo' | 'account' | 'application' | 'account_activity';
export interface AppRateLimitV1Result {
rate_limit_context: {
access_token: string;
};
resources: {
[TResourceName in TAppRateLimitResourceV1]?: {
[resourceEndpoint: string]: AppRateLimitEndpointV1;
};
};
}
export interface AppRateLimitEndpointV1 {
limit: number;
remaining: number;
reset: number;
}
export interface HelpLanguageV1Result {
code: string;
status: string;
name: string;
}

View File

@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View File

@ -0,0 +1,159 @@
import { CoordinateV1, MediaEntityV1, TweetEntitiesV1 } from './entities.v1.types';
export declare enum EDirectMessageEventTypeV1 {
Create = "message_create",
WelcomeCreate = "welcome_message"
}
export interface MessageCreateEventV1 {
target: {
recipient_id: string;
};
message_data: MessageCreateDataV1;
custom_profile_id?: string;
}
export interface MessageCreateDataV1 {
text: string;
attachment?: MessageCreateAttachmentV1;
quick_reply?: MessageCreateQuickReplyV1;
ctas?: MessageCreateCtaV1[];
}
export interface MessageCreateCtaV1 {
type: 'web_url';
url: string;
label: string;
/** Only when messages are retrieved from API */
tco_url?: string;
}
export interface MessageCreateQuickReplyOptionV1 {
label: string;
description?: string;
metadata?: string;
}
export interface MessageCreateQuickReplyV1 {
type: 'options';
options: MessageCreateQuickReplyOptionV1[];
}
export declare type MessageCreateAttachmentV1 = {
type: 'media';
media: {
id: string;
};
} | {
type: 'location';
location: MessageCreateLocationV1;
};
export declare type MessageCreateLocationV1 = {
type: 'shared_coordinate';
shared_coordinate: {
coordinates: CoordinateV1;
};
} | {
type: 'shared_place';
shared_place: {
place: {
id: string;
};
};
};
export interface SendDMV1Params extends MessageCreateDataV1 {
recipient_id: string;
custom_profile_id?: string;
}
export interface CreateDMEventV1Args {
event: CreateDMEventV1;
}
export interface CreateDMEventV1 {
type: EDirectMessageEventTypeV1;
[EDirectMessageEventTypeV1.Create]?: MessageCreateEventV1;
}
export interface GetDmListV1Args {
cursor?: string;
count?: number;
}
export interface CreateWelcomeDMEventV1Args {
[EDirectMessageEventTypeV1.WelcomeCreate]: {
name: string;
message_data: MessageCreateDataV1;
};
}
export interface DirectMessageCreateV1 extends RecievedDirectMessageEventV1 {
type: EDirectMessageEventTypeV1.Create;
[EDirectMessageEventTypeV1.Create]: ReceivedMessageCreateEventV1;
}
export interface RecievedDirectMessageEventV1 {
type: EDirectMessageEventTypeV1;
id: string;
created_timestamp: string;
initiated_via?: {
tweet_id?: string;
welcome_message_id?: string;
};
}
export interface ReceivedMessageCreateEventV1 {
target: {
recipient_id: string;
};
sender_id: string;
source_app_id: string;
message_data: ReceivedMessageCreateDataV1;
custom_profile_id?: string;
}
export interface ReceivedMessageCreateDataV1 {
text: string;
entities: TweetEntitiesV1;
quick_reply_response?: {
type: 'options';
metadata?: string;
};
attachment?: MediaEntityV1;
quick_reply?: MessageCreateQuickReplyV1;
ctas?: MessageCreateCtaV1[];
}
export interface ReceivedWelcomeDMCreateEventV1 {
id: string;
created_timestamp: string;
message_data: ReceivedMessageCreateDataV1;
name?: string;
}
export declare type DirectMessageCreateV1Result = {
event: DirectMessageCreateV1;
} & ReceivedDMAppsV1;
export interface ReceivedDMAppsV1 {
apps?: ReceivedDMAppListV1;
}
export declare type TReceivedDMEvent = DirectMessageCreateV1;
export interface ReceivedDMEventV1 extends ReceivedDMAppsV1 {
event: TReceivedDMEvent;
}
export interface ReceivedDMEventsV1 extends ReceivedDMAppsV1 {
next_cursor?: string;
events: TReceivedDMEvent[];
}
export interface ReceivedDMAppListV1 {
[appId: string]: {
id: string;
name: string;
url: string;
};
}
export interface WelcomeDirectMessageCreateV1Result extends ReceivedDMAppsV1 {
[EDirectMessageEventTypeV1.WelcomeCreate]: ReceivedWelcomeDMCreateEventV1;
name?: string;
}
export interface WelcomeDirectMessageListV1Result extends ReceivedDMAppsV1 {
next_cursor?: string;
welcome_messages: ReceivedWelcomeDMCreateEventV1[];
}
export interface CreateWelcomeDmRuleV1 {
welcome_message_id: string;
}
export interface WelcomeDmRuleV1 extends CreateWelcomeDmRuleV1 {
id: string;
created_timestamp: string;
}
export interface WelcomeDmRuleV1Result {
welcome_message_rule: WelcomeDmRuleV1;
}
export interface WelcomeDmRuleListV1Result {
next_cursor?: string;
welcome_message_rules?: WelcomeDmRuleV1[];
}

View File

@ -0,0 +1,9 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EDirectMessageEventTypeV1 = void 0;
// Creation of DMs
var EDirectMessageEventTypeV1;
(function (EDirectMessageEventTypeV1) {
EDirectMessageEventTypeV1["Create"] = "message_create";
EDirectMessageEventTypeV1["WelcomeCreate"] = "welcome_message";
})(EDirectMessageEventTypeV1 = exports.EDirectMessageEventTypeV1 || (exports.EDirectMessageEventTypeV1 = {}));

View File

@ -0,0 +1,142 @@
export interface TweetEntitiesV1 {
hashtags?: HashtagEntityV1[];
urls?: UrlEntityV1[];
user_mentions?: MentionEntityV1[];
symbols?: SymbolEntityV1[];
media?: MediaEntityV1[];
polls?: [PollEntityV1];
}
export interface TweetExtendedEntitiesV1 {
media?: MediaEntityV1[];
}
export interface UserEntitiesV1 {
url?: {
urls: UrlEntityV1[];
};
description?: {
urls: UrlEntityV1[];
};
}
export interface UrlEntityV1 {
display_url: string;
expanded_url: string;
indices: [number, number];
url: string;
unwound?: {
url: string;
status: number;
title: string;
description: string;
};
}
export interface MediaEntityV1 {
display_url: string;
expanded_url: string;
url: string;
id: number;
id_str: string;
indices: [number, number];
media_url: string;
media_url_https: string;
sizes: MediaSizesV1;
source_status_id: number;
source_status_id_str: string;
source_user_id: number;
source_user_id_str: string;
type: 'photo' | 'video' | 'animated_gif';
video_info?: MediaVideoInfoV1;
additional_media_info?: AdditionalMediaInfoV1;
ext_alt_text?: string;
}
export interface MediaVideoInfoV1 {
aspect_ratio: [number, number];
duration_millis: number;
variants: {
bitrate: number;
content_type: string;
url: string;
}[];
}
export interface AdditionalMediaInfoV1 {
title: string;
description: string;
embeddable: boolean;
monetizable: boolean;
}
export interface MediaSizesV1 {
thumb: MediaSizeObjectV1;
large: MediaSizeObjectV1;
medium: MediaSizeObjectV1;
small: MediaSizeObjectV1;
}
export interface MediaSizeObjectV1 {
w: number;
h: number;
resize: 'crop' | 'fit';
}
export interface HashtagEntityV1 {
indices: [number, number];
text: string;
}
export interface MentionEntityV1 {
id: number;
id_str: string;
indices: [number, number];
name: string;
screen_name: string;
}
export interface SymbolEntityV1 {
indices: [number, number];
text: string;
}
export interface PollEntityV1 {
options: PollPositionV1[];
end_datetime: string;
duration_minutes: number;
}
export interface PollPositionV1 {
position: number;
text: string;
}
/** See GeoJSON. */
export interface CoordinateV1 {
coordinates: number[] | number[][];
type: string;
}
export interface PlaceV1 {
full_name: string;
id: string;
url: string;
country: string;
country_code: string;
bounding_box: CoordinateV1;
name: string;
place_type: string;
contained_within?: PlaceV1[];
geometry?: any;
polylines?: number[];
centroid?: number[];
attributes?: {
geotagCount: string;
[geoTagId: string]: string;
};
}
export interface TrendV1 {
name: string;
url: string;
promoted_content?: boolean;
query: string;
tweet_volume: number;
}
export interface TrendLocationV1 {
name: string;
woeid: number;
url?: string;
placeType?: {
code: number;
name: string;
};
parentid?: number;
country?: string;
countryCode?: string;
}

View File

@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View File

@ -0,0 +1,32 @@
import { PlaceV1 } from './entities.v1.types';
export interface ReverseGeoCodeV1Params {
lat: number;
long: number;
accuracy?: string;
granularity?: 'city' | 'neighborhood' | 'country' | 'admin';
max_results?: number;
}
export interface ReverseGeoCodeV1Result {
query: {
params: Partial<ReverseGeoCodeV1Params>;
type: string;
url: string;
};
result: {
places: PlaceV1[];
};
}
export interface SearchGeoV1Params extends Partial<ReverseGeoCodeV1Params> {
ip?: string;
query?: string;
}
export interface SearchGeoV1Result {
query: {
params: SearchGeoV1Params;
type: string;
url: string;
};
result: {
places: PlaceV1[];
};
}

View File

@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View File

@ -0,0 +1,9 @@
export * from './streaming.v1.types';
export * from './tweet.v1.types';
export * from './entities.v1.types';
export * from './user.v1.types';
export * from './dev-utilities.v1.types';
export * from './geo.v1.types';
export * from './trends.v1.types';
export * from './dm.v1.types';
export * from './list.v1.types';

View File

@ -0,0 +1,25 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./streaming.v1.types"), exports);
__exportStar(require("./tweet.v1.types"), exports);
__exportStar(require("./entities.v1.types"), exports);
__exportStar(require("./user.v1.types"), exports);
__exportStar(require("./dev-utilities.v1.types"), exports);
__exportStar(require("./geo.v1.types"), exports);
__exportStar(require("./trends.v1.types"), exports);
__exportStar(require("./dm.v1.types"), exports);
__exportStar(require("./list.v1.types"), exports);

View File

@ -0,0 +1,87 @@
import { TweetV1TimelineParams } from './tweet.v1.types';
import { UserV1 } from './user.v1.types';
export interface ListV1 {
id: number;
id_str: string;
slug: string;
name: string;
full_name: string;
created_at: string;
description: string;
uri: string;
subscriber_count: number;
member_count: number;
mode: 'public' | 'private';
user: UserV1;
}
declare type TUserOrScreenName = {
user_id: string;
} | {
screen_name: string;
};
export declare type ListListsV1Params = Partial<TUserOrScreenName> & {
reverse?: boolean;
};
export interface GetListV1Params {
list_id?: string;
slug?: string;
owner_screen_name?: string;
owner_id?: string;
}
export interface ListMemberShowV1Params extends GetListV1Params {
include_entities?: boolean;
skip_status?: boolean;
user_id?: string;
screen_name?: string;
tweet_mode?: 'compat' | 'extended';
}
export interface ListMembersV1Params extends GetListV1Params {
count?: number;
cursor?: string;
include_entities?: boolean;
skip_status?: boolean;
tweet_mode?: 'compat' | 'extended';
}
export interface ListOwnershipsV1Params {
user_id?: string;
screen_name?: string;
count?: number;
cursor?: string;
include_entities?: boolean;
skip_status?: boolean;
tweet_mode?: 'compat' | 'extended';
}
export declare type ListSubscriptionsV1Params = ListOwnershipsV1Params;
export interface ListMembershipsV1Params extends ListOwnershipsV1Params {
filter_to_owned_lists?: boolean;
}
export interface ListStatusesV1Params extends TweetV1TimelineParams, GetListV1Params {
include_rts?: boolean;
}
export interface ListCreateV1Params {
name: string;
mode?: 'public' | 'private';
description?: string;
tweet_mode?: 'compat' | 'extended';
}
export interface AddOrRemoveListMembersV1Params extends GetListV1Params {
user_id?: string | string[];
screen_name?: string | string[];
}
export interface UpdateListV1Params extends Partial<ListCreateV1Params>, GetListV1Params {
}
export interface DoubleEndedListsCursorV1Result {
next_cursor?: string;
next_cursor_str?: string;
previous_cursor?: string;
previous_cursor_str?: string;
lists: ListV1[];
}
export interface DoubleEndedUsersCursorV1Result {
next_cursor?: string;
next_cursor_str?: string;
previous_cursor?: string;
previous_cursor_str?: string;
users: UserV1[];
}
export {};

View File

@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View File

@ -0,0 +1,27 @@
import type { TypeOrArrayOf } from '../shared.types';
export interface AskTweetStreamV1Params {
tweet_mode?: 'extended' | 'compat';
/** Specifies whether stall warnings should be delivered. */
stall_warnings: boolean;
}
/**
* See https://developer.twitter.com/en/docs/twitter-api/v1/tweets/filter-realtime/guides/basic-stream-parameters
* for detailed documentation.
*/
export interface FilterStreamV1Params extends AskTweetStreamV1Params {
/** A list of user IDs, indicating the users to return statuses for in the stream. */
follow: TypeOrArrayOf<(string | BigInt)>;
/** Keywords to track. */
track: TypeOrArrayOf<string>;
/** Specifies a set of bounding boxes to track. */
locations: TypeOrArrayOf<{
lng: string;
lat: string;
}>;
/** Specifies whether stall warnings should be delivered. */
stall_warnings: boolean;
[otherParameter: string]: any;
}
export interface SampleStreamV1Params extends AskTweetStreamV1Params {
[otherParameter: string]: any;
}

View File

@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View File

@ -0,0 +1,10 @@
import { TrendLocationV1, TrendV1 } from './entities.v1.types';
export interface TrendsPlaceV1Params {
exclude: string;
}
export interface TrendMatchV1 {
trends: TrendV1[];
as_of: string;
created_at: string;
locations: TrendLocationV1[];
}

View File

@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View File

@ -0,0 +1,199 @@
/// <reference types="node" />
import type { BooleanString, NumberString } from '../shared.types';
import type * as fs from 'fs';
import { UserV1 } from './user.v1.types';
import { CoordinateV1, PlaceV1, TweetEntitiesV1, TweetExtendedEntitiesV1 } from './entities.v1.types';
export interface TweetV1 {
created_at: string;
id: number;
id_str: string;
text: string;
full_text?: string;
source: string;
truncated: boolean;
in_reply_to_status_id: number | null;
in_reply_to_status_id_str: string | null;
in_reply_to_user_id: number | null;
in_reply_to_user_id_str: string | null;
in_reply_to_screen_name: string | null;
user: UserV1;
coordinates: CoordinateV1 | null;
place: PlaceV1 | null;
quoted_status_id: number;
quoted_status_id_str: string;
is_quote_status: boolean;
quoted_status?: TweetV1;
retweeted_status?: TweetV1;
quote_count?: number;
reply_count?: number;
retweet_count: number;
favorite_count: number;
entities: TweetEntitiesV1;
extended_entities?: TweetExtendedEntitiesV1;
favorited: boolean | null;
retweeted: boolean;
possibly_sensitive: boolean | null;
filter_level: 'none' | 'low' | 'medium' | 'high';
lang: string;
display_text_range?: [number, number];
current_user_retweet?: {
id: number;
id_str: string;
};
withheld_copyright?: boolean;
withheld_in_countries?: string[];
withheld_scope?: string;
card_uri?: string;
}
export interface TweetShowV1Params {
tweet_mode?: 'compat' | 'extended';
id?: string;
trim_user?: boolean;
include_my_retweet?: boolean;
include_entities?: boolean;
include_ext_alt_text?: boolean;
include_card_uri?: boolean;
}
export declare type TweetLookupV1Params = {
id?: string | string[];
map?: boolean;
} & Omit<TweetShowV1Params, 'include_my_retweet'>;
export declare type TweetLookupNoMapV1Params = TweetLookupV1Params & {
map?: false;
};
export declare type TweetLookupMapV1Params = TweetLookupV1Params & {
map: true;
};
export interface AskTweetV1Params {
tweet_mode?: 'extended' | 'compat';
include_entities?: boolean;
trim_user?: boolean;
}
export interface TweetV1TimelineParams extends AskTweetV1Params {
count?: number;
since_id?: string;
max_id?: string;
exclude_replies?: boolean;
}
export interface TweetV1UserTimelineParams extends TweetV1TimelineParams {
user_id?: string;
screen_name?: string;
include_rts?: boolean;
}
export interface SendTweetV1Params extends AskTweetV1Params {
status: string;
in_reply_to_status_id?: string;
auto_populate_reply_metadata?: BooleanString;
exclude_reply_user_ids?: string;
attachment_url?: string;
media_ids?: string | string[];
possibly_sensitive?: BooleanString;
lat?: NumberString;
long?: NumberString;
display_coordinates?: BooleanString;
enable_dmcommands?: BooleanString;
fail_dmcommands?: BooleanString;
card_uri?: string;
place_id?: string;
}
export declare type TUploadTypeV1 = 'mp4' | 'longmp4' | 'gif' | 'jpg' | 'png' | 'srt' | 'webp';
export declare enum EUploadMimeType {
Jpeg = "image/jpeg",
Mp4 = "video/mp4",
Gif = "image/gif",
Png = "image/png",
Srt = "text/plain",
Webp = "image/webp"
}
export interface UploadMediaV1Params {
/** @deprecated Directly use `mimeType` parameter with one of the allowed MIME types in `EUploadMimeType`. */
type: TUploadTypeV1 | string;
mimeType: EUploadMimeType | string;
target: 'tweet' | 'dm';
chunkLength: number;
shared: boolean;
longVideo: boolean;
additionalOwners: string | string[];
maxConcurrentUploads: number;
}
export interface MediaMetadataV1Params {
alt_text?: {
text: string;
};
}
export interface MediaSubtitleV1Param {
media_id: string;
language_code: string;
display_name: string;
}
/**
* Link to a file that is usable as media.
* - `string`: File path
* - `Buffer`: File content, as binary buffer
* - `fs.promises.FileHandle`: Opened file with `fs.promises`
* - `number`: Opened file with `fs` classic functions
*/
export declare type TUploadableMedia = string | Buffer | fs.promises.FileHandle | number;
export interface OembedTweetV1Params {
url: string;
maxwidth?: number;
hide_media?: boolean;
hide_thread?: boolean;
omit_script?: boolean;
align?: 'left' | 'right' | 'center' | 'none';
related?: string;
lang?: string;
theme?: 'light' | 'dark';
link_color?: string;
widget_type?: 'video';
dnt?: boolean;
}
export declare type TweetV1TimelineResult = TweetV1[];
export interface InitMediaV1Result {
media_id: number;
media_id_string: string;
size: number;
expires_after_secs: number;
image: {
image_type: string;
w: number;
h: number;
};
}
export interface MediaStatusV1Result {
media_id: number;
media_id_string: string;
size: number;
expires_after_secs: number;
video?: {
video_type: string;
};
processing_info?: {
state: 'pending' | 'failed' | 'succeeded' | 'in_progress';
check_after_secs?: number;
progress_percent?: number;
error?: {
code: number;
name: string;
message: string;
};
};
}
export interface OembedTweetV1Result {
url: string;
author_name: string;
author_url: string;
html: string;
width: number;
height: number | null;
type: string;
cache_age: string;
provider_name: string;
provider_url: string;
version: string;
}
export interface TweetLookupMapV1Result {
id: {
[tweetId: string]: TweetV1 | null;
};
}

View File

@ -0,0 +1,12 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EUploadMimeType = void 0;
var EUploadMimeType;
(function (EUploadMimeType) {
EUploadMimeType["Jpeg"] = "image/jpeg";
EUploadMimeType["Mp4"] = "video/mp4";
EUploadMimeType["Gif"] = "image/gif";
EUploadMimeType["Png"] = "image/png";
EUploadMimeType["Srt"] = "text/plain";
EUploadMimeType["Webp"] = "image/webp";
})(EUploadMimeType = exports.EUploadMimeType || (exports.EUploadMimeType = {}));

View File

@ -0,0 +1,231 @@
import { UserEntitiesV1 } from './entities.v1.types';
import { TweetV1 } from './tweet.v1.types';
export interface UserV1 {
id_str: string;
id: number;
name: string;
screen_name: string;
location: string;
derived?: any;
url: string | null;
description: string | null;
protected: boolean;
verified: boolean;
followers_count: number;
friends_count: number;
listed_count: number;
favourites_count: number;
statuses_count: number;
created_at: string;
profile_banner_url: string;
profile_image_url_https: string;
default_profile: boolean;
default_profile_image: boolean;
withheld_in_countries: string[];
withheld_scope: string;
entities?: UserEntitiesV1;
/** Only on account/verify_credentials with include_email: true */
email?: string;
}
declare type TUserIdOrScreenName = {
user_id: string;
} | {
screen_name: string;
};
declare type TUserObjectParams = {
include_entities?: boolean;
skip_status?: boolean;
tweet_mode?: 'extended' | 'compat';
};
export interface DoubleEndedIdCursorV1Result {
next_cursor?: string;
next_cursor_str?: string;
previous_cursor?: string;
previous_cursor_str?: string;
ids: string[];
}
export interface DoubleEndedIdCursorV1Params {
stringify_ids?: boolean;
cursor?: string;
}
export interface VerifyCredentialsV1Params {
include_entities?: boolean;
skip_status?: boolean;
include_email?: boolean;
}
export interface MuteUserListV1Params {
cursor?: string;
include_entities?: boolean;
skip_status?: string;
tweet_mode?: 'extended';
}
export declare type MuteUserIdsV1Params = DoubleEndedIdCursorV1Params;
export interface ReportSpamV1Params {
screen_name?: string;
user_id?: string;
perform_block?: boolean;
}
export interface UserSearchV1Params {
q?: string;
page?: number;
count?: number;
include_entities?: boolean;
tweet_mode?: 'extended';
}
export interface AccountSettingsV1Params {
sleep_time_enabled?: boolean;
start_sleep_time?: number;
end_sleep_time?: number;
time_zone?: string;
trend_location_woeid?: number;
lang?: string;
}
export interface AccountProfileV1Params {
name?: string;
url?: string;
location?: string;
description?: string;
profile_link_color?: string;
include_entities?: boolean;
skip_status?: boolean;
tweet_mode?: 'extended';
}
export declare type ProfileBannerSizeV1Params = TUserIdOrScreenName;
export interface ProfileBannerUpdateV1Params {
width?: number;
height?: number;
offset_left?: number;
offset_top?: number;
}
export declare type ProfileImageUpdateV1Params = TUserObjectParams;
export interface FriendshipShowV1Params {
source_id?: string;
source_screen_name?: string;
target_id?: string;
target_screen_name?: string;
}
export interface FriendshipLookupV1Params {
screen_name?: string | string[];
user_id?: string | string[];
}
export declare type FriendshipsIncomingV1Params = DoubleEndedIdCursorV1Params;
export interface FriendshipUpdateV1Params {
screen_name?: string;
user_id?: string;
device?: boolean;
retweets?: boolean;
}
export interface FriendshipCreateV1Params {
screen_name?: string;
user_id?: string;
follow?: boolean;
}
export interface FriendshipDestroyV1Params {
screen_name?: string;
user_id?: string;
}
export declare type UserShowV1Params = TUserIdOrScreenName & TUserObjectParams;
export declare type UserLookupV1Params = {
user_id?: string | string[];
screen_name?: string | string[];
} & TUserObjectParams;
export interface MuteUserListV1Result {
next_cursor?: string;
next_cursor_str?: string;
previous_cursor?: string;
previous_cursor_str?: string;
users: UserV1[];
}
export declare type MuteUserIdsV1Result = DoubleEndedIdCursorV1Result;
export interface BannerSizeV1 {
h: number;
w: number;
url: string;
}
export interface ProfileBannerSizeV1 {
sizes: {
ipad: BannerSizeV1;
ipad_retina: BannerSizeV1;
web: BannerSizeV1;
web_retina: BannerSizeV1;
mobile: BannerSizeV1;
mobile_retina: BannerSizeV1;
'300x100': BannerSizeV1;
'600x200': BannerSizeV1;
'1500x500': BannerSizeV1;
};
}
export interface AccountSettingsV1 {
time_zone: {
name: string;
utc_offset: number;
tzinfo_name: string;
};
protected: boolean;
screen_name: string;
always_use_https: boolean;
use_cookie_personalization: boolean;
sleep_time: {
enabled: boolean;
end_time: string | null;
start_time: string | null;
};
geo_enabled: boolean;
language: string;
discoverable_by_email: boolean;
discoverable_by_mobile_phone: boolean;
display_sensitive_media: boolean;
allow_contributor_request: 'all' | 'following' | string;
allow_dms_from: 'all' | 'following' | string;
allow_dm_groups_from: 'all' | 'following' | string;
translator_type: string;
trend_location: {
name: string;
countryCode: string;
url: string;
woeid: number;
placeType: {
name: string;
code: number;
};
parentid: number | null;
country: string;
}[];
}
export declare type TFriendshipConnectionV1 = 'following' | 'following_requested' | 'followed_by' | 'none' | 'blocking' | 'muting';
export interface FriendshipRelationObjectV1 {
id: number;
id_str: string;
screen_name: string;
following: boolean;
followed_by: boolean;
live_following?: boolean;
following_received: boolean | null;
following_requested: boolean | null;
notifications_enabled?: boolean | null;
can_dm?: boolean | null;
blocking?: boolean | null;
blocked_by?: boolean | null;
muting?: boolean | null;
want_retweets?: boolean | null;
all_replies?: boolean | null;
marked_spam?: boolean | null;
}
export interface FriendshipV1 {
relationship: {
source: FriendshipRelationObjectV1;
target: FriendshipRelationObjectV1;
};
}
export interface FriendshipCreateOrDestroyV1 extends UserV1 {
status: TweetV1;
}
export interface FriendshipLookupV1 {
name: string;
screen_name: string;
id: number;
id_str: string;
connections: TFriendshipConnectionV1[];
}
export declare type FriendshipsIncomingV1Result = DoubleEndedIdCursorV1Result;
export {};

View File

@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View File

@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View File

@ -0,0 +1,5 @@
"use strict";
// ---------------
// -- Streaming --
// ---------------
Object.defineProperty(exports, "__esModule", { value: true });

View File

@ -0,0 +1,203 @@
import type { UserV2 } from './user.v2.types';
export interface PlaceV2 {
full_name: string;
id: string;
contained_within?: string[];
country?: string;
country_code?: string;
geo?: {
type: string;
bbox: number[];
properties: any;
};
name?: string;
place_type?: string;
}
export interface PlaybackCountV2 {
playback_0_count: number;
playback_25_count: number;
playback_50_count: number;
playback_75_count: number;
playback_100_count: number;
}
export declare type OrganicMetricV2 = PlaybackCountV2 & {
view_count: number;
};
export interface MediaVariantsV2 {
bit_rate?: number;
content_type: 'video/mp4' | 'application/x-mpegURL' | string;
url: string;
}
export interface MediaObjectV2 {
media_key: string;
type: 'video' | 'animated_gif' | 'photo' | string;
duration_ms?: number;
height?: number;
width?: number;
url?: string;
preview_image_url?: string;
alt_text?: string;
non_public_metrics?: PlaybackCountV2;
organic_metrics?: OrganicMetricV2;
promoted_metrics?: OrganicMetricV2;
public_metrics?: {
view_count: number;
};
variants?: MediaVariantsV2[];
}
export interface PollV2 {
id: string;
options: {
position: number;
label: string;
votes: number;
}[];
duration_minutes?: number;
end_datetime?: string;
voting_status?: string;
}
export interface ReferencedTweetV2 {
type: 'retweeted' | 'quoted' | 'replied_to';
id: string;
}
export interface TweetAttachmentV2 {
media_keys?: string[];
poll_ids?: string[];
}
export interface TweetGeoV2 {
coordinates: {
type: string;
coordinates: [number, number] | null;
};
place_id: string;
}
interface TweetContextAnnotationItemV2 {
id: string;
name: string;
description?: string;
}
export declare type TweetContextAnnotationDomainV2 = TweetContextAnnotationItemV2;
export declare type TweetContextAnnotationEntityV2 = TweetContextAnnotationItemV2;
export interface TweetContextAnnotationV2 {
domain: TweetContextAnnotationDomainV2;
entity: TweetContextAnnotationEntityV2;
}
export interface TweetEntityAnnotationsV2 {
start: number;
end: number;
probability: number;
type: string;
normalized_text: string;
}
export interface TweetEntityUrlV2 {
start: number;
end: number;
url: string;
expanded_url: string;
display_url: string;
unwound_url: string;
title?: string;
description?: string;
status?: string;
images?: TweetEntityUrlImageV2[];
}
export interface TweetEntityUrlImageV2 {
url: string;
width: number;
height: number;
}
export interface TweetEntityHashtagV2 {
start: number;
end: number;
tag: string;
}
export interface TweetEntityMentionV2 {
start: number;
end: number;
username: string;
id: string;
}
export interface TweetEntitiesV2 {
annotations: TweetEntityAnnotationsV2[];
urls: TweetEntityUrlV2[];
hashtags: TweetEntityHashtagV2[];
cashtags: TweetEntityHashtagV2[];
mentions: TweetEntityMentionV2[];
}
export interface TweetWithheldInfoV2 {
copyright: boolean;
country_codes: string[];
scope: 'tweet' | 'user';
}
export interface TweetPublicMetricsV2 {
retweet_count: number;
reply_count: number;
like_count: number;
quote_count: number;
}
export interface TweetNonPublicMetricsV2 {
impression_count: number;
url_link_clicks: number;
}
export interface TweetOrganicMetricsV2 {
impression_count: number;
url_link_clicks: number;
user_profile_clicks: number;
retweet_count: number;
reply_count: number;
like_count: number;
}
export declare type TweetPromotedMetricsV2 = TweetOrganicMetricsV2;
export declare type TTweetReplySettingsV2 = 'mentionedUsers' | 'following' | 'everyone';
export interface SendTweetV2Params {
direct_message_deep_link?: string;
for_super_followers_only?: 'True' | 'False';
geo?: {
place_id: string;
};
media?: {
media_ids?: string[];
tagged_user_ids?: string[];
};
poll?: {
duration_minutes: number;
options: string[];
};
quote_tweet_id?: string;
reply?: {
exclude_reply_user_ids?: string[];
in_reply_to_tweet_id: string;
};
reply_settings?: TTweetReplySettingsV2 | string;
text?: string;
}
export interface TweetV2 {
id: string;
text: string;
created_at?: string;
author_id?: string;
conversation_id?: string;
in_reply_to_user_id?: string;
referenced_tweets?: ReferencedTweetV2[];
attachments?: TweetAttachmentV2;
geo?: TweetGeoV2;
context_annotations?: TweetContextAnnotationV2[];
entities?: TweetEntitiesV2;
withheld?: TweetWithheldInfoV2;
public_metrics?: TweetPublicMetricsV2;
non_public_metrics?: TweetNonPublicMetricsV2;
organic_metrics?: TweetOrganicMetricsV2;
promoted_metrics?: TweetPromotedMetricsV2;
possibly_sensitive?: boolean;
lang?: string;
reply_settings?: 'everyone' | 'mentionedUsers' | 'following';
source?: string;
}
export interface ApiV2Includes {
tweets?: TweetV2[];
users?: UserV2[];
places?: PlaceV2[];
media?: MediaObjectV2[];
polls?: PollV2[];
}
export {};

View File

@ -0,0 +1,150 @@
/// <reference types="node" />
import type { TweetV2, ApiV2Includes } from './tweet.definition.v2';
import type { TypeOrArrayOf } from '../shared.types';
import type { DataAndIncludeV2, DataAndMetaV2, DataMetaAndIncludeV2, DataV2, MetaV2 } from './shared.v2.types';
import { UserV2 } from './user.v2.types';
export interface TweetV2TimelineParams extends Partial<Tweetv2FieldsParams> {
/** ISO date string */
end_time?: string;
/** ISO date string */
start_time?: string;
max_results?: number;
since_id?: string;
until_id?: string;
next_token?: string;
}
export interface Tweetv2SearchParams extends TweetV2TimelineParams {
previous_token?: string;
query: string;
sort_order?: 'recency' | 'relevancy';
}
export interface TweetV2PaginableTimelineParams extends TweetV2TimelineParams {
pagination_token?: string;
}
export interface TweetV2PaginableListParams extends Partial<Tweetv2FieldsParams> {
pagination_token?: string;
max_results?: number;
}
export interface TweetV2UserTimelineParams extends TweetV2PaginableTimelineParams {
exclude?: TypeOrArrayOf<'retweets' | 'replies'>;
}
export interface TweetV2HomeTimelineParams extends TweetV2UserTimelineParams {
}
export declare type TTweetv2Expansion = 'attachments.poll_ids' | 'attachments.media_keys' | 'author_id' | 'referenced_tweets.id' | 'in_reply_to_user_id' | 'geo.place_id' | 'entities.mentions.username' | 'referenced_tweets.id.author_id';
export declare type TTweetv2MediaField = 'duration_ms' | 'height' | 'media_key' | 'preview_image_url' | 'type' | 'url' | 'width' | 'public_metrics' | 'non_public_metrics' | 'organic_metrics' | 'alt_text' | 'variants';
export declare type TTweetv2PlaceField = 'contained_within' | 'country' | 'country_code' | 'full_name' | 'geo' | 'id' | 'name' | 'place_type';
export declare type TTweetv2PollField = 'duration_minutes' | 'end_datetime' | 'id' | 'options' | 'voting_status';
export declare type TTweetv2TweetField = 'attachments' | 'author_id' | 'context_annotations' | 'conversation_id' | 'created_at' | 'entities' | 'geo' | 'id' | 'in_reply_to_user_id' | 'lang' | 'public_metrics' | 'non_public_metrics' | 'promoted_metrics' | 'organic_metrics' | 'possibly_sensitive' | 'referenced_tweets' | 'reply_settings' | 'source' | 'text' | 'withheld';
export declare type TTweetv2UserField = 'created_at' | 'description' | 'entities' | 'id' | 'location' | 'name' | 'pinned_tweet_id' | 'profile_image_url' | 'protected' | 'public_metrics' | 'url' | 'username' | 'verified' | 'withheld';
export interface Tweetv2FieldsParams {
expansions: TypeOrArrayOf<TTweetv2Expansion> | string;
'media.fields': TypeOrArrayOf<TTweetv2MediaField> | string;
'place.fields': TypeOrArrayOf<TTweetv2PlaceField> | string;
'poll.fields': TypeOrArrayOf<TTweetv2PollField> | string;
'tweet.fields': TypeOrArrayOf<TTweetv2TweetField> | string;
'user.fields': TypeOrArrayOf<TTweetv2UserField> | string;
}
export interface TweetSearchV2StreamParams extends Tweetv2FieldsParams {
backfill_minutes: number;
}
export interface TweetV2CountParams {
query: string;
end_time?: string;
start_time?: string;
until_id?: string;
since_id?: string;
granularity?: 'day' | 'hour' | 'minute';
}
export interface TweetV2CountAllParams extends TweetV2CountParams {
next_token: string;
}
export declare type TweetV2CountResult = DataAndMetaV2<{
start: string;
end: string;
tweet_count: number;
}[], {
total_tweet_count: number;
}>;
export declare type TweetV2CountAllResult = TweetV2CountResult & MetaV2<{
next_token: string;
}>;
export declare type Tweetv2TimelineResult = DataMetaAndIncludeV2<TweetV2[], {
newest_id: string;
oldest_id: string;
result_count: number;
next_token?: string;
}, ApiV2Includes>;
export declare type Tweetv2ListResult = DataMetaAndIncludeV2<TweetV2[], {
result_count: number;
next_token?: string;
previous_token?: string;
}, ApiV2Includes>;
export declare type Tweetv2SearchResult = Tweetv2TimelineResult;
export declare type TweetV2PaginableTimelineResult = Tweetv2TimelineResult & MetaV2<{
previous_token?: string;
}>;
export declare type TweetV2UserTimelineResult = TweetV2PaginableTimelineResult;
export declare type TweetV2HomeTimelineResult = TweetV2PaginableTimelineResult;
export declare type TweetV2LookupResult = DataAndIncludeV2<TweetV2[], ApiV2Includes>;
export declare type TweetV2SingleResult = DataAndIncludeV2<TweetV2, ApiV2Includes>;
export declare type TweetV2SingleStreamResult = TweetV2SingleResult & {
matching_rules: {
id: string | number;
tag: string;
}[];
};
export declare type TweetV2PostTweetResult = DataV2<{
id: string;
text: string;
}>;
export declare type TweetV2HideReplyResult = DataV2<{
hidden: boolean;
}>;
export declare type TweetV2LikeResult = DataV2<{
liked: boolean;
}>;
export declare type TweetV2LikedByResult = DataMetaAndIncludeV2<UserV2[], {
result_count: number;
next_token?: string;
previous_token?: string;
}, ApiV2Includes>;
export declare type TweetV2RetweetResult = DataV2<{
retweeted: boolean;
}>;
export declare type TweetV2RetweetedByResult = TweetV2LikedByResult;
export declare type TweetV2BookmarkResult = DataV2<{
bookmarked: boolean;
}>;
export declare type TweetV2DeleteTweetResult = DataV2<{
deleted: boolean;
}>;
export interface BatchComplianceJobV2 {
resumable: false;
type: 'tweets' | 'users';
download_expires_at: string;
created_at: string;
upload_url: string;
download_url: string;
id: string;
status: 'created' | 'complete' | 'in_progress' | 'expired' | 'failed';
upload_expires_at: string;
error?: string;
}
export interface BatchComplianceSearchV2Params {
type: 'tweets' | 'users';
status?: 'created' | 'complete' | 'in_progress' | 'expired' | 'failed';
}
export interface BatchComplianceV2Params {
type: 'tweets' | 'users';
name?: string;
ids: string[] | Buffer;
}
export interface BatchComplianceV2JobResult {
id: string;
action: 'delete';
created_at: string;
redacted_at?: string;
reason: 'deleted' | 'suspended' | 'protected' | 'scrub_geo' | 'deactivated';
}
export declare type BatchComplianceListV2Result = DataV2<BatchComplianceJobV2[]>;
export declare type BatchComplianceV2Result = DataV2<BatchComplianceJobV2>;