Skip to content
This repository has been archived by the owner on Nov 5, 2022. It is now read-only.

v0.4.1

Compare
Choose a tag to compare
@Fallenstedt Fallenstedt released this 23 Dec 02:05
· 7 commits to master since this release
15e71f0

0.4.1

Summary

Changes were made to StartStream function. You can now request additional data from each tweet with a NewStreamQueryParamsBuilder

Changes to StartStream

Before

Originally, users who start a stream would need to pass in query params as a string. Users had to ensure they included a question mark. The problem with this approach was users could use unencoded reserved characters in the query string.

err := api.stream.StartStream("?expansions=foo&meta.fields=bar,baz,biz")

In addition, if a user did not want additional data for each tweet, then they would need to use an empty string.

err := api.stream.StartStream("")

After

It is recommended users use a NewStreamQueryParamsBuilder to build query params. Users should use the values described in twitter's documentation to fetch additional data they need for each tweet.

	// Request additional data from teach tweet
	streamExpansions := twitterstream.NewStreamQueryParamsBuilder().
		AddExpansion("author_id").
		AddTweetField("created_at").
		Build()

	// Start the Stream
	err = api.stream.StartStream(streamExpansions)

If no expansions are needed, users can just use nil for the url values.

	err = api.stream.StartStream(nil)