gisqus

package module
v0.0.0-...-f24e808 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2017 License: Apache-2.0 Imports: 10 Imported by: 2

README

gisqus - a thin wrapper over Disqus' API, written in Go.

License Go Report Card Build Status

Gisqus is a Go wrapper over Disqus' public API (https://disqus.com/api/docs/). Its main purposes are to wrap away REST calls, http error handling and modeling of the data returned.

Gisqus only covers endpoints that read data (GET method), not the ones writing data. It is mainly meant for reporting purposes. For this reason:

  • it only supports authentication in the form of "Authenticating as the Account Owner" (https://disqus.com/api/docs/auth/)
  • endpoints that require entity IDs (thread ID, forum ID etc) but where they can be provided implicitly by authentication have their wrappers requiring those parameters explicitly in the method signature

The "related" parameter in many Disqus endpoints is not supported, since data returned through it can always be gotten with a direct call to the respective api. In this sense, Gisqus covers the complete hierarchy of Disqus' object model.

Usage

After having obtained an API key from Disqus (you must create an app for that on Disqus' control panel), one must obtain an instance of Gisqus:

    import  "context"
    import  "net/url"
    import  "github.com/pierods/gisqus"
    ...
    g := NewGisqus("api key")
    values := url.Values{}
    ctx, cancel := context.WithCancel(context.TODO())

One can then proceed to make calls against Disqus' endpoints. Calls do not support timeouts, but they are cancellable (https://golang.org/pkg/context/).

    values.Set("filters", gisqus.PostIsAnonymous)
    posts, err := g.PostList(ctx, values)
    if err != nil {
        ...
    }
    fmt.Println(posts.Response[0].ID)
Notes

All calls are cancellable, so they won't catastrophically block on a call chain.

The complete Disqus hierarchy is modeled:

hierarchy

except for Categories, since the vast majority of forums use only one category for all posts.

Some Disqus constants have been replicated to avoid having to memorize lists of values:

// Post constants are used by Disqus in API calls in the "filters" parameter
const (
	PostIsAnonymous = 1 + iota
	PostHasLink
	PostHasLowRepAuthor
	PostHasBadWord
	PostIsFlagged
	PostNoIssue
)
// Post constants are used by Disqus in API calls in the "include" parameter
const (
	PostIsUnapproved      = "unapproved"
	PostIsApproved        = "approved"
	PostIsSpam            = "spam"
	PostIsDeleted         = "deleted"
	PostIncludedIsFlagged = "flagged"
	PostIsHighlighted     = "highlighted"
)
// Intervals are used by Disqus in API calls in the "since" parameter
const (
	Interval1h  = "1h"
	Interval6h  = "6h"
	Interval12h = "12h"
	Interval1d  = "1d"
	Interval3d  = "3d"
	Interval7d  = "7d"
	Interval30d = "30d"
	Interval90d = "90d"
)
// Order constant are values used by Disqus in API calls in the "order" parameter
const (
	OrderAsc  = "asc"
	OrderDesc = "desc"
)
// Sort constants are values used by Disqus in API calls in the sortType parameter
const (
	SortTypeDate     = "date"
	SortTypePriority = "priority"
)
Endpoints covered

https://disqus.com/api/docs/

Forums
  • details
  • interestingForums
  • listCategories
  • listFollowers
  • listMostActiveUsers
  • listMostLikedUsers
  • listThreads
  • listUsers
Threads
  • details
  • list
  • listHot
  • listPopular
  • listPosts
  • listUsersVotedThread
  • set
Posts
  • details
  • getContext
  • list
  • listPopular
Users
  • details
  • interestingUsers
  • listActiveForums
  • listActivity
  • listFollowers
  • listFollowing
  • listFollowingForums
  • listMostActiveForums
  • listPosts

Documentation

Overview

Package gisqus is a thin wrapper over the Disqus API

Index

Constants

View Source
const DisqusDateFormat = "2006-01-02T15:04:05"

DisqusDateFormat is a constant used to export dates in a format accepted by Disqus

View Source
const DisqusDateFormatExact = "2006-01-02T15:04:05.000000"

DisqusDateFormatExact is a constant used to export dates in a format accepted by Disqus

Variables

This section is empty.

Functions

func ExtractForumID

func ExtractForumID(forumString string) string

ExtractForumID extracts the forum ID from the keys of the map returned by the interesting forum call

func ToDisqusTime

func ToDisqusTime(date time.Time) string

ToDisqusTime returns a string that can be used in Disqus call for timedate parameters

func ToDisqusTimeExact

func ToDisqusTimeExact(date time.Time) string

ToDisqusTimeExact returns a string in the format of the ForumDetails CreatedAt field.

Types

type ActiveForumsResponse

type ActiveForumsResponse struct {
	ResponseStubWithCursor
	Response []*Forum `json:"response"`
}

ActiveForumsResponse models the response of the active forums user endpoint.

type ActivitiesListResponse

type ActivitiesListResponse struct {
	ResponseStubWithCursor
	Posts []*Post `json:"response"`
}

ActivitiesListResponse models the response of the user activity list endpoint

type ActivityResponseFragment

type ActivityResponseFragment struct {
	FragmentType string          `json:"type"`
	FragmentData json.RawMessage `json:"object"`
}

ActivityResponseFragment is exported because of the json parser

type CategoriesListResponse

type CategoriesListResponse struct {
	ResponseStubWithCursor
	Response []*Category `json:"response"`
}

CategoriesListResponse models the category list in forum endpoint

type Category

type Category struct {
	IsDefault bool   `json:"isDefault"`
	Title     string `json:"title"`
	Order     int    `json:"order"`
	Forum     string `json:"forum"`
	ID        string `json:"id"`
}

Category models the category field in forums

type ChannelCoverImage

type ChannelCoverImage struct {
	Cache string
}

ChannelCoverImage models the fields of the coverImage field in a channel option

type ChannelOptions

type ChannelOptions struct {
	AboutURLPath      string             `json:"aboutUrlPath"`
	Description       string             `json:"description"`
	Coverimage        *ChannelCoverImage `json:"coverImage"`
	BannerTimestamp   time.Time          `json:"bannerTimestamp"`
	ModEmail          string             `json:"modEmail"`
	AlertBackground   string             `json:"alertBackground"`
	Favicon           string             `json:"favicon"`
	Title             string             `json:"title"`
	IsCurationChannel bool               `json:"isCurationChannel"`
	BannerColor       string             `json:"bannerColor"`
}

ChannelOptions models the fields of the options field in a channel

type ChannelTitleLogo struct {
	Small string
	Cache string
}

ChannelTitleLogo models the fields of the titleLogo field in a channel option

type DisqusCursor

type DisqusCursor struct {
	Prev    string `json:"prev"`
	HasNext bool   `json:"hasNext"`
	Next    string `json:"next"`
	HasPrev bool   `json:"hasPrev"`
	Total   int    `json:"total"`
	ID      string `json:"id"`
	More    bool   `json:"more"`
}

DisqusCursor models the cursor used by Disqus for pagination

type DisqusPermissions

type DisqusPermissions struct {
}

DisqusPermissions models the fields of the forum permissions field in a Forum

type DisqusRateLimit

type DisqusRateLimit struct {
	RatelimitRemaining int
	RatelimitLimit     int
	RatelimitReset     time.Time
}

DisqusRateLimit models the rate limits for an user account

type Filter

type Filter int

Filter represents the possible values for filter in calls to Disqus'API

const (
	PostIsAnonymous Filter = 1 + iota
	PostHasLink
	PostHasLowRepAuthor
	PostHasBadWord
	PostIsFlagged
	PostNoIssue
)

Post constants are used by Disqus in API calls in the "filters" parameter

type Forum

type Forum struct {
	RawGuidelines         string             `json:"raw_guidelines"`
	TwitterName           string             `json:"twitterName"`
	Guidelines            string             `json:"guidelines"`
	Favicon               *Icon              `json:"favicon"`
	DisableDisqusBranding bool               `json:"disableDisqusBranding"`
	ID                    string             `json:"id"`
	CreatedAt             time.Time          `json:"-"`
	DisqusTimeCreatedAt   string             `json:"createdAt"`
	Category              string             `json:"category"`
	Founder               string             `json:"founder"`
	DaysAlive             int                `json:"daysAlive"`
	InstallCompleted      bool               `json:"installCompleted"`
	Pk                    string             `json:"pk"`
	Channel               *ForumChannel      `json:"channel"`
	Description           string             `json:"description"`
	RawDescription        string             `json:"raw_description"`
	AdsReviewStatus       int                `json:"adsReviewStatus"`
	Permissions           *DisqusPermissions `json:"permissions"`
	Name                  string             `json:"name"`
	Language              string             `json:"language"`
	Settings              *ForumSettings     `json:"settings"`
	OrganizationID        int                `json:"organizationId"`
	DaysThreadAlive       int                `json:"daysThreadAlive"`
	Avatar                *ForumAvatar       `json:"avatar"`
	SignedURL             string             `json:"signedUrl"`
}

Forum models the fields of a forum, as returned by Disqus' API

type ForumAvatar

type ForumAvatar struct {
	Small *Icon `json:"small"`
	Large *Icon `json:"large"`
}

ForumAvatar models the fields of the forum avatar field in a forum

type ForumChannel

type ForumChannel struct {
	BannerColor     string          `json:"bannerColor"`
	Slug            string          `json:"slug"`
	DateAdded       time.Time       `json:"-"`
	DisqusDateAdded string          `json:"dateAdded"`
	Name            string          `json:"name"`
	Banner          string          `json:"banner"`
	BannerColorHex  string          `json:"bannerColorHex"`
	ID              string          `json:"id"`
	Hidden          bool            `json:"hidden"`
	IsAggregation   bool            `json:"isAggregation"`
	Avatar          string          `json:"avatar"`
	EnableCuration  bool            `json:"enableCuration"`
	IsCategory      bool            `json:"isCategory"`
	AdminOnly       bool            `json:"adminOnly"`
	Options         *ChannelOptions `json:"options"`
	OwnerID         string          `json:"ownerId"`
}

ForumChannel models the fields of the forum channel field in a forum

type ForumDetailsResponse

type ForumDetailsResponse struct {
	ResponseStub
	Response *Forum `json:"response"`
}

ForumDetailsResponse modeles the response to a call to Disqus' Forum details endpoint (https://disqus.com/api/docs/forums/details/)

type ForumSettings

type ForumSettings struct {
	SupportLevel                     int  `json:"supportLevel"`
	AdsDRNativeEnabled               bool `json:"adsDRNativeEnabled"`
	Disable3rdPartyTrackers          bool `json:"disable3rdPartyTrackers"`
	AdsVideoEnabled                  bool `json:"adsVideoEnabled"`
	AdsProductVideoEnabled           bool `json:"adsProductVideoEnabled"`
	AdsPositionTopEnabled            bool `json:"adsPositionTopEnabled"`
	AudienceSyncEnabled              bool `json:"audienceSyncEnabled"`
	UnapproveLinks                   bool `json:"unapproveLinks"`
	AdsEnabled                       bool `json:"adsEnabled"`
	AdsProductLinksThumbnailsEnabled bool `json:"adsProductLinksThumbnailsEnabled"`
	AdsProductStoriesEnabled         bool `json:"adsProductStoriesEnabled"`
	OrganicDiscoveryEnabled          bool `json:"organicDiscoveryEnabled"`
	AdsProductDisplayEnabled         bool `json:"adsProductDisplayEnabled"`
	DiscoveryLocked                  bool `json:"discoveryLocked"`
	HasCustomAvatar                  bool `json:"hasCustomAvatar"`
	LinkAffiliationEnabled           bool `json:"linkAffiliationEnabled"`
	AllowAnonPost                    bool `json:"allowAnonPost"`
	AllowMedia                       bool `json:"allowMedia"`
	AdultContent                     bool `json:"adultContent"`
	AllowAnonVotes                   bool `json:"allowAnonVotes"`
	MustVerify                       bool `json:"mustVerify"`
	MustVerifyEmail                  bool `json:"mustVerifyEmail"`
	SsoRequired                      bool `json:"ssoRequired"`
	MediaembedEnabled                bool `json:"mediaembedEnabled"`
	AdsPositionBottomEnabled         bool `json:"adsPositionBottomEnabled"`
	AdsProductLinksEnabled           bool `json:"adsProductLinksEnabled"`
	ValidateAllPosts                 bool `json:"validateAllPosts"`
	AdsSettingsLocked                bool `json:"adsSettingsLocked"`
	IsVIP                            bool `json:"isVIP"`
	AdsPositionInthreadEnabled       bool `json:"AdsPositionInthreadEnabled"`
}

ForumSettings models the fields of the forum settings field in a Forum

type ForumUserListResponse

type ForumUserListResponse struct {
	ResponseStubWithCursor
	Response []*User `json:"response"`
}

ForumUserListResponse models the response of the user list in forum endpoint

type ForumsURLS

type ForumsURLS struct {
	InterestingForumsURL string
	DetailsURL           string
	CategoriesURL        string
	ListUsersURL         string
	ListThreadsURL       string
	MostLikedUsersURL    string
	ListFollowersURL     string
	MostActiveUsersURL   string
}

ForumsURLS contains the URLs of the API calls for forums on Disqus

type Gisqus

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

Gisqus is lib's entry point

func NewGisqus

func NewGisqus(secret string) Gisqus

NewGisqus returns a new instance of Gisqus. secret is Disqus' API key

func (*Gisqus) ForumDetails

func (gisqus *Gisqus) ForumDetails(ctx context.Context, forumID string, values url.Values) (*ForumDetailsResponse, error)

ForumDetails wraps https://disqus.com/api/docs/forums/details/ (https://disqus.com/api/3.0/forums/details.json) It does not support the "related" url parameter (other funcs can be used for drilldown)

func (*Gisqus) ForumMostLikedUsers

func (gisqus *Gisqus) ForumMostLikedUsers(ctx context.Context, forumID string, values url.Values) (*MostLikedUsersResponse, error)

ForumMostLikedUsers wraps https://disqus.com/api/docs/forums/listMostLikedUsers/ (https://disqus.com/api/3.0/forums/listMostLikedUsers.json) Disqus does not return the # of likes with this call.

func (*Gisqus) Limits

func (g *Gisqus) Limits() DisqusRateLimit

Limits return the current rate limits for the user account

func (*Gisqus) PostDetails

func (gisqus *Gisqus) PostDetails(ctx context.Context, postID string, values url.Values) (*PostDetailsResponse, error)

PostDetails wraps https://disqus.com/api/docs/posts/details/ (https://disqus.com/api/3.0/posts/details.json) It does not support the "related" argument.

func (*Gisqus) ReadForumsURLs

func (g *Gisqus) ReadForumsURLs() ForumsURLS

ReadForumsURLs returns all the URLs used by Gisqus to call forum endpoints.

func (*Gisqus) ReadPostURLs

func (g *Gisqus) ReadPostURLs() PostsURLS

ReadPostURLs returns all the URLs used by Gisqus to call post endpoints

func (*Gisqus) ReadThreadsURLs

func (g *Gisqus) ReadThreadsURLs() ThreadsURLS

ReadThreadsURLs returns all the URLs used by Gisqus to call thread endpoints

func (*Gisqus) ReadUsersURLs

func (g *Gisqus) ReadUsersURLs() UsersURLS

ReadUsersURLs returns all the URLs used by Gisqus to call user endpoints

func (*Gisqus) SetForumsURLs

func (g *Gisqus) SetForumsURLs(fu ForumsURLS)

SetForumsURLs changes the URLs used by Gisqus to call forum endpoints

func (*Gisqus) SetPostsURLs

func (g *Gisqus) SetPostsURLs(pu PostsURLS)

SetPostsURLs changes the URLs used by Gisqus to call post endpoints

func (*Gisqus) SetThreadsURLs

func (g *Gisqus) SetThreadsURLs(tu ThreadsURLS)

SetThreadsURLs changes the URLs used by Gisqus to call thread endpoints

func (*Gisqus) SetUsersURLs

func (g *Gisqus) SetUsersURLs(uu UsersURLS)

SetUsersURLs changes the URLS used by Gisqus to call user endpoints.

func (*Gisqus) ThreadDetails

func (gisqus *Gisqus) ThreadDetails(ctx context.Context, threadID string, values url.Values) (*ThreadDetailResponse, error)

ThreadDetails wraps https://disqus.com/api/docs/threads/details/ (https://disqus.com/api/3.0/threads/details.json) It does not support the "related" argument (related fields can be gotten with calls to their respective APIS)

func (*Gisqus) ThreadHot

func (gisqus *Gisqus) ThreadHot(ctx context.Context, values url.Values) (*ThreadListResponseNoCursor, error)

ThreadHot wraps https://disqus.com/api/docs/threads/listHot/ (https://disqus.com/api/3.0/threads/listHot.json) It does not support the "related" argument (related fields can be gotten with calls to their respective APIS)

func (*Gisqus) ThreadList

func (gisqus *Gisqus) ThreadList(ctx context.Context, values url.Values) (*ThreadListResponse, error)

ThreadList wraps https://disqus.com/api/docs/threads/list/ (https://disqus.com/api/3.0/threads/list.json) It does not support the "related" argument (related fields can be gotten with calls to their respective APIS)

func (*Gisqus) ThreadPopular

func (gisqus *Gisqus) ThreadPopular(ctx context.Context, values url.Values) (*ThreadListResponseNoCursor, error)

ThreadPopular wraps https://disqus.com/api/docs/threads/listPopular/ (https://disqus.com/api/3.0/threads/listPopular.json) It does not support the "related" argument (related fields can be gotten with calls to their respective APIS)

func (*Gisqus) ThreadPosts

func (gisqus *Gisqus) ThreadPosts(ctx context.Context, threadID string, values url.Values) (*PostListResponse, error)

ThreadPosts wraps https://disqus.com/api/docs/threads/listPosts/ (https://disqus.com/api/3.0/threads/listPosts.json) It does not support the "related" argument (related fields can be gotten with calls to their respective APIS)

func (*Gisqus) ThreadTrending

func (gisqus *Gisqus) ThreadTrending(ctx context.Context, values url.Values) (*ThreadTrendingResponse, error)

ThreadTrending wraps https://disqus.com/api/docs/trends/listThreads/ (https://disqus.com/api/3.0/trends/listThreads.json) It does not support the "related" argument (related fields can be gotten with calls to their respective APIS)

func (*Gisqus) ThreadUsersVoted

func (gisqus *Gisqus) ThreadUsersVoted(ctx context.Context, threadD string, values url.Values) (*UsersVotedResponse, error)

ThreadUsersVoted wraps https://disqus.com/api/docs/threads/listUsersVotedThread/ (https://disqus.com/api/3.0/threads/listUsersVotedThread.json) Complete users are not returned by Disqus on this call

func (*Gisqus) UserFollowers

func (gisqus *Gisqus) UserFollowers(ctx context.Context, userID string, values url.Values) (*UserListResponse, error)

UserFollowers wraps https://disqus.com/api/docs/users/listFollowers/ (https://disqus.com/api/3.0/users/listFollowers.json) Numlikes, NumPosts, NumFollowers are not returned by Disqus' API

func (*Gisqus) UserFollowing

func (gisqus *Gisqus) UserFollowing(ctx context.Context, userID string, values url.Values) (*UserListResponse, error)

UserFollowing wraps https://disqus.com/api/docs/users/listFollowing/ (https://disqus.com/api/3.0/users/listFollowing.json) Numlikes, NumPosts, NumFollowers are not returned by Disqus' API

func (*Gisqus) UserPosts

func (gisqus *Gisqus) UserPosts(ctx context.Context, userID string, values url.Values) (*PostListResponse, error)

UserPosts wraps https://disqus.com/api/docs/users/listPosts/ (https://disqus.com/api/3.0/users/listPosts.json) It does not support the "related" argument (related fields can be gotten with calls to their respective APIS)

type Icon

type Icon struct {
	Permalink string `json:"permalink"`
	Cache     string `json:"cache"`
}

Icon models an icon object returned by many Disqus endpoints

type Include

type Include string

Include represents the possible values for includes in calls to Disqus'API

const (
	PostIsUnapproved      Include = "unapproved"
	PostIsApproved        Include = "approved"
	PostIsSpam            Include = "spam"
	PostIsDeleted         Include = "deleted"
	PostIncludedIsFlagged Include = "flagged"
	PostIsHighlighted     Include = "highlighted"
)

Post constants are used by Disqus in API calls in the "include" parameter

type InterestingForums

type InterestingForums struct {
	Items   []*InterestingItem `json:"items"`
	Objects map[string]*Forum  `json:"objects"`
}

InterestingForums models the actual data contained in a call to Disqus' Interesting Forums (https://disqus.com/api/docs/forums/interestingForums/)

type InterestingForumsResponse

type InterestingForumsResponse struct {
	ResponseStubWithCursor
	Response *InterestingForums `json:"response"`
}

InterestingForumsResponse models the response to a call to Disqus' Interesting Forums (https://disqus.com/api/docs/forums/interestingForums/)

type InterestingItem

type InterestingItem struct {
	Reason string `json:"reason"`
	ID     string `json:"id"`
}

InterestingItem models the slice returned by Interesting* Disqus endpoints.

type InterestingUsers

type InterestingUsers struct {
	Items   []*InterestingItem `json:"items"`
	Objects map[string]*User   `json:"objects"`
}

InterestingUsers models the objects returned by the interesting users endpoint.

type InterestingUsersResponse

type InterestingUsersResponse struct {
	ResponseStubWithCursor
	Response *InterestingUsers `json:"response"`
}

InterestingUsersResponse models the response of the interesting users endpoint.

type Interval

type Interval string

Interval represents the possible values for intervals in calls to Disqus'API

const (
	Interval1h  Interval = "1h"
	Interval6h  Interval = "6h"
	Interval12h Interval = "12h"
	Interval1d  Interval = "1d"
	Interval3d  Interval = "3d"
	Interval7d  Interval = "7d"
	Interval30d Interval = "30d"
	Interval90d Interval = "90d"
)

Intervals are used by Disqus in API calls in the "since" parameter

type MostActiveForumsResponse

type MostActiveForumsResponse struct {
	ResponseStub
	Response []*Forum `json:"response"`
}

MostActiveForumsResponse models the responser of the user most active forums endpoint

type MostLikedUsersResponse

type MostLikedUsersResponse struct {
	ResponseStubWithCursor
	Response []*User `json:"response"`
}

MostLikedUsersResponse models the response of the most liked users in forum endpoint

type Order

type Order string

Order represents the possible values for order in calls to Disqus'API

const (
	OrderAsc  Order = "asc"
	OrderDesc Order = "desc"
)

Order constant are values used by Disqus in API calls in the "order" parameter

type Post

type Post struct {
	Parent int `json:"parent"`
	// contains filtered or unexported fields
}

Post models a Post as returned by Disqus' API

type PostAuthor

type PostAuthor struct {
	Username                string      `json:"username"`
	About                   string      `json:"about"`
	Name                    string      `json:"name"`
	Disable3rdPartyTrackers bool        `json:"disable3rdPartyTrackers"`
	URL                     string      `json:"url"`
	IsAnonymous             bool        `json:"isAnonymous"`
	ProfileURL              string      `json:"profileUrl"`
	IsPowerContributor      bool        `json:"isPowerContributor"`
	Location                string      `json:"location"`
	IsPrivate               bool        `json:"isPrivate"`
	SignedURL               string      `json:"signedUrl"`
	IsPrimary               bool        `json:"isPrimary"`
	JoinedAt                time.Time   `json:"-"`
	DisqusTimeJoinedAt      string      `json:"joinedAt"`
	ID                      string      `json:"id"`
	Avatar                  *UserAvatar `json:"avatar"`
}

PostAuthor models the fields of the author field in a Post

type PostDetailsResponse

type PostDetailsResponse struct {
	ResponseStub
	Response *Post `json:"response"`
}

PostDetailsResponse wraps the response of the post details endpoint

type PostListResponse

type PostListResponse struct {
	ResponseStubWithCursor
	Response []*Post `json:"response"`
}

PostListResponse wraps the response of the post list endpoint

type PostListResponseNoCursor

type PostListResponseNoCursor struct {
	ResponseStub
	Response []*Post `json:"response"`
}

PostListResponseNoCursor wraps the response of the post popular endpoint

type PostMedia

type PostMedia struct {
}

PostMedia models the fields the media field in a Post

type PostsURLS

type PostsURLS struct {
	PostDetailsURL string
	PostListURL    string
	PostPopularURL string
}

PostsURLS are the URLS of the Post endpoints in Disqus' API

type RawPost

type RawPost struct {
	Parent Post `json:"parent"`
	// contains filtered or unexported fields
}

RawPost is exported because of the json parser

type ResponseStub

type ResponseStub struct {
	Code int `json:"code"`
}

ResponseStub is the standard Disqus response stub

type ResponseStubWithCursor

type ResponseStubWithCursor struct {
	ResponseStub
	Cursor *DisqusCursor `json:"cursor"`
}

ResponseStubWithCursor is the standard response stub for call that support pagination

type Sort

type Sort string

Sort represents the possible values for sort in calls to Disqus'API

const (
	SortTypeDate     Sort = "date"
	SortTypePriority Sort = "priority"
)

Sort constants are values used by Disqus in API calls in the sortType parameter

type Thread

type Thread struct {
	Feed                string    `json:"feed"`
	Identifiers         []string  `json:"identifiers"`
	Dislikes            int       `json:"dislikes"`
	Likes               int       `json:"likes"`
	Message             string    `json:"message"`
	ID                  string    `json:"id"`
	IsDeleted           bool      `json:"isDeleted"`
	Category            string    `json:"category"`
	Author              string    `json:"author"`
	UserScore           int       `json:"userScore"`
	IsSpam              bool      `json:"isSpam"`
	SignedLink          string    `json:"signedLink"`
	CreatedAt           time.Time `json:"-"`
	DisqusTimeCreatedAt string    `json:"createdAt"`
	HasStreaming        bool      `json:"hasStreaming"`
	RawMessage          string    `json:"rawMessage"`
	IsClosed            bool      `json:"isClosed"`
	Link                string    `json:"link"`
	Slug                string    `json:"slug"`
	Forum               string    `json:"forum"`
	CleanTitle          string    `json:"clean_title"`
	Posts               int       `json:"posts"`
	UserSubscription    bool      `json:"userSubscription"`
	Title               string    `json:"title"`
	HighlightedPost     *Post     `json:"highlightedPost"`
}

Thread models the Thread returned by Disqus' API calls

type ThreadDetail

type ThreadDetail struct {
	Thread
	CanModerate bool `json:"canModerate"`
}

ThreadDetail models the fields returned by the thread detail endpoint

type ThreadDetailResponse

type ThreadDetailResponse struct {
	ResponseStub
	Response *ThreadDetail `json:"response"`
}

ThreadDetailResponse models the response of the thread details endpoint.

type ThreadListResponse

type ThreadListResponse struct {
	ResponseStubWithCursor
	Response []*Thread `json:"response"`
}

ThreadListResponse models the response of various thread endpoints.

type ThreadListResponseNoCursor

type ThreadListResponseNoCursor struct {
	ResponseStub
	Response []*Thread `json:"response"`
}

ThreadListResponseNoCursor models the response of various thread endpoints.

type ThreadTrendingResponse

type ThreadTrendingResponse struct {
	ResponseStub
	Response []*Trend `json:"response"`
}

ThreadTrendingResponse models the response of the trending threads endpoint.

type ThreadsURLS

type ThreadsURLS struct {
	ThreadListURL       string
	ThreadDetailURL     string
	ThreadPostsURL      string
	ThreadHotURL        string
	ThreadPopularURL    string
	ThreadTrendingURL   string
	ThreadUsersVotedURL string
	ThreadSetURL        string
}

ThreadsURLS are the URLs of the thread endpoints of the Disqus' API

type Trend

type Trend struct {
	TrendingThread *Thread `json:"thread"`
	PostLikes      int     `json:"postLikes"`
	Posts          int     `json:"posts"`
	Score          float32 `json:"score"`
	Link           string  `json:"link"`
	Likes          int     `json:"likes"`
}

Trend models the trend returned by the trending threads endpoint

type User

type User struct {
	Disable3rdPartyTrackers bool        `json:"disable3rdPartyTrackers"`
	IsPowerContributor      bool        `json:"isPowerContributor"`
	IsPrimary               bool        `json:"isPrimary"`
	ID                      string      `json:"id"`
	NumFollowers            int         `json:"numFollowers"`
	Rep                     float32     `json:"rep"`
	NumFollowing            int         `json:"numFollowing"`
	NumPosts                int         `json:"numPosts"`
	Location                string      `json:"location"`
	IsPrivate               bool        `json:"isPrivate"`
	JoinedAt                time.Time   `json:"-"`
	DisqusTimeJoinedAt      string      `json:"joinedAt"`
	Username                string      `json:"username"`
	NumLikesReceived        int         `json:"numLikesReceived"`
	ReputationLabel         string      `json:"reputationLabel"`
	About                   string      `json:"about"`
	Name                    string      `json:"name"`
	URL                     string      `json:"url"`
	NumForumsFollowing      int         `json:"numForumsFollowing"`
	ProfileURL              string      `json:"profileUrl"`
	Reputation              float32     `json:"reputation"`
	Avatar                  *UserAvatar `json:"avatar"`
	SignedURL               string      `json:"signedUrl"`
	IsAnonymous             bool        `json:"isAnonymous"`
}

User models the user object returned by the user detail endpoint.

type UserAvatar

type UserAvatar struct {
	Small *Icon `json:"small"`
	Large *Icon `json:"large"`
	Icon
	IsCustom bool `json:"isCustom"`
}

UserAvatar models the avatar field of the user object.

type UserDetailsResponse

type UserDetailsResponse struct {
	ResponseStub
	Response *User `json:"response"`
}

UserDetailsResponse models the response of the user detail endpoint

type UserForumFollowingResponse

type UserForumFollowingResponse struct {
	ResponseStubWithCursor
	Response []*Forum `json:"response"`
}

UserForumFollowingResponse models the response of the user forum following endpoint.

type UserListResponse

type UserListResponse struct {
	ResponseStubWithCursor
	Response []*User `json:"response"`
}

UserListResponse models the response of various user endpoints.

type UsersURLS

type UsersURLS struct {
	DetailURL            string
	InterestingIUsersURL string
	PostListURL          string
	ActiveForumsURL      string
	FollowersURL         string
	FollowingURL         string
	FollowingForumsURL   string
	ActivityURL          string
	MostActiveForumsURL  string
}

UsersURLS are the URLs used by Disqus' user endpoints

type UsersVotedResponse

type UsersVotedResponse struct {
	ResponseStub
	Response []*User `json:"response"`
}

UsersVotedResponse models the response of the users voted thread endpoint

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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