I'm using Twitter API with Servant and I would like to display API URLs as strings. I have the following value of type BaseUrl
:
twitterBaseUrl :: BaseUrl
twitterBaseUrl = BaseUrl
{ baseUrlScheme = Https
, baseUrlHost = "api.twitter.com"
, baseUrlPort = 443
, baseUrlPath = "/2"
}
And the following API type definition
type GetTweets
= RequiredHeader "Authorization" Text
:> "users"
:> Capture "id" Text
:> "tweets"
:> QueryParam "max_results" Int
:> QueryParam "exclude" Text
:> QueryParam "tweet.fields" Text
:> QueryParam "end_time" Text
:> Get '[JSON] (Page [Tweet])
What would be the easiest way to convert these values to the following URL?
https://api.twitter.com/2/users/2164623379/tweets?max_results=5&exclude=retweets&tweet.fields=created_at,public_metrics&end_time=2022-09-01T13%3A52%3A14Z