New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

twitter-d

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

twitter-d

TypeScript definitions for Twitter API objects

  • 0.6.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.7K
decreased by-11.8%
Maintainers
1
Weekly downloads
 
Created
Source

twitter.d.ts

Version Status Build Status Dependency Status npm bundle size (minified + gzip)

TypeScript definitions for Twitter API objects.

Carefully constructed with the data from over 400,000 Twitter API status objects. Format will match tweet_mode=extended and include_entities=true parameters set.

Note that the presence of field is not an indication of it being current and accurate part of the documented Twitter API.

Install

npm install --save-dev twitter-d

Usage

The main two interfaces provided are Status and User although there are a number of related interfaces like MediaEntity and AdditionalMediaInfo.

import type { Status as Tweet, User } from 'twitter-d';

function getTweet(): Tweet {
  /* ... */
}
function getUser(): User {
  /* ... */
}

Or if you are using TypeScript 2.9+ you can use import().

function getStatus(): import('twitter-d').Status {
  /* ... */
}

User

In some contexts, using trim_user=true on GET statuses/mentions_timeline, you might get a user object that only includes id and id_str. To test if a User value is a FullUser you can use the isFullUser helper function.

import type { isFullUser, User } from 'twitter-d';

function logUser(user: User) {
  if (isFullUser(user)) {
    console.log(user.name);
  } else {
    throw new Error('User is not type FullUser');
  }
}

Contributing

If you find find an inaccuracy please open an issue and include a status or user ID that demonstrates the difference.

Keywords

FAQs

Package last updated on 22 Mar 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc