gohunt

package
v0.0.0-...-ac69780 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2020 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RequestUserOAuthCode

func RequestUserOAuthCode(w http.ResponseWriter, r *http.Request, clientID string, redirectUrl string, state string)

Request Access Grant Code and send to redirectUrl

Types

type Client

type Client struct {
	AuthToken     *Token
	Authorization string
}

func GenAuthClient

func GenAuthClient(tok *Token) *Client

func NewOAuthClient

func NewOAuthClient(clientID string, clientSecret string) (*Client, error)

OAuth2 Client-Only Authentication

func NewUserClient

func NewUserClient(accessToken string) *Client

User-Authenticated Client with Developer Token

func NewUserOAuthClient

func NewUserOAuthClient(clientID string, clientSecret string, redirectUrl string, code string) (*Client, error)

OAuth2 User-Authenticated Client with Access Grant Code

func (*Client) ClearNotifications

func (c *Client) ClearNotifications() ([]Notification, error)

func (*Client) CreateComment

func (c *Client) CreateComment(postID int, parentCommentID int, body string) (Comment, error)

func (*Client) CreatePost

func (c *Client) CreatePost(link string, name string, tagline string) (Post, error)

func (*Client) Follow

func (c *Client) Follow(userID int, following bool) (User, error)

func (*Client) GetAllPosts

func (c *Client) GetAllPosts(searchUrl string, olderThanID int, newerThanID int, count int) ([]Post, error)

func (*Client) GetAllUsers

func (c *Client) GetAllUsers(olderThanID int, newerThanID int, count int, order string) ([]User, error)

func (*Client) GetFollowers

func (c *Client) GetFollowers(userID int, olderThanID int, newerThanID int, count int, order string) ([]User, error)

Follow Routes

func (*Client) GetFollowing

func (c *Client) GetFollowing(userID int, olderThanID int, newerThanID int, count int, order string) ([]User, error)

func (*Client) GetNotifications

func (c *Client) GetNotifications(olderThanID int, newerThanID int, count int, order string) ([]Notification, error)

Notification Routes

func (*Client) GetPost

func (c *Client) GetPost(id int) (Post, error)

Post Routes

func (*Client) GetPostComments

func (c *Client) GetPostComments(postID int, olderThanID int, newerThanID int, count int, order string) ([]Comment, error)

Comment Routes

func (*Client) GetPostVotes

func (c *Client) GetPostVotes(postID int, olderThanID int, newerThanID int, count int, order string) ([]Vote, error)

Vote Routes

func (*Client) GetPosts

func (c *Client) GetPosts() ([]Post, error)

func (*Client) GetPostsOnDay

func (c *Client) GetPostsOnDay(day string) ([]Post, error)

func (*Client) GetPreviousPosts

func (c *Client) GetPreviousPosts(daysAgo int) ([]Post, error)
func (c *Client) GetRelatedLinks(searchUrl string) ([]RelatedLink, error)

Related Links Route

func (*Client) GetSettings

func (c *Client) GetSettings() (UserSettings, error)

Settings Route

func (*Client) GetUser

func (c *Client) GetUser(username string) (User, error)

User Routes

func (*Client) GetUserComments

func (c *Client) GetUserComments(userID int, olderThanID int, newerThanID int, count int, order string) ([]Comment, error)

func (*Client) GetUserVotes

func (c *Client) GetUserVotes(userID int, olderThanID int, newerThanID int, count int, order string) ([]Vote, error)

func (*Client) UpdateComment

func (c *Client) UpdateComment(commentID int, parentCommentID int, body string) (Comment, error)

func (*Client) UpdateSettings

func (c *Client) UpdateSettings(settings *UserSettings) error

func (*Client) VoteForPost

func (c *Client) VoteForPost(postID int, voting bool) (Vote, error)

type Comment

type Comment struct {
	ID              int       `json:"id"`
	PostID          int       `json:"post_id"`
	ParentCommentID int       `json:"parent_comment_id"`
	UserID          int       `json:"user_id"`
	RepliesCount    int       `json:"child_comments_count"`
	Body            string    `json:"body"`
	Created         string    `json:"created_at"`
	Maker           bool      `json:"maker"`
	User            User      `json:"user"`
	Replies         []Comment `json:"child_comments"`
}

func (Comment) Summary

func (c Comment) Summary() string

type Notification

type Notification struct {
	ID        int    `json:"id"`
	Type      string `json:"type"` // 'comment' or 'post'
	ShortBody string `json:"body"`
	FullBody  string `json:"sentence"`
	Seen      bool   `json:"seen"`
	Reference interface{}
	FromUser  User `json:"from_user"`
	ToUser    User `json:"to_user"`
}

func (Notification) Summary

func (n Notification) Summary() string

type NotificationInfo

type NotificationInfo struct {
	Total  int `json:"total"`
	Unseen int `json:"unseen"`
}

type PermissionInfo

type PermissionInfo struct {
	CanVote    bool `json:"can_vote_posts"`
	CanComment bool `json:"can_comment"`
	CanPost    bool `json:"can_post"`
}

type Post

type Post struct {
	ID            int               `json:"id,"`
	Name          string            `json:"name"`
	Tagline       string            `json:"tagline"`
	Created       string            `json:"created_at"`
	Day           string            `json:"day"`
	CommentsCount int               `json:"comments_count"`
	VotesCount    int               `json:"votes_count"`
	DiscussionUrl string            `json:"discussion_url"`
	RedirectUrl   string            `json:"redirect_url"`
	ScreenshotUrl map[string]string `json:"screenshot_url"`
	CurrentUser   currentUser       `json:"current_user"`
	User          User              `json:"user"`
	MakerInside   bool              `json:"maker_inside"`
	Makers        []User            `json:"makers"`
}

func (Post) Summary

func (p Post) Summary() string
type RelatedLink struct {
	ID      int    `json:"id"`
	Url     string `json:"url"`
	Title   string `json:"title"`
	Domain  string `json:"domain"`
	Favicon string `json:"favicon"`
	PostID  int    `json:"post_id"`
	UserID  int    `json:"user_id"`
	Post    Post   `json:"post"`
}

func (RelatedLink) Summary

func (c RelatedLink) Summary() string

type Request

type Request struct {
	// contains filtered or unexported fields
}

type Token

type Token struct {
	AccessToken string  `json:"access_token"`
	TokenType   string  `json:"token_type"`
	Expiry      float32 `json:"expires_in"`
	Scope       string  `json:"scope"`
}

type User

type User struct {
	ID               int               `json:"id"`
	Name             string            `json:"name"`
	Username         string            `json:"username"`
	Headline         string            `json:"headline"`
	Created          string            `json:"created_at"`
	ImageUrl         map[string]string `json:"image_url"`
	ProfileUrl       string            `json:"profile_url"`
	WebsiteUrl       string            `json:"website_url"`
	Votes            []Vote            `json:"votes"`
	Posts            []Post            `json:"posts"`
	MakerOf          []Post            `json:"maker_of"`
	Followers        []User            `json:"followers"`
	Following        []User            `json:"followings"`
	CollectionsCount int64             `json:"collections_count"`
	CreatedAt        string            `json:"created_at"`
	FollowersCount   int64             `json:"followers_count"`
	FollowingsCount  int64             `json:"followings_count"`
	MakerOfCount     int64             `json:"maker_of_count"`
	PostsCount       int64             `json:"posts_count"`
	VotesCount       int64             `json:"votes_count"`
	TwitterUsername  string            `json:"twitter_username"`
}

func (User) Summary

func (u User) Summary() string

type UserSettings

type UserSettings struct {
	ID                      int               `json:"id"`
	Name                    string            `json:"name"`
	Username                string            `json:"username"`
	Headline                string            `json:"headline"`
	Created                 string            `json:"created_at"`
	ImageUrl                map[string]string `json:"image_url"`
	ProfileUrl              string            `json:"profile_url"`
	WebsiteUrl              string            `json:"website_url"`
	VotesCount              int               `json:"votes_count"`
	PostsCount              int               `json:"posts_count"`
	MakerCount              int               `json:"maker_of_count"`
	FollowersCount          int               `json:"followers_count"`
	FollowingCount          int               `json:"followings_count"`
	SendMentionEmail        bool              `json:"send_mention_email"`
	SendMentionPush         bool              `json:"send_mention_push"`
	SendFriendPostEmail     bool              `json:"send_friend_post_email"`
	SendFriendPostPush      bool              `json:"send_friend_post_push"`
	PushSubscriber          bool              `json:"subscribed_to_push"`
	SendNewFollowerPush     bool              `json:"send_new_follower_push"`
	SendNewFollowerEmail    bool              `json:"send_new_follower_email"`
	SendAnnouncementPush    bool              `json:"send_announcement_push"`
	SendAnnouncementEmail   bool              `json:"send_announcement_email"`
	SendRecommendationPush  bool              `json:"send_recommendation_push"`
	SendRecommendationEmail bool              `json:"send_recommendation_email"`
	Email                   string            `json:"email"`
	Role                    string            `json:"rile"`
	Permissions             PermissionInfo    `json:"permissions"`
	Notification            NotificationInfo  `json:"notifications"`
	FirstTimeUser           bool              `json:"first_time_user"`
	Votes                   []Vote            `json:"votes"`
	Posts                   []Post            `json:"posts"`
	MakerOf                 []Post            `json:"maker_of"`
	Followers               []User            `json:"followers"`
	Following               []User            `json:"followings"`
}

func (UserSettings) Summary

func (u UserSettings) Summary() string

type Vote

type Vote struct {
	ID      int    `json:"id"`
	PostID  int    `json:"post_id"`
	Created string `json:"created_at"`
	User    User   `json:"user"`
}

func (Vote) Summary

func (v Vote) Summary() string

Jump to

Keyboard shortcuts

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