1.0.5 • Published 3 years ago

gettr v1.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Gettr

This package is in development.

A GETTR client library written in TypeScript.

Installation

npm install --save gettr

Usage

import gettr from 'gettr'

API

gettr.User(id: string)

Example: gettr.User('arthurfontaine')

Methods

gettr.User.infos()

Example: gettr.User('arthurfontaine').infos()

Returns a promise that resolves to an object containing the user's infos.

/**
 * @returns {Promise<{infos: UserInfos, body: APIUserInfosBody}>}
 */
gettr.User.posts(max = 20, offset = 0)

Example: gettr.User('arthurfontaine').posts()

Returns a promise that resolves to an array containing the user's posts.

/**
 * @param {number} [max=20]
 * @param {number} [offset=0]
 * @returns {Promise<{posts: gettr.Post[], body: APIUserPostsBody}>}
 */
gettr.User.followers(max = 20, offset = 0)

Example: gettr.User('arthurfontaine').followers()

Returns a promise that resolves to an array containing the user's followers.

/**
 * @param {number} [max=20]
 * @param {number} [offset=0]
 * @returns {Promise<{followers: gettr.User[], body: APIFollowersBody}>}
 */
gettr.User.followings(max = 20, offset = 0)

Example: gettr.User('arthurfontaine').followings()

Returns a promise that resolves to an array containing the user's followings.

/**
 * @param {number} [max=20]
 * @param {number} [offset=0]
 * @returns {Promise<{followings: gettr.User[], body: APIFollowingsBody}>}
 */
gettr.User.isMutualWith(user: gettr.User)

Example: gettr.User('arthurfontaine').isMutualWith(new gettr.User('edwardsnowden'))

Returns a promise that resolves to a boolean indicating if the user is mutual with the given user.

/**
 * @param {gettr.User} user
 * @returns {Promise<boolean>}
 */

Properties

gettr.User.url

Example: gettr.User('arthurfontaine').url

/**
 * @returns {string}
 */

gettr.Post(id: string, content: string, author: gettr.User, date: Date)

Example: gettr.Post('paz2a0ksnx', 'Hello world!', gettr.User('arthurfontaine'), new Date(1636405960355))

Methods

gettr.Post.content()

Example: gettr.Post('paz2a0ksnx').content()

Returns a promise that resolves to the post's content.

/**
 * @returns {Promise<?string>}
 */
gettr.Post.author()

Example: gettr.Post('paz2a0ksnx').author()

Returns a promise that resolves to the post's author.

/**
 * @returns {Promise<?gettr.User>}
 */
gettr.Post.date()

Example: gettr.Post('paz2a0ksnx').date()

Returns a promise that resolves to the post's date.

/**
 * @returns {Promise<?Date>}
 */

Properties

gettr.Post.url

Example: gettr.Post('paz2a0ksnx').url

Returns the post's URL.

/**
 * @returns {?string}
 */

Types

UserInfos

/**
 * {
 *   ?username: string,
 *   ?nickname: string,
 *   ?description: string,
 *   ?language: string,
 *   ?location: string,
 *   ?website: string,
 *   ?followers: number,
 *   ?followings: number,
 *   ?joined: Date
 * }
 */

Maintainers

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago