1
0
mirror of https://github.com/mxpv/podsync.git synced 2024-05-11 05:55:04 +00:00

94 lines
2.0 KiB
Go
Raw Normal View History

2017-08-10 15:23:07 -07:00
package api
2017-07-22 22:08:38 -07:00
2017-08-20 16:01:30 -07:00
import (
"github.com/pkg/errors"
)
var (
2017-11-10 17:13:01 -08:00
ErrNotFound = errors.New("resource not found")
ErrQuotaExceeded = errors.New("query limit is exceeded")
2017-08-20 16:01:30 -07:00
)
2017-07-31 21:51:21 -07:00
2017-08-13 14:50:59 -07:00
type Provider string
const (
2017-11-03 15:04:33 -07:00
ProviderYoutube = Provider("youtube")
ProviderVimeo = Provider("vimeo")
2019-04-07 16:44:37 -07:00
ProviderGeneric = Provider("generic")
2017-08-13 14:50:59 -07:00
)
type LinkType string
const (
2017-11-03 15:04:33 -07:00
LinkTypeChannel = LinkType("channel")
LinkTypePlaylist = LinkType("playlist")
LinkTypeUser = LinkType("user")
LinkTypeGroup = LinkType("group")
2017-08-13 14:50:59 -07:00
)
2017-07-22 22:08:38 -07:00
type Quality string
const (
2017-11-03 15:04:33 -07:00
QualityHigh = Quality("high")
QualityLow = Quality("low")
2017-08-13 14:50:59 -07:00
)
type Format string
const (
2017-11-03 15:04:33 -07:00
FormatAudio = Format("audio")
FormatVideo = Format("video")
2017-07-22 22:08:38 -07:00
)
2017-08-11 12:49:56 -07:00
const (
2017-11-10 17:13:01 -08:00
DefaultPageSize = 50
DefaultFormat = FormatVideo
DefaultQuality = QualityHigh
ExtendedPaginationQueryLimit = 5000
2017-08-11 12:49:56 -07:00
)
2017-11-03 16:04:33 -07:00
type Metadata struct {
2017-11-04 17:27:01 -07:00
Provider Provider `json:"provider"`
Format Format `json:"format"`
Quality Quality `json:"quality"`
Downloads int64 `json:"downloads"`
2017-08-13 14:50:59 -07:00
}
const (
2019-01-06 21:36:42 -08:00
// DefaultFeatures represent features for Anonymous user
// Page size: 50
// Format: video
// Quality: high
2017-08-13 14:50:59 -07:00
DefaultFeatures = iota
2019-01-06 21:36:42 -08:00
// ExtendedFeatures represent features for 1$ pledges
// Max page size: 150
// Format: any
// Quality: any
2017-08-13 14:50:59 -07:00
ExtendedFeatures
2019-01-06 21:36:42 -08:00
// ExtendedPagination represent extended pagination feature set
// Max page size: 600
// Format: any
// Quality: any
2017-11-10 17:13:01 -08:00
ExtendedPagination
2019-01-06 21:36:42 -08:00
// PodcasterFeatures reserved for future
PodcasterFeatures
2017-08-13 14:50:59 -07:00
)
type CreateFeedRequest struct {
2017-08-14 16:38:59 -07:00
URL string `json:"url" binding:"url,required"`
2017-11-10 17:13:01 -08:00
PageSize int `json:"page_size" binding:"min=10,max=600,required"`
2017-08-14 16:38:59 -07:00
Quality Quality `json:"quality" binding:"eq=high|eq=low"`
Format Format `json:"format" binding:"eq=video|eq=audio"`
2017-07-22 22:08:38 -07:00
}
2017-08-20 16:01:30 -07:00
type Identity struct {
2019-01-06 21:36:42 -08:00
UserID string `json:"user_id"`
2017-08-20 16:01:30 -07:00
FullName string `json:"full_name"`
Email string `json:"email"`
ProfileURL string `json:"profile_url"`
FeatureLevel int `json:"feature_level"`
}