api

package
v1.7.3 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2020 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package api is the implementation of the DeviantArt API including the authentication using the Implicit Grant OAuth2

Index

Constants

View Source
const MaxTweetsPerRequest = 200

MaxTweetsPerRequest is the maximum amount of tweets you can retrieve from the API in one request

Variables

This section is empty.

Functions

This section is empty.

Types

type Tweet

type Tweet struct {
	CreatedAt        string `json:"created_at"`
	ID               uint   `json:"id"`
	Text             string `json:"text"`
	ExtendedEntities struct {
		Media []*struct {
			ID            uint   `json:"id"`
			MediaURLHTTPS string `json:"media_url_https"`
			DisplayURL    string `json:"display_url"`
			Type          string `json:"type"`
		} `json:"media"`
	} `json:"extended_entities"`
	RetweetedStatus interface{} `json:"retweeted_status"`
}

Tweet contains the struct to unmarshal twitters API responses

type TwitterAPI

type TwitterAPI struct {
	Session watcherHttp.SessionInterface
	// contains filtered or unexported fields
}

TwitterAPI contains all required items to communicate with the API

func NewTwitterAPI

func NewTwitterAPI(moduleKey string, oAuth2Client *models.OAuthClient) *TwitterAPI

NewTwitterAPI returns the settings of the Twitter API

func (*TwitterAPI) UserTimeline

func (a *TwitterAPI) UserTimeline(
	screenName string, sinceID string, maxID string, count uint, includeRetweets bool,
) ([]*Tweet, error)

UserTimeline retrieves the tweets of the passed user, sinceID and maxID will be omitted if an empty string is passed API documentation can be found here: https://developer.twitter.com/en/docs/tweets/timelines/api-reference/get-statuses-user_timeline

type TwitterError

type TwitterError struct {
	Errors []struct {
		Message string `json:"message"`
		Code    string `json:"code"`
		Details string `json:"details"`
	} `json:"errors"`
}

TwitterError is the struct of the error API responses

func (TwitterError) Error

func (e TwitterError) Error() string

Error returns the occurred API error message

Jump to

Keyboard shortcuts

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