events

package
v0.1.32 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PublishImageDownloadEvent

func PublishImageDownloadEvent(bc *broadcast.Relay[Event], event ImageDownload)

Types

type Event

type Event interface {
	templ.Component
	// Event returns the event name
	Event() string
	// SerializeTo writes the event data to the writer.
	//
	// SerializeTo must not write multiple linebreaks (single linebreak is fine)
	// in succession to the writer since it will mess up SSE events.
	SerializeTo(w io.Writer) error
}

type ImageDownload

type ImageDownload struct {
	EventKind             ImageDownloadEvent `json:"event,omitempty"`
	ImageURL              string             `json:"image_url,omitempty"`
	ImageHeight           int32              `json:"image_height,omitempty"`
	ImageWidth            int32              `json:"image_width,omitempty"`
	ContentLength         int64              `json:"content_length,omitempty"`
	Downloaded            int64              `json:"downloaded,omitempty"`
	Subreddit             string             `json:"subreddit,omitempty"`
	PostURL               string             `json:"post_url,omitempty"`
	PostName              string             `json:"post_name,omitempty"`
	PostTitle             string             `json:"post_title,omitempty"`
	PostCreated           int64              `json:"post_created,omitempty"`
	PostAuthor            string             `json:"post_author,omitempty"`
	PostAuthorURL         string             `json:"post_author_url,omitempty"`
	ImageRelativePath     string             `json:"image_relative_path,omitempty"`
	ImageOriginalURL      string             `json:"image_original_url,omitempty"`
	ImageSize             int64              `json:"image_size,omitempty"`
	ThumbnailRelativePath string             `json:"thumbnail_relative_path,omitempty"`
	NSFW                  int32              `json:"nsfw,omitempty"`
	Error                 error              `json:"error,omitempty"`
	Device                string             `json:"device,omitempty"`
}

func (ImageDownload) Clone

func (id ImageDownload) Clone() ImageDownload

func (ImageDownload) Event

func (im ImageDownload) Event() string

Event returns the event name

func (ImageDownload) Render

func (im ImageDownload) Render(ctx context.Context, w io.Writer) error

Render the template.

func (ImageDownload) SerializeTo

func (im ImageDownload) SerializeTo(w io.Writer) error

SerializeTo writes the event data to the writer.

SerializeTo must not write multiple linebreaks (single linebreak is fine) in succession to the writer since it will mess up SSE events.

type ImageDownloadEvent

type ImageDownloadEvent string
const (
	ImageDownloadStart    ImageDownloadEvent = "image.download.start"
	ImageDownloadEnd      ImageDownloadEvent = "image.download.end"
	ImageDownloadError    ImageDownloadEvent = "image.download.error"
	ImageDownloadProgress ImageDownloadEvent = "image.download.progress"
)

type ImageDownloadSubreddit

type ImageDownloadSubreddit struct {
	ImageDownload
}

func (ImageDownloadSubreddit) Event

func (im ImageDownloadSubreddit) Event() string

type ImageDownloadSubredditCard

type ImageDownloadSubredditCard struct {
	ImageDownload
}

func (ImageDownloadSubredditCard) Event

func (ImageDownloadSubredditCard) Render

Jump to

Keyboard shortcuts

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