Module: Twitter

Twitter module
Source:

Classes

TwitterRedirect

Members

(inner, constant) firebaseFunctions

It allows to communicate with the firebase DB.
Source:

(inner, constant) LoginWithTwitter

It allows to login with twitter.
Source:

(inner) twRedirect

Source:

Methods

(inner) ActionTw(action, hashtagOrMessage, uid)

ActionTw function is used to perform a specified action on the user's Twitter account. It first retrieves the Twitter UID of the user with the "getDataFromFireBase" function, then it performs the specified action on the user's account with the "doAct" function.
Parameters:
Name Type Description
action string is a string representing the desired action to be performed (e.g. retweet, like, tweet)
hashtagOrMessage string is a string representing the hashtag or message for the desired action.
uid string is the unique identifier for the user on the app.
Source:

(async, inner) carryOutAnAction(appKey, appSecret, bearer, hashtagOrMessage, action, userData)

Uses the Twitter API to perform different actions depending on the action argument. Depending on the value of action, the function can send a tweet, search for tweets and like or retweet them.
Parameters:
Name Type Description
appKey * is an application key provided by Twitter to access their API. It is used to identify the application making the request.
appSecret * is an application secret provided by Twitter to access their API. It is used to secure the requests made by the application.
bearer * is an access token that is used to access certain parts of the Twitter API that require additional authorization.
hashtagOrMessage * is an argument that can be a message or a hashtag depending on the value of the action argument. It is used to send a tweet or to search for tweets.
action * is an argument that determines what action should be performed by the function. It can take the values 'tweet', 'like' or 'retweet'.
userData * required data for TwitterApi
Source:

(inner) doAct(action, hashtagOrMessage, userData)

Allows the user to perform an action (retweet, like, or tweet) on Twitter. It retrieves the necessary information from the Twitter API stored on Firebase. Depending on the action passed as a parameter, it calls the "carryOutAnAction" function to perform the action.
Parameters:
Name Type Description
action string is the desired action to be performed (retweet, like, or tweet)
hashtagOrMessage string is the hashtag or message to be used for the action
userData * required data for TwitterApi
Source:

(inner) loginTwitter(req, res, params)

Uses an external "LoginWithTwitter" package to connect a user to their Twitter account.retrieves the application key and application secret information from Firebase and uses it for "tw" of "LoginWithTwitter". Then, it uses the "login" function of "tw" to redirect the user to a Twitter authorization URL.
Parameters:
Name Type Description
req * is an object that contains information about the HTTP request that called this function
res * is an object that handles the HTTP response that will be sent to the user.
params Object An object containing the Twitter API tokens and the User ID.
Source:

(inner) setUserData(twTokens, uid)

Sets the user data in the Firebase database.
Parameters:
Name Type Description
twTokens Object An object containing the Twitter API tokens.
uid string user ID.
Source:

(inner) signTwitter(req, res)

Is used to process Twitter information after the user has logged into their account. It retrieves the parameters the tokens from the user's request, and those from the api on firebase. Use "tw" for the "callback" function. If this function succeeds, it stores the user's information in the session, then redirects dash.
Parameters:
Name Type Description
req * is an object that contains information about the HTTP request that called this function
res * is an object that handles the HTTP response that will be sent to the user.
Source: