models

package
v0.0.0-...-3f52ee8 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2023 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessTokenBody

type AccessTokenBody struct {
	AccessToken string `json:"access_token"`
	TokenType   string `json:"token_type"`
	ExpiresIn   uint   `json:"expires_in"`
	Scope       string `json:"scope"`
}

AccessTokenBody : Model for Reddit AccessBody Response

type Children

type Children struct {
	Kind string `json:"kind"`
	Data Data   `json:"data,omitempty"`
}

Children :

type Data

type Data struct {
	Subreddit         string      `json:"subreddit"`
	Selftext          string      `json:"selftext"`
	AuthorFullname    string      `json:"author_fullname"`
	Title             string      `json:"title"`
	Downs             int         `json:"downs"`
	Name              string      `json:"name"`
	Ups               int         `json:"ups"`
	IsOriginalContent bool        `json:"is_original_content"`
	Score             int         `json:"score"`
	Over18            bool        `json:"over_18"`
	Preview           Preview     `json:"preview"`
	Spoiler           bool        `json:"spoiler"`
	Locked            bool        `json:"locked"`
	ID                string      `json:"id"`
	Author            string      `json:"author"`
	URL               string      `json:"url"`
	CreatedUtc        float64     `json:"created_utc"`
	Media             interface{} `json:"media"`
	IsVideo           bool        `json:"is_video"`
}

Data :

func (Data) GetCleanPreviewImages

func (d Data) GetCleanPreviewImages() (urls []string)

GetCleanPreviewImages : Removes `amp;` from preview image url

func (d Data) GetShortLink() (url string)

GetShortLink : Get the short URL for the post

type MainData

type MainData struct {
	Modhash  string      `json:"modhash"`
	Dist     int         `json:"dist"`
	Children []Children  `json:"children"`
	After    string      `json:"after"`
	Before   interface{} `json:"before"`
}

MainData :

type Meme

type Meme struct {
	Name      string `json:"name"`
	PostLink  string `json:"postLink"`
	SubReddit string `json:"subreddit"`
	Title     string `json:"title"`
	URL       string `json:"url"`
	Author    string `json:"author"`
	NSFW      bool   `json:"nsfw"`
	Spoiler   bool   `json:"spoiler"`
	Created   int64  `json:"created"`
	IPFS      string `json:"ipfs"`
}

Meme : Basic structure of a Meme Response

func Unpack

func Unpack(b []byte) (*Meme, error)

func (*Meme) Pack

func (m *Meme) Pack() ([]byte, error)

type Preview

type Preview struct {
	Images  []PreviewImages `json:"images"`
	Enabled bool            `json:"enabled"`
}

Preview :

type PreviewImage

type PreviewImage struct {
	URL    string `json:"url"`
	Width  int    `json:"width"`
	Height int    `json:"height"`
}

PreviewImage :

type PreviewImages

type PreviewImages struct {
	Source      PreviewImage   `json:"source"`
	Resolutions []PreviewImage `json:"resolutions"`
	Variants    interface{}    `json:"variants"`
	ID          string         `json:"id"`
}

PreviewImages :

type Response

type Response struct {
	Kind string   `json:"kind"`
	Data MainData `json:"data"`
}

Response : Main container for the Reddit Response

Jump to

Keyboard shortcuts

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