service

package
v0.0.0-...-eef4e93 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 9, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package service is the service layer of the turdus project

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExtendedTweet

type ExtendedTweet struct {
	FullText string `json:"full_text"`
}

ExtendedTweet represents a extended tweet unitary structure

type Tweet

type Tweet struct {
	CreatedAt     string        `json:"created_at"`
	ID            int           `json:"id"`
	Text          string        `json:"text"`
	FavoriteCount int           `json:"favorite_count"`
	RetweetCount  int           `json:"retweet_count"`
	ExtendedTweet ExtendedTweet `json:"extended_tweet"`
}

Tweet represents a tweet unitary structure

type TweetPayload

type TweetPayload struct {
	Query      string `json:"query"`
	MaxResults int    `json:"maxResults"`
	FromDate   string `json:"fromDate"`
	ToDate     string `json:"toDate"`
	Next       string `json:"next,omitempty"` // Informs if has next page
}

TweetPayload is the payload to sent to twitter api

type TweetResponse

type TweetResponse struct {
	Results []Tweet `json:"results"`
	Next    string  `json:"next,omitempty"` // Informs if has next page
}

TweetResponse is the twitter api response

type TwitterService

type TwitterService struct {
	URL         string
	TokenBearer string
	MaxResults  int
}

TwitterService represents the twitter service structure

func NewTwitterService

func NewTwitterService() TwitterService

NewTwitterService is a TwitterService constructor

func (TwitterService) GetTweets

func (svc TwitterService) GetTweets(author, fromDate, toDate, nextPage string) (*TweetResponse, error)

GetTweets retrieve tweets from the twitter api given specific search

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL