api

package
v0.0.0-...-b0fc717 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultBlacklist string = "gore\nscat\nwatersports\nyoung -rating:s\nloli\nshota"

Variables

View Source
var ApiName string
View Source
var Endpoint string
View Source
var FilteredEndpoint string
View Source
var MissingArguments error = errors.New("Missing file or upload_url")
View Source
var PostIsDeleted error = errors.New("This post has been deleted.")
View Source
var StaticPrefix string

Functions

func APILog

func APILog(url, user string, length int, response *http.Response, err error)

func FavoritePost

func FavoritePost(user, apitoken string,
	id int) (*types.TPostInfo, error)

you shouldn't depend on this to return anything useful, as it will return nil if you favorite the same post twice

func FetchOnePost

func FetchOnePost(user, apitoken string, id int) (*types.TPostInfo, error)

func FetchUser

func FetchUser(username, api_key string) (*types.TUserInfo, error)

func GetTagData

func GetTagData(user, apitoken string, id int) (*types.TTagData, error)

func Init

func Init(s settings) error

func ListPosts

func ListPosts(user, apitoken string, options types.ListPostOptions) (types.TPostInfoArray, error)

func ListTagAliases

func ListTagAliases(user, apitoken string, options types.ListTagAliasOptions) (types.TAliasInfoArray, error)

func ListTags

func ListTags(user, apitoken string, options types.ListTagsOptions) (types.TTagInfoArray, error)

func LocationToURL

func LocationToURL(location string) string

func LocationToURLWithRating

func LocationToURLWithRating(location string, rating types.PostRating) string

func SanitizeRating

func SanitizeRating(input string) (types.PostRating, error)

filters rating tags into valid rating letters. "clean" is not a valid rating, but for convenience, it is treated as identical to "safe".

func SanitizeRatingForEdit

func SanitizeRatingForEdit(input string) (types.PostRating, error)

filters ratings into valid rating letters, and the zero value to revert a change.

func TestLogin

func TestLogin(user, apitoken string) (*types.TUserInfo, bool, error)

func UnfavoritePost

func UnfavoritePost(user, apitoken string,
	id int) error

func UnvotePost

func UnvotePost(user, apitoken string,
	id int) error

func UpdatePost

func UpdatePost(user, apitoken string,
	id int,
	tagdiff tags.TagDiff,
	rating types.PostRating,
	parent *int,
	sourcediff []string,
	description *string,
	reason *string) (*types.TPostInfo, error)

func VotePost

func VotePost(user, apitoken string,
	id int,
	vote types.PostVote,
	no_unvote bool) (*types.TPostScore, error)

Types

type FailedCall

type FailedCall struct {
	Success bool `json:"success"`
}

type UploadCallResult

type UploadCallResult struct {
	Success    bool    `json:"success"`
	Reason     *string `json:"reason"`
	Location   *string `json:"location"`
	StatusCode int
	Status     string
}

func UploadFile

func UploadFile(file_data io.Reader, upload_url string, tags tags.TagSet, rating types.PostRating, source, description string, parent *int, user, apitoken string) (*UploadCallResult, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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