Skip to content

nixypanda/tw-custserv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tw-custserv

Problem Statement

Write a simple Twitter API client in Haskell. This client simply has to fetch and display Tweets that:

  • Have been re-Tweeted at least once and
  • Contain the hashtag #custserv

Using the application

  • First, you must obtain consumer key and secret from Twitter Application Management page, and you have to set those values to the config json:

  • Create an application (fill in dummy data to the provided form)

  • Now you must prepare OAuth access token and secret

  • Under Key and Access Tokens tab. You will have Application Setting and Your access token generete them

  • Create a config.json file with the above details (sample given below).

    {
      "apiKey": "<Consumer Key (API Key) in Application Setting>",
      "apiSecret": "<Consumer Secret (API Secret) in Application Setting>",
      "accessToken": "<Access Token in Your Access Token>",
      "accessTokenSecret": "<Access Token Secret in Your Access Token>"
    }
  • Run stack build (you may need to run stack setup as well)

  • Run stack exec tw-custserv-exe

About the code

  • It is a stack project so all the things specific to stack apply here as well.
  • src/Types contain all the custom types.
    • Config.hs: the configuration object used to authenticate.
    • Query.hs: the query object (extend it if you want more functionality from queries)
    • Tweets.hs: Representation of a Tweet, Metadata accompnying a search query and The complete search response by twitter
  • src/TwitterAuth.hs contains all the Oauth related functions.
  • src/TwitterCustServ.hs contains everythig else.

Image

App in action

Imprvement

  • User should be able to login with their credentials and not have to setup the config.json

About

A simple twitter client for cli

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages