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

83 lines
1.9 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 (
"time"
"github.com/pkg/errors"
)
var (
ErrNotFound = errors.New("resource not found")
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")
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 (
DefaultPageSize = 50
2017-11-03 15:04:33 -07:00
DefaultFormat = FormatVideo
DefaultQuality = QualityHigh
2017-08-11 12:49:56 -07:00
)
2017-07-22 22:08:38 -07:00
type Feed struct {
2017-08-13 14:50:59 -07:00
Id int64 `json:"id"`
HashId string `json:"hash_id"` // Short human readable feed id for users
UserId string `json:"user_id"` // Patreon user id
ItemId string `json:"item_id"`
Provider Provider `json:"provider"` // Youtube or Vimeo
LinkType LinkType `json:"link_type"` // Either group, channel or user
PageSize int `json:"page_size"` // The number of episodes to return
Format Format `json:"format"`
Quality Quality `json:"quality"`
FeatureLevel int `json:"feature_level"` // Available features
LastAccess time.Time `json:"last_access"`
}
const (
DefaultFeatures = iota
ExtendedFeatures
PodcasterFeature
)
type CreateFeedRequest struct {
2017-08-14 16:38:59 -07:00
URL string `json:"url" binding:"url,required"`
PageSize int `json:"page_size" binding:"min=10,max=150,required"`
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 {
UserId string `json:"user_id"`
FullName string `json:"full_name"`
Email string `json:"email"`
ProfileURL string `json:"profile_url"`
FeatureLevel int `json:"feature_level"`
}