apis

package
v0.0.0-...-905e761 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2024 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoYouTubeTokenForUser = errors.New("user does not have a YouTube token")
	ErrInvalidGrant          = errors.New("invalid_grant - token expired or revoked")
	ErrYouTubeSignupRequired = errors.New("youtubeSignupRequired - Google account does not have YouTube account")
	ErrNoMembersOnlyVideos   = errors.New("YouTube channel has membership enabled, but no members-only videos")
)

Functions

func GetOpenGraph

func GetOpenGraph(uri string) (*opengraph.OpenGraph, error)

Gets OpenGraph data from the provided URL.

func GetRefreshingDiscordTokenSource

func GetRefreshingDiscordTokenSource(ctx context.Context, db *ent.Client, config *oauth2.Config, userID uint64) (oauth2.TokenSource, error)

func GetYouTubeChannelOG

func GetYouTubeChannelOG(channelID string) (*opengraph.OpenGraph, error)

func GetYouTubeService

func GetYouTubeService(ctx context.Context, db *ent.Client, userID uint64, config *oauth2.Config) (*youtube.Service, error)

func GoogleErrHasReason

func GoogleErrHasReason(err *googleapi.Error, code int, reason string) bool

func IsCommentsDisabledErr

func IsCommentsDisabledErr(err *googleapi.Error) bool

func IsUnusableYouTubeTokenErr

func IsUnusableYouTubeTokenErr(err error) bool

func IsYouTubeSignupRequiredErr

func IsYouTubeSignupRequiredErr(err *googleapi.Error) bool

func SelectRandomMembersOnlyVideoID

func SelectRandomMembersOnlyVideoID(
	ctx context.Context,
	logger zerolog.Logger,
	svc *youtube.Service,
	channelID string,
) (string, error)

SelectRandomMembersOnlyVideoID chooses a random members-only video that has comments enabled.

Types

This section is empty.

Jump to

Keyboard shortcuts

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