Documentation ¶
Index ¶
- Variables
- type API
- func (api *API) DeviceBySlug(ctx context.Context, slug string) (device *models.Device, err error)
- func (api *API) DevicesCountEnabled(ctx context.Context) (int64, error)
- func (api *API) DevicesCreate(ctx context.Context, params *models.Device) (device *models.Device, err error)
- func (api *API) DevicesExist(ctx context.Context, slug string) (exist bool, err error)
- func (api *API) DevicesList(ctx context.Context, params DevicesListParams) (result DevicesListResult, err error)
- func (api *API) DevicesUpdate(ctx context.Context, slug string, update *models.DeviceSetter) (device *models.Device, err error)
- func (api *API) DevicesValidateSlug(ctx context.Context, slug string) (exist bool, err error)
- func (api *API) DownloadSubredditImages(ctx context.Context, subreddit *models.Subreddit, devices models.DeviceSlice) error
- func (api *API) DownloadSubredditPosts(ctx context.Context, subredditName string, params DownloadSubredditPostsParams) (posts reddit.Listing, err error)
- func (api *API) GetDevices(ctx context.Context, params DevicesListParams) (result models.DeviceSlice, err error)
- func (api *API) GetEventBroadcaster() *broadcast.Relay[events.Event]
- func (api *API) ImagesList(ctx context.Context, params ImageListParams) (result ImageListResult, err error)
- func (api *API) ImagesListWithDevicesAndSubreddits(ctx context.Context, params ImageListParams) (result ImageListResult, err error)
- func (api *API) ListSubreddits(ctx context.Context, arg ListSubredditsParams) (result ListSubredditsResult, err error)
- func (api *API) ListSubredditsWithCover(ctx context.Context, arg ListSubredditsParams) (result ListSubredditsResult, err error)
- func (api *API) PubsubStartDownloadSubreddit(ctx context.Context, params PubsubStartDownloadSubredditParams) (err error)
- func (api *API) ScheduleHistoryInsert(ctx context.Context, params ScheduleSetParams) (history *models.ScheduleHistory, err error)
- func (api *API) ScheduleHistoryLatest(ctx context.Context) (result *models.ScheduleHistory, err error)
- func (api *API) ScheduleHistoryList(ctx context.Context, params ScheduleHistoryListParams) (result ScheduleHistoryListResult, err error)
- func (api *API) ScheduleHistoryListByDate(ctx context.Context, params ScheduleHistoryListByDateParams) (result ScheduleHistoryListResult, err error)
- func (api *API) ScheduleSet(ctx context.Context, params ScheduleSetParams) (schedule *models.ScheduleStatus, err error)
- func (api *API) ScheduleStatusUpsert(ctx context.Context, params ScheduleSetParams) (schedule *models.ScheduleStatus, err error)
- func (api *API) StartSubredditDownloadPubsub(messages <-chan *message.Message)
- func (api *API) SubredditCheck(ctx context.Context, params SubredditCheckParam) (actual string, err error)
- func (api *API) SubredditGetByNameWithImages(ctx context.Context, name string, imageParams SubredditGetByNameImageParams) (result SubredditGetByNameImageResult, err error)
- func (api *API) SubredditRegistered(ctx context.Context, params SubredditCheckParam) (registered bool, err error)
- func (api *API) SubredditsCreate(ctx context.Context, params *models.Subreddit) (subreddit *models.Subreddit, err error)
- func (api *API) SubredditsEdit(ctx context.Context, params SubredditEditParams) (subreddit *models.Subreddit, err error)
- func (api *API) SubredditsGetByName(ctx context.Context, name string) (subreddit *models.Subreddit, err error)
- func (api *API) SubscribeImageDownloadEvent() (<-chan bmessage.ImageDownloadMessage, func())
- type Dependencies
- type DeviceCreateParams
- type DevicesListParams
- type DevicesListResult
- type DownloadSubredditParams
- type DownloadSubredditPostsParams
- type ImageListParams
- type ImageListResult
- type ListSubredditsParams
- func (l ListSubredditsParams) CountQuery() (expr []bob.Mod[*dialect.SelectQuery])
- func (l *ListSubredditsParams) FillFromQuery(q Queryable)
- func (l ListSubredditsParams) ImageCoverQuery(subname string) (expr []bob.Mod[*dialect.SelectQuery])
- func (l ListSubredditsParams) Query() (expr []bob.Mod[*dialect.SelectQuery])
- type ListSubredditsResult
- type PubsubStartDownloadSubredditParams
- type Queryable
- type ScheduleHistoryListByDateParams
- type ScheduleHistoryListParams
- type ScheduleHistoryListResult
- func (result ScheduleHistoryListResult) GetFirst() *models.ScheduleHistory
- func (result ScheduleHistoryListResult) GetFirstTime() time.Time
- func (result ScheduleHistoryListResult) GetLast() *models.ScheduleHistory
- func (result ScheduleHistoryListResult) GetLastTime() time.Time
- func (result ScheduleHistoryListResult) SplitByDay() (out []ScheduleHistoryListResultDay)
- type ScheduleHistoryListResultDay
- type ScheduleSetParams
- type ScheduleStatus
- type SubredditCheckParam
- type SubredditEditParams
- type SubredditGetByNameImageParams
- func (sgb *SubredditGetByNameImageParams) CountQuery() (expr []bob.Mod[*dialect.SelectQuery])
- func (sgb *SubredditGetByNameImageParams) FillFromQuery(query Queryable)
- func (sgb SubredditGetByNameImageParams) IntoQuery() url.Values
- func (sgb SubredditGetByNameImageParams) IntoQueryWith(keyValue ...string) url.Values
- func (sgb *SubredditGetByNameImageParams) Query() (expr []bob.Mod[*dialect.SelectQuery])
- type SubredditGetByNameImageResult
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNoDevices = errors.New("api: no devices set") ErrDownloadDirNotSet = errors.New("api: download directory not set") )
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
func New ¶
func New(deps Dependencies) *API
func (*API) DeviceBySlug ¶
func (*API) DevicesCountEnabled ¶
func (*API) DevicesCreate ¶
func (*API) DevicesExist ¶
func (*API) DevicesList ¶
func (api *API) DevicesList(ctx context.Context, params DevicesListParams) (result DevicesListResult, err error)
func (*API) DevicesUpdate ¶
func (*API) DevicesValidateSlug ¶
func (*API) DownloadSubredditImages ¶
func (*API) DownloadSubredditPosts ¶
func (*API) GetDevices ¶
func (api *API) GetDevices(ctx context.Context, params DevicesListParams) (result models.DeviceSlice, err error)
func (*API) GetEventBroadcaster ¶
func (*API) ImagesList ¶
func (api *API) ImagesList(ctx context.Context, params ImageListParams) (result ImageListResult, err error)
func (*API) ImagesListWithDevicesAndSubreddits ¶
func (api *API) ImagesListWithDevicesAndSubreddits(ctx context.Context, params ImageListParams) (result ImageListResult, err error)
func (*API) ListSubreddits ¶
func (api *API) ListSubreddits(ctx context.Context, arg ListSubredditsParams) (result ListSubredditsResult, err error)
func (*API) ListSubredditsWithCover ¶
func (api *API) ListSubredditsWithCover(ctx context.Context, arg ListSubredditsParams) (result ListSubredditsResult, err error)
ListSubredditsWithCover returns list of subreddits with cover image.
Image Relationship `R` struct will be nil if there is no cover image.
func (*API) PubsubStartDownloadSubreddit ¶
func (api *API) PubsubStartDownloadSubreddit(ctx context.Context, params PubsubStartDownloadSubredditParams) (err error)
func (*API) ScheduleHistoryInsert ¶
func (api *API) ScheduleHistoryInsert(ctx context.Context, params ScheduleSetParams) (history *models.ScheduleHistory, err error)
func (*API) ScheduleHistoryLatest ¶
func (*API) ScheduleHistoryList ¶
func (api *API) ScheduleHistoryList(ctx context.Context, params ScheduleHistoryListParams) (result ScheduleHistoryListResult, err error)
func (*API) ScheduleHistoryListByDate ¶
func (api *API) ScheduleHistoryListByDate(ctx context.Context, params ScheduleHistoryListByDateParams) (result ScheduleHistoryListResult, err error)
func (*API) ScheduleSet ¶
func (api *API) ScheduleSet(ctx context.Context, params ScheduleSetParams) (schedule *models.ScheduleStatus, err error)
func (*API) ScheduleStatusUpsert ¶
func (api *API) ScheduleStatusUpsert(ctx context.Context, params ScheduleSetParams) (schedule *models.ScheduleStatus, err error)
func (*API) StartSubredditDownloadPubsub ¶
func (*API) SubredditCheck ¶
func (*API) SubredditGetByNameWithImages ¶
func (api *API) SubredditGetByNameWithImages(ctx context.Context, name string, imageParams SubredditGetByNameImageParams) (result SubredditGetByNameImageResult, err error)
func (*API) SubredditRegistered ¶
func (*API) SubredditsCreate ¶
func (*API) SubredditsEdit ¶
func (*API) SubredditsGetByName ¶
func (*API) SubscribeImageDownloadEvent ¶
func (api *API) SubscribeImageDownloadEvent() (<-chan bmessage.ImageDownloadMessage, func())
type Dependencies ¶
type DeviceCreateParams ¶
type DeviceCreateParams = models.DeviceSetter
type DevicesListParams ¶
type DevicesListParams struct { Q string Status int Limit int64 Offset int64 OrderBy string Sort string }
func (DevicesListParams) CountQuery ¶
func (dlp DevicesListParams) CountQuery() (expr []bob.Mod[*dialect.SelectQuery])
func (*DevicesListParams) FillFromQuery ¶
func (dlp *DevicesListParams) FillFromQuery(query Queryable)
func (DevicesListParams) Query ¶
func (dlp DevicesListParams) Query() (expr []bob.Mod[*dialect.SelectQuery])
type DevicesListResult ¶
type DevicesListResult struct { Devices models.DeviceSlice `json:"devices"` Total int64 `json:"total"` }
type DownloadSubredditParams ¶
type DownloadSubredditParams struct { Countback int Devices models.DeviceSlice SubredditType reddit.SubredditType }
type ImageListParams ¶
type ImageListParams struct { Q string NSFW int32 OrderBy string Sort string Offset int64 Limit int64 Device string Subreddit string CreatedAt time.Time }
func (ImageListParams) CountQuery ¶
func (ilp ImageListParams) CountQuery() (expr []bob.Mod[*dialect.SelectQuery])
func (*ImageListParams) FillFromQuery ¶
func (ilp *ImageListParams) FillFromQuery(query Queryable)
func (ImageListParams) Query ¶
func (ilp ImageListParams) Query() (expr []bob.Mod[*dialect.SelectQuery])
type ImageListResult ¶
type ImageListResult struct { Total int64 Images models.ImageSlice }
func (ImageListResult) MarshalJSON ¶
func (im ImageListResult) MarshalJSON() ([]byte, error)
type ListSubredditsParams ¶
type ListSubredditsParams struct { Q string All bool Limit int64 Offset int64 OrderBy string Sort string NSFW int }
func (ListSubredditsParams) CountQuery ¶
func (l ListSubredditsParams) CountQuery() (expr []bob.Mod[*dialect.SelectQuery])
func (*ListSubredditsParams) FillFromQuery ¶
func (l *ListSubredditsParams) FillFromQuery(q Queryable)
func (ListSubredditsParams) ImageCoverQuery ¶
func (l ListSubredditsParams) ImageCoverQuery(subname string) (expr []bob.Mod[*dialect.SelectQuery])
func (ListSubredditsParams) Query ¶
func (l ListSubredditsParams) Query() (expr []bob.Mod[*dialect.SelectQuery])
type ListSubredditsResult ¶
type ListSubredditsResult struct { Total int64 Data models.SubredditSlice }
type PubsubStartDownloadSubredditParams ¶
type PubsubStartDownloadSubredditParams struct {
Subreddit string `json:"subreddit"`
}
type ScheduleHistoryListByDateParams ¶
func (*ScheduleHistoryListByDateParams) CountQuery ¶
func (params *ScheduleHistoryListByDateParams) CountQuery() (expr []bob.Mod[*dialect.SelectQuery])
func (*ScheduleHistoryListByDateParams) FillFromQuery ¶
func (params *ScheduleHistoryListByDateParams) FillFromQuery(query Queryable)
func (*ScheduleHistoryListByDateParams) Query ¶
func (params *ScheduleHistoryListByDateParams) Query() (expr []bob.Mod[*dialect.SelectQuery])
type ScheduleHistoryListParams ¶
func (ScheduleHistoryListParams) CountQuery ¶
func (params ScheduleHistoryListParams) CountQuery() (expr []bob.Mod[*dialect.SelectQuery])
func (*ScheduleHistoryListParams) FillFromQuery ¶
func (params *ScheduleHistoryListParams) FillFromQuery(query Queryable)
func (ScheduleHistoryListParams) Query ¶
func (params ScheduleHistoryListParams) Query() (expr []bob.Mod[*dialect.SelectQuery])
type ScheduleHistoryListResult ¶
type ScheduleHistoryListResult struct { Schedules models.ScheduleHistorySlice `json:"schedules"` Total int64 `json:"count"` }
func (ScheduleHistoryListResult) GetFirst ¶
func (result ScheduleHistoryListResult) GetFirst() *models.ScheduleHistory
func (ScheduleHistoryListResult) GetFirstTime ¶
func (result ScheduleHistoryListResult) GetFirstTime() time.Time
func (ScheduleHistoryListResult) GetLast ¶
func (result ScheduleHistoryListResult) GetLast() *models.ScheduleHistory
func (ScheduleHistoryListResult) GetLastTime ¶
func (result ScheduleHistoryListResult) GetLastTime() time.Time
func (ScheduleHistoryListResult) SplitByDay ¶
func (result ScheduleHistoryListResult) SplitByDay() (out []ScheduleHistoryListResultDay)
type ScheduleHistoryListResultDay ¶
type ScheduleHistoryListResultDay struct { Date time.Time `json:"date"` ScheduleHistoryListResult }
func (ScheduleHistoryListResultDay) GetLast ¶
func (resultDay ScheduleHistoryListResultDay) GetLast() *models.ScheduleHistory
type ScheduleSetParams ¶
type ScheduleSetParams struct { Subreddit string Status ScheduleStatus ErrorMessage string }
type ScheduleStatus ¶
type ScheduleStatus int8
const ( ScheduleStatusDisabled ScheduleStatus = iota ScheduleStatusEnabled ScheduleStatusStandby ScheduleStatusEnqueued ScheduleStatusDownloading ScheduleStatusError )
func (ScheduleStatus) Int8 ¶
func (ss ScheduleStatus) Int8() int8
func (ScheduleStatus) String ¶
func (ss ScheduleStatus) String() string
type SubredditCheckParam ¶
type SubredditCheckParam = reddit.CheckSubredditParams
type SubredditEditParams ¶
type SubredditGetByNameImageParams ¶
type SubredditGetByNameImageParams struct { Q string Limit int64 Offset int64 OrderBy string Sort string NSFW int After time.Time Device string }
func (*SubredditGetByNameImageParams) CountQuery ¶
func (sgb *SubredditGetByNameImageParams) CountQuery() (expr []bob.Mod[*dialect.SelectQuery])
func (*SubredditGetByNameImageParams) FillFromQuery ¶
func (sgb *SubredditGetByNameImageParams) FillFromQuery(query Queryable)
func (SubredditGetByNameImageParams) IntoQuery ¶
func (sgb SubredditGetByNameImageParams) IntoQuery() url.Values
func (SubredditGetByNameImageParams) IntoQueryWith ¶
func (sgb SubredditGetByNameImageParams) IntoQueryWith(keyValue ...string) url.Values
func (*SubredditGetByNameImageParams) Query ¶
func (sgb *SubredditGetByNameImageParams) Query() (expr []bob.Mod[*dialect.SelectQuery])
type SubredditGetByNameImageResult ¶
type SubredditGetByNameImageResult struct { Subreddit *models.Subreddit Images models.ImageSlice Total int64 }
Source Files ¶
- api.go
- devices_by_slug.go
- devices_count.go
- devices_create.go
- devices_exist.go
- devices_list.go
- devices_update.go
- devices_validate_slug.go
- download_subreddit_images.go
- download_subreddit_posts.go
- events.go
- images_list.go
- lock.go
- pubsub_download.go
- queryable.go
- schedule_history_insert.go
- schedule_history_last.go
- schedule_history_list.go
- schedule_history_list_by_day.go
- schedule_set.go
- schedule_status_upsert.go
- subreddits_check.go
- subreddits_create.go
- subreddits_edit.go
- subreddits_get_by_name.go
- subreddits_list.go
- tracer.go
- transaction.go
Click to show internal directories.
Click to hide internal directories.