mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-20 14:35:07 +00:00
Commit from GitHub Actions (Publish APIs & Clients)
This commit is contained in:
@@ -25,6 +25,7 @@ import * as stock from "./stock";
|
||||
import * as stream from "./stream";
|
||||
import * as thumbnail from "./thumbnail";
|
||||
import * as time from "./time";
|
||||
import * as twitter from "./twitter";
|
||||
import * as url from "./url";
|
||||
import * as user from "./user";
|
||||
import * as weather from "./weather";
|
||||
@@ -58,6 +59,7 @@ export class Client {
|
||||
this.streamService = new stream.StreamService(token);
|
||||
this.thumbnailService = new thumbnail.ThumbnailService(token);
|
||||
this.timeService = new time.TimeService(token);
|
||||
this.twitterService = new twitter.TwitterService(token);
|
||||
this.urlService = new url.UrlService(token);
|
||||
this.userService = new user.UserService(token);
|
||||
this.weatherService = new weather.WeatherService(token);
|
||||
@@ -90,6 +92,7 @@ export class Client {
|
||||
streamService: stream.StreamService;
|
||||
thumbnailService: thumbnail.ThumbnailService;
|
||||
timeService: time.TimeService;
|
||||
twitterService: twitter.TwitterService;
|
||||
urlService: url.UrlService;
|
||||
userService: user.UserService;
|
||||
weatherService: weather.WeatherService;
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
"./test": "./dist/test/index.js",
|
||||
"./thumbnail": "./dist/thumbnail/index.js",
|
||||
"./time": "./dist/time/index.js",
|
||||
"./twitter": "./dist/twitter/index.js",
|
||||
"./url": "./dist/url/index.js",
|
||||
"./user": "./dist/user/index.js",
|
||||
"./weather": "./dist/weather/index.js"
|
||||
|
||||
@@ -85,7 +85,7 @@ export interface Result {
|
||||
// The associated arabic text
|
||||
text?: string;
|
||||
// The related translations to the text
|
||||
translations?: Interpretation[];
|
||||
translations?: Translation[];
|
||||
// The unique verse id across the Quran
|
||||
verseId?: number;
|
||||
// The verse key e.g 1:1
|
||||
@@ -159,7 +159,7 @@ export interface Verse {
|
||||
// The basic translation of the verse
|
||||
translatedText?: string;
|
||||
// The alternative translations for the verse
|
||||
translations?: Translation[];
|
||||
translations?: Interpretation[];
|
||||
// The phonetic transliteration from arabic
|
||||
transliteration?: string;
|
||||
// The individual words within the verse (Ayah)
|
||||
|
||||
131
clients/ts/twitter/index.ts
Executable file
131
clients/ts/twitter/index.ts
Executable file
@@ -0,0 +1,131 @@
|
||||
import * as m3o from "@m3o/m3o-node";
|
||||
|
||||
export class TwitterService {
|
||||
private client: m3o.Client;
|
||||
|
||||
constructor(token: string) {
|
||||
this.client = new m3o.Client({ token: token });
|
||||
}
|
||||
// Search for tweets with a simple query
|
||||
search(request: SearchRequest): Promise<SearchResponse> {
|
||||
return this.client.call(
|
||||
"twitter",
|
||||
"Search",
|
||||
request
|
||||
) as Promise<SearchResponse>;
|
||||
}
|
||||
// Get the timeline for a given user
|
||||
timeline(request: TimelineRequest): Promise<TimelineResponse> {
|
||||
return this.client.call(
|
||||
"twitter",
|
||||
"Timeline",
|
||||
request
|
||||
) as Promise<TimelineResponse>;
|
||||
}
|
||||
// Get the current global trending topics
|
||||
trends(request: TrendsRequest): Promise<TrendsResponse> {
|
||||
return this.client.call(
|
||||
"twitter",
|
||||
"Trends",
|
||||
request
|
||||
) as Promise<TrendsResponse>;
|
||||
}
|
||||
// Get a user's twitter profile
|
||||
user(request: UserRequest): Promise<UserResponse> {
|
||||
return this.client.call(
|
||||
"twitter",
|
||||
"User",
|
||||
request
|
||||
) as Promise<UserResponse>;
|
||||
}
|
||||
}
|
||||
|
||||
export interface Profile {
|
||||
// the account creation date
|
||||
createdAt?: string;
|
||||
// the user description
|
||||
description?: string;
|
||||
// the follower count
|
||||
followers?: number;
|
||||
// the user id
|
||||
id?: number;
|
||||
// The user's profile picture
|
||||
imageUrl?: string;
|
||||
// the user's location
|
||||
location?: string;
|
||||
// display name of the user
|
||||
name?: string;
|
||||
// if the account is private
|
||||
private?: boolean;
|
||||
// the username
|
||||
username?: string;
|
||||
// if the account is verified
|
||||
verified?: boolean;
|
||||
}
|
||||
|
||||
export interface SearchRequest {
|
||||
// number of tweets to return. default: 20
|
||||
limit?: number;
|
||||
// the query to search for
|
||||
query?: string;
|
||||
}
|
||||
|
||||
export interface SearchResponse {
|
||||
// the related tweets for the search
|
||||
tweets?: Tweet[];
|
||||
}
|
||||
|
||||
export interface TimelineRequest {
|
||||
// number of tweets to return. default: 20
|
||||
limit?: number;
|
||||
// the username to request the timeline for
|
||||
username?: string;
|
||||
}
|
||||
|
||||
export interface TimelineResponse {
|
||||
// The recent tweets for the user
|
||||
tweets?: Tweet[];
|
||||
}
|
||||
|
||||
export interface Trend {
|
||||
// name of the trend
|
||||
name?: string;
|
||||
// the volume of tweets in last 24 hours
|
||||
tweetVolume?: number;
|
||||
// the twitter url
|
||||
url?: string;
|
||||
}
|
||||
|
||||
export interface TrendsRequest {}
|
||||
|
||||
export interface TrendsResponse {
|
||||
// a list of trending topics
|
||||
trends?: Trend[];
|
||||
}
|
||||
|
||||
export interface Tweet {
|
||||
// time of tweet
|
||||
createdAt?: string;
|
||||
// number of times favourited
|
||||
favouritedCount?: number;
|
||||
// id of the tweet
|
||||
id?: number;
|
||||
// number of times retweeted
|
||||
retweetedCount?: number;
|
||||
// text of the tweet
|
||||
text?: string;
|
||||
// username of the person who tweeted
|
||||
username?: string;
|
||||
}
|
||||
|
||||
export interface UserRequest {
|
||||
// the username to lookup
|
||||
username?: string;
|
||||
}
|
||||
|
||||
export interface UserResponse {
|
||||
// The requested user profile
|
||||
profile?: { [key: string]: any };
|
||||
// the current user status
|
||||
status?: Tweet;
|
||||
}
|
||||
Reference in New Issue
Block a user