Documentation
¶
Overview ¶
Package models provides primitives to interact with the openapi HTTP API.
Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.6.0 DO NOT EDIT.
Package models provides primitives to interact with the openapi HTTP API.
Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.6.0 DO NOT EDIT.
Package models contains objects and fields representing common schema within the application.
Index ¶
- Constants
- Variables
- func ArticleFiltersQueryClause(source ItemSource) query.BoolOption
- func BuildItemQueries(user *User, view View, subscriptions Subscriptions) []query.Option
- func ClientTypeToCtx(ctx context.Context, clientType ClientType) context.Context
- func FilterMap[K comparable, V any](m map[K]V, fn func(K, V) bool) iter.Seq2[K, V]
- func FilterMapValues[K comparable, V any](s map[K]V, fn func(V) bool) iter.Seq[V]
- func FilterSlice[E any](s []E, fn func(E) bool) iter.Seq[E]
- func HTTPStatus(err error) int
- func NormaliseFeedURL(raw string) string
- func SearchResultsClause(search *SearchRequest) query.BoolOption
- func SearchSuggestionsClause(search *SearchRequest) query.BoolOption
- func SliceToMap[K comparable, V any, S any](s []S, mapFn func(S) (K, V)) map[K]V
- func SubscriptionsToCtx(ctx context.Context, subscriptions Subscriptions) context.Context
- func UserToCtx(ctx context.Context, user *User) context.Context
- func ValidateDatetime(dt time.Time) (bool, error)
- type APIError
- func (e *APIError) Error() string
- func (a APIError) Get(fieldName string) (value interface{}, found bool)
- func (e *APIError) GetUserMessage() *UserMessage
- func (e *APIError) HTTPStatus() int
- func (a APIError) MarshalJSON() ([]byte, error)
- func (a *APIError) Set(fieldName string, value interface{})
- func (a *APIError) UnmarshalJSON(b []byte) error
- func (e *APIError) Unwrap() error
- func (e *APIError) WriteLog(ctx context.Context)
- type AddCategoryToSubscriptionRequest
- type AddFeedSubscriptionRequest
- type AddFeedsetRequest
- type AddSubscriptionResult
- type AddSubscriptionSearchFilterRequest
- type AddSubscriptionToGroupRequest
- type AddSubscriptionToSearchRequest
- type AndroidCheckout
- type AndroidSubscription
- type Article
- func (a *Article) AsYoutubeVideo() (*ItemExtensionYoutube, error)
- func (a *Article) GetAuthors() []Author
- func (a *Article) GetCategories(num int) Categories
- func (a *Article) GetContent() string
- func (a *Article) GetDescription() string
- func (a *Article) GetFeedID() FeedID
- func (a *Article) GetFeedTitle() string
- func (a *Article) GetID() string
- func (a *Article) GetImage() *RemoteImage
- func (a *Article) GetLink() string
- func (a *Article) GetObjectType() ObjectType
- func (a *Article) GetSubscriptionID() SubscriptionID
- func (a *Article) GetTitle() string
- func (a *Article) GetUpdatedDate() time.Time
- func (a *Article) IsEmail() bool
- func (a *Article) IsFavorite() bool
- func (a *Article) IsRemoteContent() bool
- func (a *Article) IsUnread() bool
- func (a *Article) IsYoutubeVideo() bool
- func (a *Article) Valid() error
- type ArticleArchive
- type ArticleArchiveExtensionType
- type ArticleArchive_ExtensionData
- func (t ArticleArchive_ExtensionData) AsItemExtensionYoutube() (ItemExtensionYoutube, error)
- func (t *ArticleArchive_ExtensionData) FromItemExtensionYoutube(v ItemExtensionYoutube) error
- func (t ArticleArchive_ExtensionData) MarshalJSON() ([]byte, error)
- func (t *ArticleArchive_ExtensionData) MergeItemExtensionYoutube(v ItemExtensionYoutube) error
- func (t *ArticleArchive_ExtensionData) UnmarshalJSON(b []byte) error
- type ArticleMetadata
- type ArticleSettings
- type ArticleState
- type Articles
- type Author
- type Categories
- type Category
- type CategoryCount
- type CategoryCounts
- type CategoryFilters
- type ChangePasswordRequest
- type CheckoutRequest
- type CheckoutRequest_SubscriptionData
- func (t CheckoutRequest_SubscriptionData) AsAndroidCheckout() (AndroidCheckout, error)
- func (t CheckoutRequest_SubscriptionData) AsPaddleCheckout() (PaddleCheckout, error)
- func (t *CheckoutRequest_SubscriptionData) FromAndroidCheckout(v AndroidCheckout) error
- func (t *CheckoutRequest_SubscriptionData) FromPaddleCheckout(v PaddleCheckout) error
- func (t CheckoutRequest_SubscriptionData) MarshalJSON() ([]byte, error)
- func (t *CheckoutRequest_SubscriptionData) MergeAndroidCheckout(v AndroidCheckout) error
- func (t *CheckoutRequest_SubscriptionData) MergePaddleCheckout(v PaddleCheckout) error
- func (t *CheckoutRequest_SubscriptionData) UnmarshalJSON(b []byte) error
- type ClientType
- type ContactRequest
- type Count
- type CreatedAt
- type DeletedAt
- type EditEmailSubscriptionRequest
- type EditUserRequest
- type ElementID
- type Email
- type EmailSenderID
- type EmailSubscription
- type EmailTemplateID
- type ErrorOption
- type FavoriteArticleRequest
- type FavoriteSubscriptionRequest
- type Feed
- func (f *Feed) GetAuthors() []string
- func (f *Feed) GetCategories() []string
- func (f *Feed) GetContributors() []string
- func (f *Feed) GetDescription() string
- func (f *Feed) GetID() FeedID
- func (f *Feed) GetImage() *RemoteImage
- func (f *Feed) GetItems() Items
- func (f *Feed) GetLanguage() string
- func (f *Feed) GetLink() URL
- func (f *Feed) GetRights() string
- func (f *Feed) GetSourceURLs() []URL
- func (f *Feed) GetTimestamp() time.Time
- func (f *Feed) GetTitle() string
- type FeedFetchMethod
- type FeedID
- type FeedQuirks
- type FeedStatus
- type FeedSubscription
- type FeedSubscriptionRequest
- type FeedSubscriptionResult
- type FeedSuggestionsResults
- type Feeds
- type FileDetails
- type FileIndex
- type FileUpload
- type Filters
- type GetSubscriptionsSuggestionRequest
- type GroupSubscription
- type GroupSubscriptionRequest
- type GroupSubscriptionSuggestionRequest
- type Item
- func (i *Item) GetAuthors() []Author
- func (i *Item) GetCategories() []string
- func (i *Item) GetContent() string
- func (i *Item) GetContributors() []Author
- func (i *Item) GetDescription() string
- func (i *Item) GetFeedID() FeedID
- func (i *Item) GetID() ItemID
- func (i *Item) GetImage() *RemoteImage
- func (i *Item) GetLanguage() string
- func (i *Item) GetLink() URL
- func (i *Item) GetRights() string
- func (i *Item) GetTimestamp() time.Time
- func (i *Item) GetTitle() string
- func (i *Item) HasContent() bool
- func (i *Item) IsNewer(since time.Time) bool
- func (i *Item) WasUpdated() bool
- type ItemExtensionType
- type ItemExtensionYoutube
- type ItemID
- type ItemSource
- type Item_ExtensionData
- func (t Item_ExtensionData) AsItemExtensionYoutube() (ItemExtensionYoutube, error)
- func (t *Item_ExtensionData) FromItemExtensionYoutube(v ItemExtensionYoutube) error
- func (t Item_ExtensionData) MarshalJSON() ([]byte, error)
- func (t *Item_ExtensionData) MergeItemExtensionYoutube(v ItemExtensionYoutube) error
- func (t *Item_ExtensionData) UnmarshalJSON(b []byte) error
- type Items
- func (i Items) ExcludeIDs(ids ...ItemID) Items
- func (i Items) FilterByFeed(feedID FeedID) Items
- func (i Items) FilterByIDs(ids ...ItemID) Items
- func (i Items) FilterSince(since time.Time) Items
- func (i Items) FindByID(id ItemID) *Item
- func (i Items) GetCategoryCounts() CategoryCounts
- func (i Items) GetFeedIDs() []FeedID
- func (i Items) GetIDs() []ItemID
- func (i Items) SortByTimestamp() Items
- type LastFetched
- type ListArticlesResponse
- type ListFavoritesResponse
- type ListFilters
- func (f *ListFilters) GetCategories() Categories
- func (f *ListFilters) GetCount() int
- func (f *ListFilters) GetSort() Sort
- func (f *ListFilters) GetSubscriptions() []SubscriptionID
- func (f *ListFilters) GetView() View
- func (f *ListFilters) QueryParams() url.Values
- func (f *ListFilters) QueryString() string
- func (f *ListFilters) Sanitise() error
- func (f *ListFilters) Valid() error
- func (f *ListFilters) Values() map[string]any
- type ListRequest
- type ListSubscriptionCategoriesRequest
- type ListSubscriptionsResponse
- type Mark
- type MarkArticleRequest
- type MarkArticlesRequest
- type MarkObjectParams
- type MarkSubscriptionRequest
- type MarkSubscriptionsRequest
- type MarkdownFile
- type MarkdownFrontMatter
- type Nickname
- type OPMLFile
- type ObjectCommon
- type ObjectID
- type ObjectParams
- type ObjectType
- type PaddleCheckout
- type PaddleSubscription
- type Pagination
- type RemoteImage
- type RemoveSubscriptionRequest
- type ReportIssueRequest
- type SearchRequest
- type SearchRequestPublishedWithin
- type SearchResults
- type SearchSubscription
- type SearchSubscriptionRequest
- type ShareArticleRequest
- type Sort
- type SourceType
- type State
- type Subscription
- func NewEmailSubscription(ctx context.Context, userID UserID, from *mail.Address) (*Subscription, error)
- func NewFeedSubscription(ctx context.Context, feed *Feed, customisation *SubscriptionCustomisation) (*Subscription, error)
- func NewGroupSubscription(ctx context.Context, request *GroupSubscriptionRequest) (*Subscription, error)
- func NewSearchSubscription(ctx context.Context, request *SearchSubscriptionRequest) (*Subscription, error)
- func (s *Subscription) GetArticleFilters() SubscriptionArticleFilters
- func (s *Subscription) GetCategories(maxCount int) Categories
- func (s *Subscription) GetFeedID() FeedID
- func (s *Subscription) GetID() SubscriptionID
- func (s *Subscription) GetImage() URL
- func (s *Subscription) GetItemState(itemID ItemID) *ArticleState
- func (s *Subscription) GetLink() string
- func (s *Subscription) GetMarkedReadAt() time.Time
- func (s *Subscription) GetReadItems() []ItemID
- func (s *Subscription) GetStats() *SubscriptionStats
- func (s *Subscription) GetSubscriptionType() SubscriptionType
- func (s *Subscription) GetTitle() string
- func (s *Subscription) GetUnreadItems() []ItemID
- func (s *Subscription) GetUpdatedDate() time.Time
- func (s *Subscription) IsFavorite() bool
- func (s *Subscription) Mark(user *User, mark Mark)
- func (s *Subscription) MarkItems(mark Mark, itemIDs ...ItemID)
- func (s *Subscription) MarkItemsRead(itemIDs ...ItemID)
- func (s *Subscription) MarkItemsUnread(itemIDs ...ItemID)
- func (s *Subscription) SetItemState(itemID ItemID, state *ArticleState)
- func (s *Subscription) Valid() error
- type SubscriptionArticleFilters
- type SubscriptionCustomisation
- type SubscriptionID
- type SubscriptionMetadata
- type SubscriptionMetadataType
- type SubscriptionSettings
- type SubscriptionStats
- type SubscriptionType
- type Subscriptions
- func (s Subscriptions) ExcludeIDs(ids ...SubscriptionID) Subscriptions
- func (s Subscriptions) FilterByCategories(categories ...Category) Subscriptions
- func (s Subscriptions) FilterByFavorites(value bool) Subscriptions
- func (s Subscriptions) FilterByFeedIDs(ids ...FeedID) Subscriptions
- func (s Subscriptions) FilterByIDs(ids ...SubscriptionID) Subscriptions
- func (s Subscriptions) FilterByType(t ...SubscriptionType) Subscriptions
- func (s Subscriptions) FilterByView(view View) Subscriptions
- func (s Subscriptions) FilterEmailIDs(ids ...string) Subscriptions
- func (s Subscriptions) GetByFeedID(id FeedID) *Subscription
- func (s Subscriptions) GetByID(id SubscriptionID) *Subscription
- func (s Subscriptions) GetCategories() Categories
- func (s Subscriptions) GetFeedIDs() []FeedID
- func (s Subscriptions) GetIDs() []SubscriptionID
- func (s Subscriptions) Paginate(pagination Pagination, count int) (Subscriptions, Pagination)
- func (s Subscriptions) Sort(sort Sort) Subscriptions
- type Timestamp
- type URL
- type UpdatedAt
- type User
- func (u *User) GetAvatar() string
- func (u *User) GetEmail() string
- func (u *User) GetExternalID() UserID
- func (u *User) GetID() UserID
- func (u *User) GetMaxHistory() time.Time
- func (u *User) GetNickname() string
- func (u *User) GetSettings() *UserSettings
- func (u *User) GetUpdatesFrequency() time.Duration
- func (u *User) HasValidSubscription() bool
- func (u *User) InTrial() bool
- func (u *User) InTrialGracePeriod() bool
- func (u *User) Valid(_ context.Context) error
- type UserCustomisation
- type UserID
- type UserLimit
- type UserMessage
- type UserMessageStatus
- type UserMetadata
- type UserSession
- type UserSettings
- type UserSubscriptionType
- type User_Subscription
- func (t User_Subscription) AsAndroidSubscription() (AndroidSubscription, error)
- func (t User_Subscription) AsPaddleSubscription() (PaddleSubscription, error)
- func (t *User_Subscription) FromAndroidSubscription(v AndroidSubscription) error
- func (t *User_Subscription) FromPaddleSubscription(v PaddleSubscription) error
- func (t User_Subscription) MarshalJSON() ([]byte, error)
- func (t *User_Subscription) MergeAndroidSubscription(v AndroidSubscription) error
- func (t *User_Subscription) MergePaddleSubscription(v PaddleSubscription) error
- func (t *User_Subscription) UnmarshalJSON(b []byte) error
- type View
- type YoutubeVideoStatistics
Constants ¶
const ( ParamObjectType = "object" ParamObjectID = "id" // ParamCategories is a list of category names, of any single object type (subscription or article). ParamCategories = "categories" // ParamCount is the number of results to show, where multiple results can be displayed. ParamCount = "count" // ParamPagination is the encoded pagination value, used to fetch the next set of results when paginating through a // list of objects. ParamPagination = "pagination" // ParamSort is the sort option to apply to a set of results. ParamSort = "sort" // ParamView is the view filter to apply to a set of results. ParamView = "view" // ParamMark is a mark to apply to either an object or set of objects in the request. ParamMark = "mark" // ParamFeedID identifies a single feed by its id. ParamFeedID = "feed_id" // ParamItemID identifies a single item by its id. ParamItemID = "item_id" // ParamSubscriptionID identifies a single subscription by its id. ParamSubscriptionID = "subscription_id" ParamSubscriptionName = "subscription_name" // ParamSubscriptions is a list of subscription ids. ParamSubscriptions = "subscriptions" ParamFullArticleContent = "show_full_content" ParamOnlyFavorites = "only_favorites" // ParamThumbnail is a thumbnail image uploaded by the user. ParamThumbnail = "thumbnail" )
const ( RouteSignup = "/signup" RouteCheckout = "/checkout" RouteCheckoutChoosePlan = "/checkout/choose-plan" RouteListSubscriptions = "/list/subscriptions" RouteListArticles = "/list/articles" RouteListFavorites = "/list/favorites" RouteUserDeactivateAccount = "/user/deactivate" RouteUserCancelDeactivationAccount = "/user/deactivate/cancel" )
const ( ParamCustomisationCategories = "customisation.categories" ParamCustomisationNickname = "customisation.nickname" )
const ( // DefaultMaxHistory is a default maximum history value for when the user has not specified one. DefaultMaxHistory = 31 * 24 * time.Hour // DefaultUpdateInterval is the default interval on which to check for updates. DefaultUpdateInterval = 5 * time.Minute // MaxSubscriptions is the maximum number of subscriptions a user can have. MaxSubscriptions = 3000 // MaxEmailNewsletters is the maximum number of email newsletter subscriptions a user can have. MaxEmailNewsletters = 50 // LimitExceededGracePeriod is the grace period in which the user is allowed to remain over an account limit. LimitExceededGracePeriod = 7 * 24 * time.Hour // DefaultTrialPeriod is the default amount of time a trial runs for. DefaultTrialPeriod = 14 * 24 * time.Hour )
const (
// DefaultPaginationSize is the default number of docs to fetch when paginating through results from elasticsearch.
DefaultPaginationSize = 5000
)
Variables ¶
var ( // ErrNotFound indicates the backend API returned no results. ErrNotFound = &APIError{ InternalError: errors.New("not found"), StatusCode: http.StatusNotFound, } // ErrInvalidAPIResult indicates that the backend API returned unexpected, invalid or an otherwise incorrect response. ErrInvalidAPIResult = &APIError{ InternalError: errors.New("invalid backend API result"), StatusCode: http.StatusInternalServerError, } // ErrInvalidParams indicates that invalid parameters were received or generated. ErrInvalidParams = &APIError{ InternalError: errors.New("invalid parameters"), StatusCode: http.StatusUnprocessableEntity, } ErrForbidden = &APIError{ InternalError: errors.New("forbidden"), StatusCode: http.StatusForbidden, UserMessage: NewWarningMessage( "Access restricted.", "Your access has been forbidden. Please contact support if you believe this is an error.", ), } // ErrSubscriptionLimitExceeded indicates that the user has exceeded their subscription limit. ErrSubscriptionLimitExceeded = &APIError{ InternalError: errors.New("subscription limit exceeded"), StatusCode: http.StatusTooManyRequests, UserMessage: NewWarningMessage( "Exceeded subscription limit.", "You have exceeded your subscription limit ("+strconv.Itoa( MaxSubscriptions, )+"). Please remove some subscriptions to get under this limit before continuing.", ), } // ErrEmailNewsletterLimitExceeded indicates that the user has exceeded their email newsletter limit. ErrEmailNewsletterLimitExceeded = &APIError{ InternalError: errors.New("email newsletter limit exceeded"), StatusCode: http.StatusTooManyRequests, UserMessage: NewWarningMessage( "Exceeded email newsletter limit.", "You have exceeded your email newsletter limit ("+strconv.Itoa( MaxEmailNewsletters, )+"). Please remove some email newsletter subscriptions to get under this limit before continuing.", ), } )
var CommonCategoryFilters = []string{
"Post",
"Posts",
"News",
"Article",
"Articles",
"Links",
"Uncategorized",
"Featured",
"Headline",
"Home Feed",
}
CommonCategoryFilters is slice of categories that are so general or inclusive that they are ultimately useless for queries or aggregations.
Regular expressions are supported. See:
https://www.elastic.co/docs/reference/query-languages/query-dsl/regexp-syntax
var ErrCtxValueNotFound = &APIError{ InternalError: errors.New("context value not found"), StatusCode: http.StatusInternalServerError, }
var ErrFileTooLarge = errors.New("file is too large")
ErrFileTooLarge can be used to indicate a file upload had a size greater than a set limit.
var ErrInvalidArticleContent = errors.New("invalid article content")
var ErrInvalidDateTimeFormat = errors.New("datetime is invalid")
var ErrInvalidMimeType = errors.New("invalid mime type")
ErrInvalidMimeType indicates that the mime type is not valid.
var ErrNoFilters = &APIError{ InternalError: errors.New("no filters found"), StatusCode: http.StatusNotFound, }
var ErrUnknown = errors.New("an unknown error occurred")
var (
ErrUserAlreadyFavorited = errors.New("already a favorite")
)
var ImageExtensions = []string{"jpg", "jpeg", "png", "webp", "gif", "avif", "svg", "tiff", "bmp"}
var UnixEpoch = time.Unix(0, 0)
Functions ¶
func ArticleFiltersQueryClause ¶ added in v0.60.0
func ArticleFiltersQueryClause(source ItemSource) query.BoolOption
func BuildItemQueries ¶ added in v0.26.0
func BuildItemQueries( user *User, view View, subscriptions Subscriptions, ) []query.Option
BuildItemQueries generates a slices of queries for the given subscriptions, based on the given filters.
func ClientTypeToCtx ¶ added in v0.162.0
func ClientTypeToCtx(ctx context.Context, clientType ClientType) context.Context
ClientTypeFromCtx stores a ClientType in the context.
func FilterMap ¶
func FilterMap[K comparable, V any](m map[K]V, fn func(K, V) bool) iter.Seq2[K, V]
FilterMap will filter a map by the given function.
func FilterMapValues ¶
func FilterMapValues[K comparable, V any](s map[K]V, fn func(V) bool) iter.Seq[V]
FilterMapValues will filter map values by the given function.
func FilterSlice ¶
FilterSlice will filter a slice returning an iter with elements that return true for the given filter function.
func HTTPStatus ¶
HTTPStatus returns the HTTP status included in err. If err is nil, this function returns 0. If err is non-nil, and does not include an HTTP status, a default value of net/http.StatusInternalServerError is returned.
func NormaliseFeedURL ¶ added in v0.134.0
NormaliseFeedURL strips protocol handler schemes and cleans the URL.
func SearchResultsClause ¶
func SearchResultsClause(search *SearchRequest) query.BoolOption
func SearchSuggestionsClause ¶
func SearchSuggestionsClause(search *SearchRequest) query.BoolOption
func SliceToMap ¶
func SliceToMap[K comparable, V any, S any](s []S, mapFn func(S) (K, V)) map[K]V
SliceToMap generates a map from slice content by mapping key-value pairs from the slice with the given map function.
func SubscriptionsToCtx ¶
func SubscriptionsToCtx(ctx context.Context, subscriptions Subscriptions) context.Context
SubscriptionsToCtx stores the slice of Subscriptions in the context. Useful for pre-fetching/generating subscriptions for later usage.
Types ¶
type APIError ¶
type APIError struct {
// InternalError is the low-level, internal error.
InternalError error `json:"internal_error,omitempty"`
// StatusCode is the status code associated with the error. Usually, this is a HTTP status code.
StatusCode int `json:"status_code"`
// UserMessage represents a message that can be displayed to the user as the result of an action.
UserMessage *UserMessage `json:"user_message,omitempty"`
AdditionalProperties map[string]interface{} `json:"-"`
}
APIError represents an error returned from any API within the service/application.
func NewAPIError ¶ added in v0.120.0
func NewAPIError(status int, err error, options ...ErrorOption) *APIError
func (APIError) Get ¶ added in v0.83.0
Getter for additional properties for APIError. Returns the specified element and whether it was found
func (*APIError) GetUserMessage ¶
func (e *APIError) GetUserMessage() *UserMessage
GetUserMessage returns a UserMessage associated with the error. It will return an appropriate generic error message or warning where no message is already defined.
func (*APIError) HTTPStatus ¶
HTTPStatus returns the status code of the API error.
func (APIError) MarshalJSON ¶ added in v0.83.0
Override default JSON handling for APIError to handle AdditionalProperties
func (*APIError) UnmarshalJSON ¶ added in v0.83.0
Override default JSON handling for APIError to handle AdditionalProperties
type AddCategoryToSubscriptionRequest ¶ added in v0.82.4
type AddCategoryToSubscriptionRequest struct {
// Category represents a taxonomy applied to an object.
Category Category `form:"category" json:"category"`
// ExistingCategories is a list of categories already assigned to the subscription.
ExistingCategories []Category `form:"customisation.categories" json:"existing_categories,omitempty"`
}
AddCategoryToSubscriptionRequest is a request to add a new category to a subscription.
func (*AddCategoryToSubscriptionRequest) Sanitise ¶ added in v0.82.4
func (r *AddCategoryToSubscriptionRequest) Sanitise() error
func (*AddCategoryToSubscriptionRequest) Valid ¶ added in v0.82.4
func (r *AddCategoryToSubscriptionRequest) Valid() error
type AddFeedSubscriptionRequest ¶
type AddFeedSubscriptionRequest struct {
// URL is a URL.
URL URL `form:"url" json:"url" validate:"omitempty,url"`
// FeedID is the unique ID of a feed.
FeedID FeedID `form:"feed_id" json:"feed_id" validate:"required,startswith=feed_"`
}
AddFeedSubscriptionRequest contains request data for adding a new feed subscription.
func (*AddFeedSubscriptionRequest) Sanitise ¶
func (f *AddFeedSubscriptionRequest) Sanitise() error
func (*AddFeedSubscriptionRequest) Valid ¶
func (f *AddFeedSubscriptionRequest) Valid() error
type AddFeedsetRequest ¶
type AddFeedsetRequest struct {
Feedset []string `form:"feedset,unique" json:"feedset,omitempty"`
}
AddFeedsetRequest is a request from a user to add one or more feed sets as subscriptions.
func (*AddFeedsetRequest) Sanitise ¶
func (r *AddFeedsetRequest) Sanitise() error
Sanitise will sanitise the input values of the SubscriptionRequest.
func (*AddFeedsetRequest) Valid ¶
func (r *AddFeedsetRequest) Valid() error
Valid returns a boolean indicating whether the SubscriptionRequest is valid, and any validation errors if applicable.
type AddSubscriptionResult ¶
type AddSubscriptionResult struct {
Subscription *FeedSubscription
Message *UserMessage
}
AddSubscriptionResult represents the result of creating a new subscription.
type AddSubscriptionSearchFilterRequest ¶
type AddSubscriptionSearchFilterRequest struct {
// InputName is the name of the input in the form into which this filter should be added.
InputName string `form:"subscriptions-input-name" json:"input_name"`
// SubscriptionID is the unique ID of a subscription.
SubscriptionID SubscriptionID `form:"subscription_id" json:"subscription_id" validate:"required,startswith=sub_"`
// SubscriptionName is the nickname of the subscription.
SubscriptionName string `form:"subscription_name" json:"subscription_name"`
}
AddSubscriptionSearchFilterRequest contains the data for adding a new subscription filter to a search request.
func (*AddSubscriptionSearchFilterRequest) Sanitise ¶
func (r *AddSubscriptionSearchFilterRequest) Sanitise() error
Sanitise will sanitise the add subscription search filter request.
func (*AddSubscriptionSearchFilterRequest) Valid ¶
func (r *AddSubscriptionSearchFilterRequest) Valid() error
Valid returns a boolean indicating whether the add subscription search filter data is valid.
type AddSubscriptionToGroupRequest ¶ added in v0.82.4
type AddSubscriptionToGroupRequest struct {
// ExistingSubscriptions is the existing subscriptions in the group.
ExistingSubscriptions map[SubscriptionID]string `form:"subscriptions" json:"existing_subscriptions,omitempty"`
// SuggestionText is the name of the new subscription to add.
SuggestionText string `form:"suggestion_text" json:"suggestion_text" validate:"required"`
// Suggestions is the subscription suggestions.
Suggestions map[SubscriptionID]string `form:"suggestions" json:"suggestions"`
}
AddSubscriptionToGroupRequest is a request to add a new subscription to a group subscription.
func (*AddSubscriptionToGroupRequest) Sanitise ¶ added in v0.82.4
func (r *AddSubscriptionToGroupRequest) Sanitise() error
func (*AddSubscriptionToGroupRequest) Valid ¶ added in v0.82.4
func (r *AddSubscriptionToGroupRequest) Valid() error
type AddSubscriptionToSearchRequest ¶ added in v0.82.4
type AddSubscriptionToSearchRequest struct {
// SelectedSubscription is the name of the subscription that was selected from the suggestions.
SelectedSubscription string `form:"subscription-suggestion-text" json:"selected_subscription"`
// SuggestedSubscriptions is a list of the subscription suggestions.
SuggestedSubscriptions map[SubscriptionID]string `form:"subscription_suggestions" json:"suggested_subscriptions,omitempty"`
}
AddSubscriptionToSearchRequest is a request to add a new subscription to a search subscription.
func (*AddSubscriptionToSearchRequest) Sanitise ¶ added in v0.82.4
func (r *AddSubscriptionToSearchRequest) Sanitise() error
func (*AddSubscriptionToSearchRequest) Valid ¶ added in v0.82.4
func (r *AddSubscriptionToSearchRequest) Valid() error
type AndroidCheckout ¶ added in v0.162.0
type AndroidCheckout struct {
// SKU is the plan SKU.
SKU string `json:"sku" validate:"required"`
}
AndroidCheckout contains data for checking out a Android subscription.
type AndroidSubscription ¶ added in v0.157.0
type AndroidSubscription struct {
// ExpiresAt is the timestamp when the subscription expires.
ExpiresAt *time.Time `json:"expires_at,omitempty"`
// GrantedAt is the timestamp when the subscription was granted.
GrantedAt time.Time `json:"granted_at" validate:"required"`
// PurchaseToken is a token that validates the subscription purchase.
PurchaseToken string `json:"purchase_token" validate:"required"`
// SKU is the subscription SKU.
SKU string `json:"sku" validate:"required"`
}
AndroidSubscription contains details about a user's paid Android subscription
type Article ¶
type Article struct {
// Content contains the full article content, when it has been fetched from the origin link.
Content *string `json:"content,omitempty"`
// Favorite indicates whether this subscription has been marked as a Favorite by the user.
Favorite bool `json:"-"`
// Item represents an individual item (e.g., an individual feed item).
Item Item `json:"item"`
// MarkArticleReadOnView indicates whether to automatically mark an article as read when viewed.
MarkArticleReadOnView bool `json:"mark_article_read_on_view"`
// ShowFullContent indicates whether the full article content should be fetched and displayed instead of any content from the feed item itself.
ShowFullContent bool `json:"show_full_content"`
// SourceType indicates what type of source the object came from.
SourceType SourceType `json:"source_type"`
// State tracks the state of an article.
State ArticleState `json:"state"`
// SubscriptionID is the unique ID of a subscription.
SubscriptionID SubscriptionID `form:"subscription_id" json:"subscription_id" validate:"required,startswith=sub_"`
}
Article defines model for Article.
func (*Article) AsYoutubeVideo ¶ added in v0.148.0
func (a *Article) AsYoutubeVideo() (*ItemExtensionYoutube, error)
func (*Article) GetAuthors ¶
GetAuthors returns a slice of authors (if any) of the article.
func (*Article) GetCategories ¶
func (a *Article) GetCategories(num int) Categories
GetCategories returns the categories of the article (if any).
func (*Article) GetContent ¶
GetContent returns the main content of the article. This will be either the full content fetched remotely (if requested), the "content" field of the item (if not empty), or the description (if any).
func (*Article) GetDescription ¶
GetDescription returns the description of the article.
func (*Article) GetFeedTitle ¶
GetFeedTitle returns the title of the feed the article belongs to.
func (*Article) GetImage ¶
func (a *Article) GetImage() *RemoteImage
GetImage returns the image associated with the article.
func (*Article) GetObjectType ¶
func (a *Article) GetObjectType() ObjectType
GetObjectType returns the type of the object, in this case, "article".
func (*Article) GetSubscriptionID ¶
func (a *Article) GetSubscriptionID() SubscriptionID
GetSubscriptionID returns the ID of the user subscription the article belongs to.
func (*Article) GetUpdatedDate ¶
GetUpdatedDate returns the timestamp when the article was last updated (or created if no updates).
func (*Article) IsFavorite ¶
IsFavorite returns a boolean indicating whether the article has been favorited.
func (*Article) IsRemoteContent ¶
IsRemoteContent returns a boolean indicating whether the full content of the article should be shown.
func (*Article) IsUnread ¶
IsUnread returns a boolean indicating whether the user has not read this article.
func (*Article) IsYoutubeVideo ¶ added in v0.148.0
type ArticleArchive ¶
type ArticleArchive struct {
// Timestamp is when the document was created.
Timestamp Timestamp `json:"@timestamp" validate:"required"`
// Authors is a list of people (names, nicknames and/or emails) who "authored" the object content.
Authors []string `json:"authors,omitempty"`
// Categories is a list of categories that define a taxonomy for the feed or item.
Categories []Category `json:"categories,omitempty" validate:"omitempty,unique"`
// Content contains the item content.
Content *string `json:"content,omitempty"`
// Contributors is a list of people (names, nicknames and/or emails) who "contributed" the object content.
Contributors []string `json:"contributors,omitempty"`
// Copyright is a copyright notice for the content.
Copyright *string `json:"copyright,omitempty"`
// Description is a short summary or description of the feed or item.
Description *string `json:"description,omitempty"`
// ExtensionData contains the embedded extension data.
ExtensionData *ArticleArchive_ExtensionData `json:"extension_data,omitempty"`
// ExtensionType is the type of extension for this item.
ExtensionType *ArticleArchiveExtensionType `json:"extension_type,omitempty"`
// FeedID is the unique ID of a feed.
FeedID FeedID `form:"feed_id" json:"feed_id" validate:"required,startswith=feed_"`
// FeedTitle is the title of the feed to which this item belongs.
FeedTitle string `json:"feed_title" validate:"required"`
// Image contains details about a remote image.
Image *RemoteImage `json:"image,omitempty"`
// ItemID is the unique ID of an item.
ItemID ItemID `form:"item_id" json:"item_id" validate:"required,startswith=item_"`
// Language is the language the content is written in.
Language *string `json:"language,omitempty"`
// Published is the datetime at which the feed or item was published.
Published time.Time `json:"published"`
// SourceType indicates what type of source the object came from.
SourceType SourceType `json:"source_type"`
// SubscriptionID is the unique ID of a subscription.
SubscriptionID SubscriptionID `form:"subscription_id" json:"subscription_id" validate:"required,startswith=sub_"`
// Title is the title of the feed or item.
Title string `json:"title"`
// Updated is the datetime at which the feed or item was updated.
Updated *time.Time `json:"updated,omitempty"`
// URL is the URL to the webpage for the feed or item. For a feed, this is most likely the webpage the feed is sourced from. For an item, this is most likely the webpage containing the full item contents.
URL string `json:"url,omitempty" validate:"omitempty,url"`
// UserID is the unique ID of a user.
UserID UserID `form:"user_id" json:"user_id" validate:"required,startswith=user_"`
}
ArticleArchive defines model for ArticleArchive.
func NewArchivedArticle ¶
func NewArchivedArticle(userID UserID, subscriptionID SubscriptionID, item *Item) (*ArticleArchive, error)
NewArchivedArticle creates a new archived article for long-term storage.
type ArticleArchiveExtensionType ¶ added in v0.61.0
type ArticleArchiveExtensionType string
ArticleArchiveExtensionType is the type of extension for this item.
const (
ArticleArchiveExtensionTypeYoutube ArticleArchiveExtensionType = "youtube"
)
Defines values for ArticleArchiveExtensionType.
func (ArticleArchiveExtensionType) Valid ¶ added in v0.79.0
func (e ArticleArchiveExtensionType) Valid() bool
Valid indicates whether the value is a known member of the ArticleArchiveExtensionType enum.
type ArticleArchive_ExtensionData ¶ added in v0.61.0
type ArticleArchive_ExtensionData struct {
// contains filtered or unexported fields
}
ArticleArchive_ExtensionData contains the embedded extension data.
func (ArticleArchive_ExtensionData) AsItemExtensionYoutube ¶ added in v0.61.0
func (t ArticleArchive_ExtensionData) AsItemExtensionYoutube() (ItemExtensionYoutube, error)
AsItemExtensionYoutube returns the union data inside the ArticleArchive_ExtensionData as a ItemExtensionYoutube
func (*ArticleArchive_ExtensionData) FromItemExtensionYoutube ¶ added in v0.61.0
func (t *ArticleArchive_ExtensionData) FromItemExtensionYoutube(v ItemExtensionYoutube) error
FromItemExtensionYoutube overwrites any union data inside the ArticleArchive_ExtensionData as the provided ItemExtensionYoutube
func (ArticleArchive_ExtensionData) MarshalJSON ¶ added in v0.61.0
func (t ArticleArchive_ExtensionData) MarshalJSON() ([]byte, error)
func (*ArticleArchive_ExtensionData) MergeItemExtensionYoutube ¶ added in v0.61.0
func (t *ArticleArchive_ExtensionData) MergeItemExtensionYoutube(v ItemExtensionYoutube) error
MergeItemExtensionYoutube performs a merge with any union data inside the ArticleArchive_ExtensionData, using the provided ItemExtensionYoutube
func (*ArticleArchive_ExtensionData) UnmarshalJSON ¶ added in v0.61.0
func (t *ArticleArchive_ExtensionData) UnmarshalJSON(b []byte) error
type ArticleMetadata ¶
type ArticleMetadata struct {
// SourceType indicates what type of source the object came from.
SourceType SourceType `json:"source_type"`
// State tracks the state of an article.
State ArticleState `json:"state"`
// SubscriptionID is the unique ID of a subscription.
SubscriptionID SubscriptionID `form:"subscription_id" json:"subscription_id" validate:"required,startswith=sub_"`
}
ArticleMetadata contains the stored data that represents an article.
type ArticleSettings ¶
type ArticleSettings struct {
// MarkArticleReadOnView indicates whether to automatically mark an article as read when viewed.
MarkArticleReadOnView bool `json:"mark_article_read_on_view"`
// ShowFullContent indicates whether the full article content should be fetched and displayed instead of any content from the feed item itself.
ShowFullContent bool `json:"show_full_content"`
}
ArticleSettings contains settings related to the display of the article.
type ArticleState ¶
type ArticleState struct {
// Read indicates whether the object has been read (true) or is unread (false).
Read bool `json:"read"`
// UpdatedAt records when the object was last updated in the database.
UpdatedAt UpdatedAt `json:"updated_at,omitempty" validate:"omitnil"`
}
ArticleState tracks the state of an article.
func (*ArticleState) MarkRead ¶
func (s *ArticleState) MarkRead(markedAt time.Time)
MarkRead will set the article state to read.
func (*ArticleState) MarkUnread ¶
func (s *ArticleState) MarkUnread(markedAt time.Time)
MarkUnread will set the article state to unread.
type Articles ¶
type Articles []*Article
Articles is a slices of Article objects.
func (Articles) FilterByView ¶ added in v0.26.0
FilterByView returns a slice containing the subscription which match the given view state.
func (Articles) GetCategoryCounts ¶
func (a Articles) GetCategoryCounts() CategoryCounts
GetCategoryCounts returns a count of the occurrence of a Category across all the Articles in the slice.
func (Articles) GetFeedIDs ¶
GetFeedIDs retrieves the feed ids for all articles in the slice.
func (Articles) GetSubscriptionIDs ¶
func (a Articles) GetSubscriptionIDs() []SubscriptionID
GetSubscriptionIDs retrieves the subscription ids for all articles in the slice.
type Author ¶ added in v0.101.0
type Author struct {
// Email is an email address.
Email *string `json:"email,omitempty" validate:"omitempty,email"`
// Name is the name of the person. Can be any combination of first name and last name, in any order.
Name string `json:"name"`
// URL is a URL.
URL *URL `form:"url" json:"url" validate:"omitempty,url"`
}
Author represents a person who contributed to a feed or item.
type Categories ¶
type Categories []Category
Categories is a slice of categories.
func (Categories) HasCategory ¶
func (c Categories) HasCategory(category Category) bool
HasCategory is a convienience function to check if the given category is in the slice of categories.
type CategoryCount ¶
type CategoryCount struct {
// Category represents a taxonomy applied to an object.
Category Category `form:"category" json:"category"`
Count int `json:"count"`
}
CategoryCount holds a category and the count of its occurence. The count will be contextual. i.e., across subscriptions, items, etc.
type CategoryCounts ¶
type CategoryCounts []CategoryCount
CategoryCounts is a slice of Categories and their counts.
func GetCategoryCounts ¶
func GetCategoryCounts(subscriptions ...*Subscription) CategoryCounts
GetCategoryCounts returns a count of the occurrence of a Category across all the Subscriptions.
func (CategoryCounts) GetCategories ¶ added in v0.55.0
func (c CategoryCounts) GetCategories() []Category
func (CategoryCounts) Limit ¶ added in v0.55.0
func (c CategoryCounts) Limit(count int) CategoryCounts
Limit returns the n top Categories from the list of CategoryCounts.
func (CategoryCounts) Sort ¶
func (c CategoryCounts) Sort()
Sort will sort the list of CategoryCounts by the count values.
type CategoryFilters ¶ added in v0.27.0
type CategoryFilters struct {
Categories CategoryCounts `json:"categories"`
// Filters contains filters for altering the display of objects.
Filters ListFilters `json:"filters" validate:"required"`
Path string `json:"path"`
}
CategoryFilters contains categories that can be used for filtering.
type ChangePasswordRequest ¶
type ChangePasswordRequest struct {
// ConfirmNewPassword is the new password (again), used for confirmation.
ConfirmNewPassword *string `form:"confirm_new_password" json:"confirm_new_password,omitempty" validate:"required"`
// NewPassword is the new password.
NewPassword string `form:"new_password" json:"new_password" validate:"required,eqfield=ConfirmNewPassword"`
}
ChangePasswordRequest contains details for changing a user password.
func (*ChangePasswordRequest) Sanitise ¶
func (r *ChangePasswordRequest) Sanitise() error
Sanitise will sanitise the user input for a ChangePasswordRequest.
func (*ChangePasswordRequest) Valid ¶
func (r *ChangePasswordRequest) Valid() error
Valid returns a boolean indicating whether the ChangePasswordRequest contains valid data.
type CheckoutRequest ¶ added in v0.162.0
type CheckoutRequest struct {
SubscriptionData CheckoutRequest_SubscriptionData `json:"subscription_data"`
// UserSubscriptionType is the type of subscription the user has purchased.
UserSubscriptionType UserSubscriptionType `json:"subscription_type" validate:"omitempty,oneof=paddle android"`
}
CheckoutRequest contains data for a subscription checkout.
type CheckoutRequest_SubscriptionData ¶ added in v0.162.0
type CheckoutRequest_SubscriptionData struct {
// contains filtered or unexported fields
}
CheckoutRequest_SubscriptionData defines model for CheckoutRequest.SubscriptionData.
func (CheckoutRequest_SubscriptionData) AsAndroidCheckout ¶ added in v0.162.0
func (t CheckoutRequest_SubscriptionData) AsAndroidCheckout() (AndroidCheckout, error)
AsAndroidCheckout returns the union data inside the CheckoutRequest_SubscriptionData as a AndroidCheckout
func (CheckoutRequest_SubscriptionData) AsPaddleCheckout ¶ added in v0.162.0
func (t CheckoutRequest_SubscriptionData) AsPaddleCheckout() (PaddleCheckout, error)
AsPaddleCheckout returns the union data inside the CheckoutRequest_SubscriptionData as a PaddleCheckout
func (*CheckoutRequest_SubscriptionData) FromAndroidCheckout ¶ added in v0.162.0
func (t *CheckoutRequest_SubscriptionData) FromAndroidCheckout(v AndroidCheckout) error
FromAndroidCheckout overwrites any union data inside the CheckoutRequest_SubscriptionData as the provided AndroidCheckout
func (*CheckoutRequest_SubscriptionData) FromPaddleCheckout ¶ added in v0.162.0
func (t *CheckoutRequest_SubscriptionData) FromPaddleCheckout(v PaddleCheckout) error
FromPaddleCheckout overwrites any union data inside the CheckoutRequest_SubscriptionData as the provided PaddleCheckout
func (CheckoutRequest_SubscriptionData) MarshalJSON ¶ added in v0.162.0
func (t CheckoutRequest_SubscriptionData) MarshalJSON() ([]byte, error)
func (*CheckoutRequest_SubscriptionData) MergeAndroidCheckout ¶ added in v0.162.0
func (t *CheckoutRequest_SubscriptionData) MergeAndroidCheckout(v AndroidCheckout) error
MergeAndroidCheckout performs a merge with any union data inside the CheckoutRequest_SubscriptionData, using the provided AndroidCheckout
func (*CheckoutRequest_SubscriptionData) MergePaddleCheckout ¶ added in v0.162.0
func (t *CheckoutRequest_SubscriptionData) MergePaddleCheckout(v PaddleCheckout) error
MergePaddleCheckout performs a merge with any union data inside the CheckoutRequest_SubscriptionData, using the provided PaddleCheckout
func (*CheckoutRequest_SubscriptionData) UnmarshalJSON ¶ added in v0.162.0
func (t *CheckoutRequest_SubscriptionData) UnmarshalJSON(b []byte) error
type ClientType ¶ added in v0.162.0
type ClientType string
ClientType represents which type of client is accessing the app.
const ( ClientTypePwa ClientType = "pwa" ClientTypeTwa ClientType = "twa" ClientTypeWeb ClientType = "web" )
Defines values for ClientType.
func ClientTypeFromCtx ¶ added in v0.162.0
func ClientTypeFromCtx(ctx context.Context) ClientType
ClientTypeFromCtx retrieves the ClientType from the context, if any.
func (ClientType) Valid ¶ added in v0.162.0
func (e ClientType) Valid() bool
Valid indicates whether the value is a known member of the ClientType enum.
type ContactRequest ¶ added in v0.129.0
type ContactRequest struct {
// ContactEmail is the email address the entered for getting in touch about the issue.
ContactEmail string `form:"contact_email" json:"contact_email" validate:"required,email"`
// Details is the text about the issue.
Details string `form:"details" json:"details" validate:"required"`
}
ContactRequest contains details submitted via the contact form on the website.
func (*ContactRequest) Sanitise ¶ added in v0.129.0
func (r *ContactRequest) Sanitise() error
func (*ContactRequest) Valid ¶ added in v0.129.0
func (r *ContactRequest) Valid() error
type EditEmailSubscriptionRequest ¶ added in v0.26.0
type EditEmailSubscriptionRequest struct {
Customisation *SubscriptionCustomisation `form:"customisation" json:"customisation,omitempty"`
Settings *SubscriptionSettings `form:"settings" json:"settings,omitempty"`
// SubscriptionID is the unique ID of a subscription.
SubscriptionID SubscriptionID `form:"subscription_id" json:"subscription_id" validate:"required,startswith=sub_"`
// SuggestedCategories is a list of suggested categories for the subscription.
SuggestedCategories []Category `form:"-" json:"-"`
}
EditEmailSubscriptionRequest represents a request to create an email subscription.
func (*EditEmailSubscriptionRequest) Sanitise ¶ added in v0.26.0
func (r *EditEmailSubscriptionRequest) Sanitise() error
Sanitise will sanitise the input values of the SubscriptionRequest.
func (*EditEmailSubscriptionRequest) Valid ¶ added in v0.26.0
func (r *EditEmailSubscriptionRequest) Valid() error
Valid returns a boolean indicating whether the SubscriptionRequest is valid, and any validation errors if applicable.
type EditUserRequest ¶
type EditUserRequest = UserCustomisation
EditUserRequest contains account fields that a user can customize.
func (*EditUserRequest) Sanitise ¶
func (s *EditUserRequest) Sanitise() error
Sanitise will sanitise the user input for a SubscriptionCustomisation.
func (*EditUserRequest) Valid ¶
func (s *EditUserRequest) Valid() error
Valid returns a boolean indicating if the Subscription contains valid data (true). If it contains invalid data (false) a non-nil error is also returned which contains validation issues.
type ElementID ¶ added in v0.35.0
type ElementID string
ID represents an id attribute in a HTML element.
type EmailSenderID ¶ added in v0.25.0
type EmailSenderID = string
EmailSenderID is an email address that sends emails.
type EmailSubscription ¶ added in v0.25.0
type EmailSubscription struct {
// ArticleFilters holds filters to apply to the articles within a subscription.
ArticleFilters *SubscriptionArticleFilters `form:"article_filters" json:"article_filters"`
// ArticleStates contains the states of items marked explicitly as read/unread/saved by the user.
ArticleStates map[ItemID]ArticleState `json:"article_states" validate:"required"`
// EmailSenderID is an email address that sends emails.
EmailSenderID EmailSenderID `form:"email_sender_id" json:"email_sender_id" validate:"required,email"`
// FeedID is the unique ID of a feed.
FeedID FeedID `form:"feed_id" json:"feed_id" validate:"required,startswith=feed_"`
}
EmailSubscription is a subscription to an email newsletter source.
func (*EmailSubscription) Valid ¶ added in v0.25.0
func (s *EmailSubscription) Valid() error
Valid returns a non-nil error if the EmailSubscription contains invalid data.
type EmailTemplateID ¶ added in v0.145.0
type EmailTemplateID = string
EmailTemplateID is the ID of an email template.
type ErrorOption ¶ added in v0.120.0
type ErrorOption func(*APIError)
func WithUserErrorDescription ¶ added in v0.120.0
func WithUserErrorDescription(msg string) ErrorOption
func WithUserErrorSummary ¶ added in v0.120.0
func WithUserErrorSummary(msg string) ErrorOption
type FavoriteArticleRequest ¶ added in v0.31.0
type FavoriteArticleRequest struct {
// ItemID is the unique ID of an item.
ItemID ItemID `form:"item_id" json:"item_id" validate:"required,startswith=item_"`
// SubscriptionID is the unique ID of a subscription.
SubscriptionID SubscriptionID `form:"subscription_id" json:"subscription_id" validate:"required,startswith=sub_"`
}
FavoriteArticleRequest contains parameters for favoriting an article.
func (*FavoriteArticleRequest) Sanitise ¶ added in v0.31.0
func (r *FavoriteArticleRequest) Sanitise() error
func (*FavoriteArticleRequest) Valid ¶ added in v0.31.0
func (r *FavoriteArticleRequest) Valid() error
type FavoriteSubscriptionRequest ¶ added in v0.31.0
type FavoriteSubscriptionRequest struct {
// SubscriptionID is the unique ID of a subscription.
SubscriptionID SubscriptionID `form:"subscription_id" json:"subscription_id" validate:"required,startswith=sub_"`
}
FavoriteSubscriptionRequest contains parameters for favoriting a subscription.
func (*FavoriteSubscriptionRequest) Sanitise ¶ added in v0.31.0
func (s *FavoriteSubscriptionRequest) Sanitise() error
Sanitise will sanitise the FavoriteSubscriptionsRequest, ensuring it contains valid field values.
func (*FavoriteSubscriptionRequest) Valid ¶ added in v0.31.0
func (s *FavoriteSubscriptionRequest) Valid() error
Valid checks that the FavoriteSubscriptionsRequest contains valid data.
type Feed ¶
type Feed struct {
// Authors is a list of people (names, nicknames and/or emails) who "authored" the object content.
Authors []string `json:"authors,omitempty"`
// Categories is a list of categories that define a taxonomy for the feed or item.
Categories []Category `json:"categories,omitempty" validate:"omitempty,unique"`
// Contributors is a list of people (names, nicknames and/or emails) who "contributed" the object content.
Contributors []string `json:"contributors,omitempty"`
// Copyright is a copyright notice for the content.
Copyright *string `json:"copyright,omitempty"`
// CreatedAt records when the object was created in the database.
CreatedAt CreatedAt `json:"created_at" validate:"required"`
// Description is a short summary or description of the feed or item.
Description *string `json:"description,omitempty"`
// Domain is the domain name for the feed link
Domain string `json:"domain" validate:"required,fqdn"`
// FeedID is the unique ID of a feed.
FeedID FeedID `form:"feed_id" json:"feed_id" validate:"required,startswith=feed_"`
// FetchMethod defines how this feed should be fetched.
FetchMethod FeedFetchMethod `json:"fetch_method" validate:"required,oneof=direct proxied zyte-products zyte-articles"`
// Image contains details about a remote image.
Image *RemoteImage `json:"image,omitempty"`
// Items contains the list of items in the feed.
Items []*Item `json:"-"`
// Language is the language the content is written in.
Language *string `json:"language,omitempty"`
// LastFetched indicates when an object was last fetched.
LastFetched LastFetched `json:"last_fetched,omitempty"`
// Published is the datetime at which the feed or item was published.
Published time.Time `json:"published"`
// Quirks contains data on quirks for a feed.
Quirks *FeedQuirks `json:"quirks,omitempty"`
// SourceType indicates what type of source the object came from.
SourceType SourceType `json:"source_type"`
// SourceURLs is a list of URLs that point to the feed source. These might be either the website corresponding to the feed or the
SourceURLs []URL `json:"source_urls" validate:"required,dive,url"`
// Title is the title of the feed or item.
Title string `json:"title"`
// UpdateInterval indicates how often the feed is updated. Where a feed does not supply an actual update interval, this value will be derived from the median update interval between published items.
UpdateInterval int64 `json:"update_interval"`
// Updated is the datetime at which the feed or item was updated.
Updated *time.Time `json:"updated,omitempty"`
// URL is the URL to the webpage for the feed or item. For a feed, this is most likely the webpage the feed is sourced from. For an item, this is most likely the webpage containing the full item contents.
URL string `json:"url,omitempty" validate:"omitempty,url"`
}
Feed defines model for Feed.
func NewFeed ¶ added in v0.176.0
NewFeed converts a feed source from the go-syndication library into a models.Feed object.
func (*Feed) GetAuthors ¶
GetAuthors returns the feed authors, if any.
func (*Feed) GetCategories ¶
GetCategories returns the slice of categories assigned to the feed, if any.
func (*Feed) GetContributors ¶
GetContributors returns the feed contributors, if any.
func (*Feed) GetDescription ¶
GetDescription returns the feed description, if any.
func (*Feed) GetImage ¶
func (f *Feed) GetImage() *RemoteImage
GetImage returns an image object that can visually represent the feed.
func (*Feed) GetLanguage ¶
GetLanguage returns the language tag of the feed, if any.
func (*Feed) GetLink ¶
GetLink returns the URL of the website that publishes and/or is the owner the feed.
func (*Feed) GetSourceURLs ¶
GetSourceURLs returns all discovered source URLs of the feed (i.e., URLs that point to the feed itself).
func (*Feed) GetTimestamp ¶
GetTimestamp returns a timestamp indicating when the feed was last updated. This will be either, the updated timestamp in the feed, or, the published timestamp in the feed, or the last fetched timestamp, whichever is found and is a valid value, in that order.
type FeedFetchMethod ¶ added in v0.147.0
type FeedFetchMethod string
FeedFetchMethod defines how this feed should be fetched.
const ( FeedFetchMethodDirect FeedFetchMethod = "direct" FeedFetchMethodProxied FeedFetchMethod = "proxied" FeedFetchMethodZyteArticles FeedFetchMethod = "zyte-articles" FeedFetchMethodZyteProducts FeedFetchMethod = "zyte-products" )
Defines values for FeedFetchMethod.
func (FeedFetchMethod) Valid ¶ added in v0.147.0
func (e FeedFetchMethod) Valid() bool
Valid indicates whether the value is a known member of the FeedFetchMethod enum.
type FeedQuirks ¶ added in v0.148.0
type FeedQuirks struct {
// NoImage when set to true, indicates that the feed has no discoverable image, either in its source or on the website that it represents. Setting this quirk to true will stop any logic that tries to update the feed image.
NoImage *bool `json:"no_image,omitempty"`
}
FeedQuirks contains data on quirks for a feed.
type FeedStatus ¶ added in v0.46.0
type FeedStatus struct {
// FeedID is the unique ID of a feed.
FeedID FeedID `form:"feed_id" json:"feed_id" validate:"required,startswith=feed_"`
// Items is a list of IDs of items that were added.
Items []ItemID `json:"items,omitempty"`
// StatusCode is the HTTP status code returned when fetching.
StatusCode int `json:"status_code"`
// StatusMessage is a message associated with the status code.
StatusMessage *string `json:"status_message,omitempty"`
// Timestamp is when the document was created.
Timestamp Timestamp `json:"@timestamp" validate:"required"`
// URL is a URL.
URL URL `form:"url" json:"url" validate:"omitempty,url"`
}
FeedStatus represents the status of fetching the feed.
func (*FeedStatus) GetID ¶ added in v0.46.0
func (s *FeedStatus) GetID() string
GetID retrieves (generates) a unique ID for a FeedStatus object.
type FeedSubscription ¶
type FeedSubscription struct {
// ArticleFilters holds filters to apply to the articles within a subscription.
ArticleFilters *SubscriptionArticleFilters `form:"article_filters" json:"article_filters"`
// ArticleStates contains the states of items marked explicitly as read/unread/saved by the user.
ArticleStates map[ItemID]ArticleState `json:"article_states" validate:"required"`
// FeedID is the unique ID of a feed.
FeedID FeedID `form:"feed_id" json:"feed_id" validate:"required,startswith=feed_"`
}
FeedSubscription represents a feed a user has subscribed to.
func (*FeedSubscription) GetFeedID ¶
func (s *FeedSubscription) GetFeedID() FeedID
GetFeedID returns the feed ID.
func (*FeedSubscription) Valid ¶
func (s *FeedSubscription) Valid() error
Valid returns a boolean indicating if the Subscription contains valid data (true). If it contains invalid data (false) a non-nil error is also returned which contains validation issues.
type FeedSubscriptionRequest ¶ added in v0.82.4
type FeedSubscriptionRequest struct {
// URL is the URL of the feed data. Used when adding a new feed subscription.
URL string `form:"url" json:"URL" validate:"required_without=SubscriptionID,omitempty,url"`
// ArticleFilters holds filters to apply to the articles within a subscription.
ArticleFilters *SubscriptionArticleFilters `form:"article_filters" json:"article_filters"`
// Customisation contains object fields that can be customised (overridden) by a user.
Customisation *SubscriptionCustomisation `form:"customisation" json:"customisation,omitempty"`
Settings *SubscriptionSettings `form:"settings" json:"settings,omitempty"`
// SubscriptionID is the existing subscription ID. Will be empty when adding a new feed subscription.
SubscriptionID string `form:"subscription_id" json:"subscription_id" validate:"required_without=URL,omitempty,startswith=sub_"`
// SuggestedCategories is a list of suggested categories for the subscription.
SuggestedCategories []Category `form:"-" json:"-"`
}
FeedSubscriptionRequest is a request to add a new feed subscription.
func GenerateRequestsFromOutlines ¶
func GenerateRequestsFromOutlines(outlines ...opml.Outline) []FeedSubscriptionRequest
func (*FeedSubscriptionRequest) Sanitise ¶ added in v0.82.4
func (r *FeedSubscriptionRequest) Sanitise() error
func (*FeedSubscriptionRequest) Valid ¶ added in v0.82.4
func (r *FeedSubscriptionRequest) Valid() error
type FeedSubscriptionResult ¶ added in v0.82.4
type FeedSubscriptionResult struct {
// Error represents an error returned from any API within the service/application.
Error *APIError `json:"error,omitempty"`
// Request is a request to add a new feed subscription.
Request *FeedSubscriptionRequest `json:"request,omitempty"`
// Subscription represents any kind of subscription.
Subscription *Subscription `json:"subscription,omitempty"`
}
FeedSubscriptionResult is the result of adding a feed subscription.
type FeedSuggestionsResults ¶ added in v0.133.0
type FeedSuggestionsResults struct {
// Feeds is a slice of feeds.
Feeds Feeds `json:"feeds"`
// LatestItems is a map of latest items for each suggested feed.
LatestItems map[FeedID]Items `json:"latest_items"`
// Text is the query text that generated the suggestions.
Text string `json:"text"`
}
FeedSuggestionsResults contains a list of feeds and their latest items, based on the provided text query.
type Feeds ¶
type Feeds []*Feed
Feeds is a slice of Feed objects.
func (Feeds) ExcludeIDs ¶ added in v0.128.0
ExcludeIDs returns a new slice containing the feeds which DO NOT have an id matching the given IDs.
type FileDetails ¶ added in v0.49.0
type FileDetails struct {
// File is the path in an embedded FS to the file.
File string `json:"file" toml:"file" validate:"required,filepath"`
// Path is the relative URL path from where this document should be served.
Path string `json:"path" toml:"path" validate:"required,filepath"`
}
FileDetails contains a mapping of a file in an embedded FS to the URL path it is served from.
type FileIndex ¶ added in v0.49.0
type FileIndex struct {
// Files is a list of details for files.
Files []FileDetails `json:"files,omitempty" toml:"file"`
// UpdatedAt indicates when the index was last updated.
UpdatedAt *time.Time `json:"updated_at,omitempty" toml:"updated_at"`
}
FileIndex contains a listing of files in a directory of an embedded FS.
type FileUpload ¶
type FileUpload struct {
// Data is the file data/content.
Data multipart.File `json:"data" validate:"required"`
// Header is the mime header information of the file.
Header *multipart.FileHeader `json:"header" validate:"required"`
}
FileUpload represents a file upload by a user.
func (*FileUpload) ParseMimetype ¶
func (f *FileUpload) ParseMimetype() (string, error)
ParseMimetype attempts to parse and return the mimetype of the file from its mime header.
func (*FileUpload) Valid ¶
func (f *FileUpload) Valid() error
Valid will return a non-nill error containing details of any validation issues with the file upload data. Otherwise, a nil error is returned if the data is valid.
type Filters ¶
type Filters interface {
Valid() error
GetSort() Sort
GetCount() int
GetView() View
GetCategories() Categories
Values() map[string]any
QueryString() string
}
Filters represents either Subscription or Article filters.
type GetSubscriptionsSuggestionRequest ¶
type GetSubscriptionsSuggestionRequest struct {
// IgnoredSubscriptions is a list of subscription IDs to ignore for suggestions.
IgnoredSubscriptions []SubscriptionID `form:"subscription_id" json:"ignored_subscriptions,omitempty"`
// Text is a string that should match a subscription.
Text string `form:"subscription-suggestion-text" json:"text"`
}
GetSubscriptionsSuggestionRequest contains the data for finding matching subscriptions as suggestion results.
func (*GetSubscriptionsSuggestionRequest) Sanitise ¶
func (r *GetSubscriptionsSuggestionRequest) Sanitise() error
func (*GetSubscriptionsSuggestionRequest) Valid ¶
func (r *GetSubscriptionsSuggestionRequest) Valid() error
type GroupSubscription ¶
type GroupSubscription struct {
// ArticleFilters holds filters to apply to the articles within a subscription.
ArticleFilters *SubscriptionArticleFilters `form:"article_filters" json:"article_filters"`
// Subscriptions is the list of subscription IDs belonging to the group.
Subscriptions []SubscriptionID `form:"subscriptions" json:"subscriptions" validate:"required,dive,startswith=sub_"`
}
GroupSubscription represents a subscription that combines other subscriptions.
func (*GroupSubscription) Valid ¶
func (s *GroupSubscription) Valid() error
Valid returns a boolean indicating if the Subscription contains valid data (true). If it contains invalid data (false) a non-nil error is also returned which contains validation issues.
type GroupSubscriptionRequest ¶
type GroupSubscriptionRequest struct {
// ArticleFilters holds filters to apply to the articles within a subscription.
ArticleFilters *SubscriptionArticleFilters `form:"article_filters" json:"article_filters"`
Customisation *SubscriptionCustomisation `form:"customisation" json:"customisation,omitempty"`
Settings *SubscriptionSettings `form:"settings" json:"settings,omitempty"`
// SubscriptionID will be a subscription ID if the user is editing an existing group subscription.
SubscriptionID *SubscriptionID `form:"subscription_id" json:"-" validate:"omitempty,startswith=sub_"`
// Subscriptions contains details of the subscriptions in the group.
Subscriptions map[SubscriptionID]string `form:"subscriptions" json:"subscriptions" validate:"required"`
// SuggestedCategories is a list of suggested categories for the subscription.
SuggestedCategories []Category `form:"-" json:"-"`
// SuggestedSubscriptions is a list of suggested subscriptions for the subscription.
SuggestedSubscriptions Subscriptions `form:"-" json:"-"`
}
GroupSubscriptionRequest represents a request to create a group subscription.
func NewGroupSubscriptionRequest ¶ added in v0.54.0
func NewGroupSubscriptionRequest( suggestedSubscriptions Subscriptions, suggestedCategories []Category, ) *GroupSubscriptionRequest
func (*GroupSubscriptionRequest) Sanitise ¶
func (r *GroupSubscriptionRequest) Sanitise() error
func (*GroupSubscriptionRequest) Valid ¶
func (r *GroupSubscriptionRequest) Valid() error
type GroupSubscriptionSuggestionRequest ¶ added in v0.54.0
type GroupSubscriptionSuggestionRequest struct {
// IgnoredSubscriptions contains subscriptions that can be ignored and not suggested.
IgnoredSubscriptions map[SubscriptionID]string `form:"subscriptions" json:"ignored_subscriptions,omitempty"`
// Text is the text of a subscription to match for a suggestion.
Text string `form:"text" json:"text"`
}
GroupSubscriptionSuggestionRequest contains details for suggesting a subscription to add to a group.
func (*GroupSubscriptionSuggestionRequest) Sanitise ¶ added in v0.54.0
func (r *GroupSubscriptionSuggestionRequest) Sanitise() error
func (*GroupSubscriptionSuggestionRequest) Valid ¶ added in v0.54.0
func (r *GroupSubscriptionSuggestionRequest) Valid() error
type Item ¶
type Item struct {
// Timestamp is when the document was created.
Timestamp Timestamp `json:"@timestamp" validate:"required"`
// Authors is a list of people (names, nicknames and/or emails) who "authored" the object content.
Authors []string `json:"authors,omitempty"`
// Categories is a list of categories that define a taxonomy for the feed or item.
Categories []Category `json:"categories,omitempty" validate:"omitempty,unique"`
// Content contains the item content.
Content *string `json:"content,omitempty"`
// Contributors is a list of people (names, nicknames and/or emails) who "contributed" the object content.
Contributors []string `json:"contributors,omitempty"`
// Copyright is a copyright notice for the content.
Copyright *string `json:"copyright,omitempty"`
// Description is a short summary or description of the feed or item.
Description *string `json:"description,omitempty"`
// ExtensionData contains the embedded extension data.
ExtensionData *Item_ExtensionData `json:"extension_data,omitempty"`
// ExtensionType is the type of extension for this item.
ExtensionType *ItemExtensionType `json:"extension_type,omitempty"`
// FeedID is the unique ID of a feed.
FeedID FeedID `form:"feed_id" json:"feed_id" validate:"required,startswith=feed_"`
// FeedTitle is the title of the feed to which this item belongs.
FeedTitle string `json:"feed_title" validate:"required"`
// Image contains details about a remote image.
Image *RemoteImage `json:"image,omitempty"`
// ItemID is the unique ID of an item.
ItemID ItemID `form:"item_id" json:"item_id" validate:"required,startswith=item_"`
// Language is the language the content is written in.
Language *string `json:"language,omitempty"`
// Published is the datetime at which the feed or item was published.
Published time.Time `json:"published"`
// SourceType indicates what type of source the object came from.
SourceType SourceType `json:"source_type"`
// Title is the title of the feed or item.
Title string `json:"title"`
// Updated is the datetime at which the feed or item was updated.
Updated *time.Time `json:"updated,omitempty"`
// URL is the URL to the webpage for the feed or item. For a feed, this is most likely the webpage the feed is sourced from. For an item, this is most likely the webpage containing the full item contents.
URL string `json:"url,omitempty" validate:"omitempty,url"`
}
Item defines model for Item.
func NewEmailItem ¶ added in v0.25.0
func NewEmailItem(email Email, subscription *Subscription) *Item
NewEmailItem generates a new Item from an email.
func NewFeedItem ¶ added in v0.25.0
NewFeedItem generates an Item from the underlying feed data.
func (*Item) GetAuthors ¶
GetAuthors returns a slice of the item's authors, if any.
func (*Item) GetCategories ¶
GetCategories returns a slice of the item's categories, if any.
func (*Item) GetContent ¶
GetContent returns the full item content, if set.
func (*Item) GetContributors ¶
GetContributors returns a slice of the item's contributors, if any.
func (*Item) GetDescription ¶
GetDescription returns the summary of the item content, if any.
func (*Item) GetImage ¶
func (i *Item) GetImage() *RemoteImage
GetImage returns an image that can represent the item, if any.
func (*Item) GetLanguage ¶
GetLanguage returns the language of the item, if set.
func (*Item) GetLink ¶
GetLink returns the URL that should point to a page containing the full item content.
func (*Item) GetTimestamp ¶
GetTimestamp returns a timestamp indicating when the item was last updated. This will be either, the published timestamp, or, the updated timestamp, or the indexing timestamp, whichever is found and is a valid value, in that order.
func (*Item) HasContent ¶ added in v0.104.0
HasContent returns a boolean indicating whether the item has full or partial content.
func (*Item) IsNewer ¶
IsNewer returns a boolean indicating whether this item has been updated or published after the given time and before now (to ignore potentially incorrect dates in the future).
func (*Item) WasUpdated ¶ added in v0.104.0
WasUpdated returns a boolean indicating whether the item has been updated since being published.
type ItemExtensionType ¶ added in v0.61.0
type ItemExtensionType string
ItemExtensionType is the type of extension for this item.
const (
ItemExtensionTypeYoutube ItemExtensionType = "youtube"
)
Defines values for ItemExtensionType.
func (ItemExtensionType) Valid ¶ added in v0.79.0
func (e ItemExtensionType) Valid() bool
Valid indicates whether the value is a known member of the ItemExtensionType enum.
type ItemExtensionYoutube ¶ added in v0.61.0
type ItemExtensionYoutube struct {
// Duration is the length of the video.
Duration *time.Duration `json:"duration,omitempty"`
// Height is the video height.
Height *int `json:"height,omitempty"`
// Statistics contains statistics about a Youtube video.
Statistics *YoutubeVideoStatistics `json:"statistics,omitempty"`
// VideoId is the Youtube video ID for the video.
VideoId string `json:"video_id"`
// Width is the video width.
Width *int `json:"width,omitempty"`
}
ItemExtensionYoutube is an item extension for Youtube videos.
type ItemSource ¶ added in v0.27.0
type Item_ExtensionData ¶ added in v0.61.0
type Item_ExtensionData struct {
// contains filtered or unexported fields
}
Item_ExtensionData contains the embedded extension data.
func (Item_ExtensionData) AsItemExtensionYoutube ¶ added in v0.61.0
func (t Item_ExtensionData) AsItemExtensionYoutube() (ItemExtensionYoutube, error)
AsItemExtensionYoutube returns the union data inside the Item_ExtensionData as a ItemExtensionYoutube
func (*Item_ExtensionData) FromItemExtensionYoutube ¶ added in v0.61.0
func (t *Item_ExtensionData) FromItemExtensionYoutube(v ItemExtensionYoutube) error
FromItemExtensionYoutube overwrites any union data inside the Item_ExtensionData as the provided ItemExtensionYoutube
func (Item_ExtensionData) MarshalJSON ¶ added in v0.61.0
func (t Item_ExtensionData) MarshalJSON() ([]byte, error)
func (*Item_ExtensionData) MergeItemExtensionYoutube ¶ added in v0.61.0
func (t *Item_ExtensionData) MergeItemExtensionYoutube(v ItemExtensionYoutube) error
MergeItemExtensionYoutube performs a merge with any union data inside the Item_ExtensionData, using the provided ItemExtensionYoutube
func (*Item_ExtensionData) UnmarshalJSON ¶ added in v0.61.0
func (t *Item_ExtensionData) UnmarshalJSON(b []byte) error
type Items ¶
type Items []*Item
Items is a slice of items.
func (Items) ExcludeIDs ¶ added in v0.151.0
ExcludeIDs returns a new slice containing the Items which DO NOT have an id matching the given IDs.
func (Items) FilterByFeed ¶
FilterByFeed filters items to ones which match the given feed ID.
func (Items) FilterByIDs ¶ added in v0.160.0
FilterByIDs returns a new slice containing the items which have a ItemID matching the given ids.
func (Items) FilterSince ¶
FilterSince filters items to ones which are newer than the given timestamp.
func (Items) GetCategoryCounts ¶
func (i Items) GetCategoryCounts() CategoryCounts
GetCategoryCounts returns a count of the occurrence of a Category across all the Items.
func (Items) GetFeedIDs ¶
GetFeedIDs retrieves a list of all FeedIDs from all items.
func (Items) SortByTimestamp ¶
SortByTimestamp sorts the items by their timestamps, in descending order.
type LastFetched ¶ added in v0.46.0
LastFetched indicates when an object was last fetched.
type ListArticlesResponse ¶
type ListArticlesResponse struct {
Articles Articles `json:"articles"`
// Filters contains filters for altering the display of objects.
Filters ListFilters `json:"filters" validate:"required"`
// Pagination contains data for paginating through results.
Pagination Pagination `form:"pagination" json:"pagination" validate:"omitempty,url_encoded"`
Subscription *Subscription `json:"subscription,omitempty"`
}
ListArticlesResponse contains the data retrieved and relevant for listing articles.
type ListFavoritesResponse ¶ added in v0.39.0
type ListFavoritesResponse struct {
Articles Articles `json:"articles,omitempty"`
// LatestArticles is a map of the latest articles for each subscription in the result.
LatestArticles *sync.Map `json:"latest_articles,omitempty"`
Subscriptions Subscriptions `json:"subscriptions,omitempty"`
}
ListFavoritesResponse contains the data for displaying the favorites page.
type ListFilters ¶
type ListFilters struct {
// Categories is a list of categories.
Categories []Category `form:"categories" json:"categories" validate:"omitnil,unique,dive,url_encoded"`
// Count is the count of items to retrieve with a request.
Count Count `form:"count" json:"count" validate:"gt=0,lt=20"`
// OnlyFavorites indicates whether to filter by favorites only.
OnlyFavorites bool `form:"only_favorites" json:"only_favorites" validate:"omitempty,boolean"`
// Sort is how a list of objects is sorted.
Sort Sort `form:"sort" json:"sort" validate:"required,oneof=newest_first oldest_first most_unread least_unread most_relevant"`
// Subscriptions is a list of subscription IDs.
Subscriptions []SubscriptionID `form:"subscriptions" json:"subscriptions" validate:"omitnil,dive,startswith=sub_"`
// View The state of objects to view.
View View `form:"view" json:"view" validate:"required,oneof=read unread all"`
}
ListFilters contains filters for altering the display of objects.
func NewListDisplayFilters ¶
func NewListDisplayFilters() ListFilters
NewListDisplayFilters creates a new set of display filters with sensible defaults.
func (*ListFilters) GetCategories ¶
func (f *ListFilters) GetCategories() Categories
GetCategories returns any category filters.
func (*ListFilters) GetCount ¶
func (f *ListFilters) GetCount() int
GetCount returns the count value (encoded as a string in the filters) as an int.
func (*ListFilters) GetSort ¶
func (f *ListFilters) GetSort() Sort
GetSort returns the Sort object for the Filters.
func (*ListFilters) GetSubscriptions ¶
func (f *ListFilters) GetSubscriptions() []SubscriptionID
GetSubscriptions retrieves any subscription filters.
func (*ListFilters) QueryParams ¶
func (f *ListFilters) QueryParams() url.Values
QueryParams converts the filters into query parameters.
func (*ListFilters) QueryString ¶
func (f *ListFilters) QueryString() string
QueryString converts the filters into a string that can be appended to a URL to represent the filters.
func (*ListFilters) Sanitise ¶
func (f *ListFilters) Sanitise() error
Sanitise performs sanitisation of the filter values to ensure correctness.
func (*ListFilters) Valid ¶
func (f *ListFilters) Valid() error
Valid will return a boolean indicating whether the filters are valid and a non-nil error with details if not.
func (*ListFilters) Values ¶
func (f *ListFilters) Values() map[string]any
Values converts the filters into a map[string]string object, that can be further manipulated before being (most likely) used as the value of hx-vals in a HTMX request.
type ListRequest ¶
type ListRequest struct {
// Filters contains filters for altering the display of objects.
Filters ListFilters `json:"filters" validate:"required"`
// Pagination contains data for paginating through results.
Pagination *Pagination `form:"pagination" json:"pagination,omitempty" validate:"omitempty,url_encoded"`
// Query is an additional query to apply for this request.
Query query.Option `json:"query,omitempty"`
}
ListRequest contains the parameters needed for listing subscriptions or articles.
func (*ListRequest) Valid ¶
func (r *ListRequest) Valid() error
Valid will return an error if the request object does not pass validation.
type ListSubscriptionCategoriesRequest ¶ added in v0.27.0
type ListSubscriptionCategoriesRequest struct {
// Subscriptions is a list of subscription IDs.
Subscriptions []SubscriptionID `form:"selected_subscriptions" json:"subscriptions,omitempty" validate:"omitempty,dive,startswith=sub_"`
}
ListSubscriptionCategoriesRequest contains data for listing categories for a list of subscriptions.
func (*ListSubscriptionCategoriesRequest) Sanitise ¶ added in v0.27.0
func (r *ListSubscriptionCategoriesRequest) Sanitise() error
func (*ListSubscriptionCategoriesRequest) Valid ¶ added in v0.27.0
func (r *ListSubscriptionCategoriesRequest) Valid() error
type ListSubscriptionsResponse ¶
type ListSubscriptionsResponse struct {
// Filters contains filters for altering the display of objects.
Filters ListFilters `json:"filters" validate:"required"`
// LatestArticles is a map of the latest articles for each subscription in the result.
LatestArticles *sync.Map `json:"latest_articles,omitempty"`
// Pagination contains data for paginating through results.
Pagination Pagination `form:"pagination" json:"pagination" validate:"omitempty,url_encoded"`
// Subscriptions is the list of subscriptions.
Subscriptions Subscriptions `json:"subscriptions"`
}
ListSubscriptionsResponse contains the data retrieved and relevant for listing subscriptions.
type MarkArticleRequest ¶ added in v0.28.0
type MarkArticleRequest struct {
// ItemID is the unique ID of an item.
ItemID ItemID `form:"item_id" json:"item_id" validate:"required,startswith=item_"`
// Mark applies the given mark action to objects.
Mark Mark `form:"mark" json:"mark" validate:"oneof=read unread"`
// SubscriptionID is the unique ID of a subscription.
SubscriptionID SubscriptionID `form:"subscription_id" json:"subscription_id" validate:"required,startswith=sub_"`
}
MarkArticleRequest contains parameters for marking an article.
func (*MarkArticleRequest) Sanitise ¶ added in v0.28.0
func (r *MarkArticleRequest) Sanitise() error
func (*MarkArticleRequest) Valid ¶ added in v0.28.0
func (r *MarkArticleRequest) Valid() error
type MarkArticlesRequest ¶
type MarkArticlesRequest struct {
// DisplayedArticles is a map of item ids per subscription.
DisplayedArticles map[SubscriptionID][]ItemID `form:"displayed_articles" json:"displayed_articles"`
// Mark applies the given mark action to objects.
Mark Mark `form:"mark" json:"mark" validate:"oneof=read unread"`
}
MarkArticlesRequest contains the parameters for marking articles.
func (*MarkArticlesRequest) Sanitise ¶
func (r *MarkArticlesRequest) Sanitise() error
Sanitise will alter MarkArticlesRequest data to ensure safety, where needed.
func (*MarkArticlesRequest) Valid ¶
func (r *MarkArticlesRequest) Valid() error
Valid ensures that the MarkArticlesRequest contains valid data.
type MarkObjectParams ¶
type MarkObjectParams struct {
// ObjectID represents an ID of any user-facing object.
ObjectID ObjectID `form:"id" json:"id" validate:"required,startswith=sub_|startswith=item_"`
// Mark applies the given mark action to objects.
Mark Mark `form:"mark" json:"mark" validate:"oneof=read unread"`
// Object represents the type of any user-facing object.
Object ObjectType `form:"object" json:"object" validate:"required,oneof=subscription article"`
}
MarkObjectParams defines model for MarkObjectParams.
func (*MarkObjectParams) Sanitise ¶
func (m *MarkObjectParams) Sanitise() error
func (*MarkObjectParams) Valid ¶
func (m *MarkObjectParams) Valid() error
type MarkSubscriptionRequest ¶ added in v0.31.0
type MarkSubscriptionRequest struct {
// Mark applies the given mark action to objects.
Mark Mark `form:"mark" json:"mark" validate:"oneof=read unread"`
// SubscriptionID is the unique ID of a subscription.
SubscriptionID SubscriptionID `form:"subscription_id" json:"subscription_id" validate:"required,startswith=sub_"`
}
MarkSubscriptionRequest contains the parameters for marking a subscription.
func (*MarkSubscriptionRequest) Sanitise ¶ added in v0.31.0
func (s *MarkSubscriptionRequest) Sanitise() error
Sanitise will sanitise the MarkSubscriptionRequest, ensuring it contains valid field values.
func (*MarkSubscriptionRequest) Valid ¶ added in v0.31.0
func (s *MarkSubscriptionRequest) Valid() error
Valid checks that the MarkSubscriptionRequest contains valid data.
type MarkSubscriptionsRequest ¶
type MarkSubscriptionsRequest struct {
// Mark applies the given mark action to objects.
Mark Mark `form:"mark" json:"mark" validate:"oneof=read unread"`
// Subscriptions is a list of subscription IDs.
Subscriptions []SubscriptionID `form:"selected_subscriptions" json:"subscriptions" validate:"omitempty,dive,startswith=sub_"`
// View The state of objects to view.
View View `form:"view" json:"view" validate:"required,oneof=read unread all"`
}
MarkSubscriptionsRequest contains the parameters for marking a list of subscriptions.
func (*MarkSubscriptionsRequest) Sanitise ¶
func (s *MarkSubscriptionsRequest) Sanitise() error
Sanitise will sanitise the MarkSubscriptionsRequest, ensuring it contains valid field values.
func (*MarkSubscriptionsRequest) Valid ¶
func (s *MarkSubscriptionsRequest) Valid() error
Valid checks that the MarkSubscriptionsRequest contains valid data.
type MarkdownFile ¶ added in v0.49.0
type MarkdownFile struct {
Content []byte `json:"content"`
// Details contains a mapping of a file in an embedded FS to the URL path it is served from.
Details FileDetails `json:"details"`
// Frontmatter contains metadata about a markdown file that allows mapping it to a path under a documentation directory.
Frontmatter MarkdownFrontMatter `json:"frontmatter" toml:"doc_metadata"`
// JsonLD is the JSON-LD format for the file.
JsonLD *json.RawMessage `json:"jsonLD,omitempty"`
}
MarkdownFile contains the raw markdown file data and its frontmatter.
type MarkdownFrontMatter ¶ added in v0.49.0
type MarkdownFrontMatter struct {
// Author the person who wrote or is responsible for the document.
Author *string `json:"author,omitempty" toml:"author"`
// CreatedAt is when the post was created.
CreatedAt string `json:"created_at" toml:"created_at" validate:"required,datetime=2006-01-02"`
// Description is a description of the document, used in metadata headers of the page.
Description string `json:"description" toml:"description" validate:"required"`
// Image is a URL to an image to represent the file.
Image *string `json:"image,omitempty" toml:"image" validate:"omitempty,url"`
// PageTitle is the title rendered in the page header (i.e., <title/>).
PageTitle string `json:"page_title" toml:"page_title" validate:"required"`
// Title is the in-page title of the document.
Title string `json:"title" toml:"title" validate:"required"`
// UpdatedAt is when the post was updated.
UpdatedAt *string `json:"updated_at,omitempty" toml:"updated_at" validate:"omitempty,datetime=2006-01-02"`
}
MarkdownFrontMatter contains metadata about a markdown file that allows mapping it to a path under a documentation directory.
func (*MarkdownFrontMatter) GetCreatedDate ¶ added in v0.153.0
func (fm *MarkdownFrontMatter) GetCreatedDate() time.Time
func (*MarkdownFrontMatter) GetUpdatedDate ¶ added in v0.153.0
func (fm *MarkdownFrontMatter) GetUpdatedDate() time.Time
type OPMLFile ¶
type OPMLFile struct {
*FileUpload
}
OPMLFile is an opml file used for importing/exporting subscriptions.
func (*OPMLFile) GenerateRequests ¶
func (f *OPMLFile) GenerateRequests() ([]FeedSubscriptionRequest, error)
GenerateRequests extracts the feed outlines from the OPML file and returns a slice of subscription requests.
type ObjectCommon ¶
type ObjectCommon struct {
// Authors is a list of people (names, nicknames and/or emails) who "authored" the object content.
Authors []string `json:"authors,omitempty"`
// Categories is a list of categories that define a taxonomy for the feed or item.
Categories []Category `json:"categories,omitempty" validate:"omitempty,unique"`
// Contributors is a list of people (names, nicknames and/or emails) who "contributed" the object content.
Contributors []string `json:"contributors,omitempty"`
// Copyright is a copyright notice for the content.
Copyright *string `json:"copyright,omitempty"`
// Description is a short summary or description of the feed or item.
Description *string `json:"description,omitempty"`
// Image contains details about a remote image.
Image *RemoteImage `json:"image,omitempty"`
// Language is the language the content is written in.
Language *string `json:"language,omitempty"`
// Published is the datetime at which the feed or item was published.
Published time.Time `json:"published"`
// SourceType indicates what type of source the object came from.
SourceType SourceType `json:"source_type"`
// Title is the title of the feed or item.
Title string `json:"title"`
// Updated is the datetime at which the feed or item was updated.
Updated *time.Time `json:"updated,omitempty"`
// URL is the URL to the webpage for the feed or item. For a feed, this is most likely the webpage the feed is sourced from. For an item, this is most likely the webpage containing the full item contents.
URL string `json:"url,omitempty" validate:"omitempty,url"`
}
ObjectCommon contains common fields across objects.
type ObjectParams ¶
type ObjectParams struct {
// ObjectID represents an ID of any user-facing object.
ObjectID ObjectID `form:"id" json:"id" validate:"required,startswith=sub_|startswith=item_"`
// Object represents the type of any user-facing object.
Object ObjectType `form:"object" json:"object" validate:"required,oneof=subscription article"`
}
ObjectParams contains the parameters for viewing an object.
func (*ObjectParams) Sanitise ¶
func (p *ObjectParams) Sanitise() error
func (*ObjectParams) Valid ¶
func (p *ObjectParams) Valid() error
type ObjectType ¶
type ObjectType string
ObjectType represents the type of any user-facing object.
const ( ObjectTypeArticle ObjectType = "article" ObjectTypeSubscription ObjectType = "subscription" )
Defines values for ObjectType.
func (ObjectType) Valid ¶ added in v0.79.0
func (e ObjectType) Valid() bool
Valid indicates whether the value is a known member of the ObjectType enum.
type PaddleCheckout ¶ added in v0.162.0
type PaddleCheckout struct {
// PlanID is the plan ID.
PlanID string `json:"plan_id" validate:"required"`
// TransactionID is the transaction ID for this checkout session.
TransactionID *string `json:"transaction_id,omitempty"`
}
PaddleCheckout contains data for checking out a Paddle subscription.
type PaddleSubscription ¶ added in v0.143.0
type PaddleSubscription struct {
// CancelledAt is when the user's subscription will cancel. Derived from subscription.scheduled_change.action == "cancel".
CancelledAt *time.Time `json:"cancelled_at,omitempty"`
// CurrentPeriodEnd is when the current billing period for the user's subscription will end. Derived from subscription.current_billing_period.ends_at
CurrentPeriodEnd *time.Time `json:"current_period_end,omitempty"`
// CurrentPeriodStart is when the current billing period for the user's subscription started. Derived from subscription.current_billing_period.starts_at.
CurrentPeriodStart *time.Time `json:"current_period_start,omitempty"`
// CustomerID is the ID of the customer in the Paddle backend.
CustomerID string `json:"customer_id" validate:"required"`
// PriceID is the ID of the price that the customer paid for their subscription.
PriceID string `json:"price_id" validate:"required"`
// PriceName is the name of price for the subscription.
PriceName string `json:"price_name" validate:"required"`
// SubscriptionID is the unique identifier for the user's subscription.
SubscriptionID string `json:"subscription_id" validate:"required"`
// SubscriptionName is the name of the subscription the user purchased.
SubscriptionName string `json:"subscription_name" validate:"required"`
// SubscriptionStatus is the name current status of the subscription plan.
SubscriptionStatus string `json:"subscription_status" validate:"required"`
// TrialEnd is when the user's trial will end. Derived from subscription.next_billed_at.
TrialEnd *time.Time `json:"trial_end,omitempty"`
// UpdatedAt records when the object was last updated in the database.
UpdatedAt UpdatedAt `json:"updated_at,omitempty" validate:"omitnil"`
}
PaddleSubscription contains details about the user's paid subscription.
type RemoteImage ¶ added in v0.79.0
type RemoteImage struct {
// Title the description of the image
Title *string `json:"title,omitempty"`
// URL is a URL.
URL *URL `form:"url" json:"url" validate:"omitempty,url"`
}
RemoteImage contains details about a remote image.
func NewRemoteImage ¶ added in v0.79.0
func NewRemoteImage(url, title string) *RemoteImage
NewRemoteImage creates a new RemoteImage object.
func (*RemoteImage) GetTitle ¶ added in v0.79.0
func (i *RemoteImage) GetTitle() string
GetTitle returns the title (i.e., alt text) of the image, if any.
func (*RemoteImage) GetURL ¶ added in v0.79.0
func (i *RemoteImage) GetURL() string
GetURL returns the URL to the image.
func (*RemoteImage) String ¶ added in v0.82.0
func (i *RemoteImage) String() string
type RemoveSubscriptionRequest ¶
type RemoveSubscriptionRequest struct {
Nickname string `form:"nickname" json:"nickname" validate:"required"`
// SubscriptionID is the unique ID of a subscription.
SubscriptionID SubscriptionID `form:"subscription_id" json:"subscription_id" validate:"required,startswith=sub_"`
}
RemoveSubscriptionRequest contains the parameters for removing a subscription.
func (*RemoveSubscriptionRequest) Valid ¶
func (r *RemoveSubscriptionRequest) Valid() error
Valid checks that the RemoveSubscriptionRequest contains valid data.
type ReportIssueRequest ¶
type ReportIssueRequest struct {
// Details is the user-submitted text about the issue.
Details *string `form:"details" json:"details,omitempty" validate:"required"`
// ObjectID is the object id (i.e., subscription/article id).
ObjectID *string `form:"object_id" json:"object_id,omitempty"`
// PageUrl is the URL of the page on which the user selected the report issue action.
PageUrl string `form:"page_url" json:"page_url" validate:"required,url"`
// ScreenshotURL is a URL to a screenshot the user has uploaded that is related to or showing the problem.
ScreenshotURL *string `form:"-" json:"screenshot_url,omitempty" validate:"omitempty,url"`
// UserEmail is the email address the user has entered for getting in touch about the issue.
UserEmail string `form:"user_email" json:"user_email" validate:"required,email"`
}
ReportIssueRequest contains details about an issue with the service.
func (*ReportIssueRequest) Sanitise ¶
func (i *ReportIssueRequest) Sanitise() error
func (*ReportIssueRequest) Valid ¶
func (i *ReportIssueRequest) Valid() error
type SearchRequest ¶
type SearchRequest struct {
// Authors a list of search terms for authors.
Authors *string `form:"authors" json:"authors,omitempty"`
// Categories a list of search terms for categories.
Categories *string `form:"categories" json:"categories,omitempty"`
// PublishedWithin represents a time range within which the objects should be published
PublishedWithin SearchRequestPublishedWithin `` /* 135-byte string literal not displayed */
// Sort is how a list of objects is sorted.
Sort Sort `form:"sort" json:"sort" validate:"required,oneof=newest_first oldest_first most_unread least_unread most_relevant"`
// SubscriptionID will be a subscription ID if the user has created a SearchSubscription for this request.
SubscriptionID *SubscriptionID `form:"subscription_id" json:"subscription_id,omitempty" validate:"omitzero,startswith=sub_"`
// Subscriptions is a list of subscription IDs.
Subscriptions []SubscriptionID `form:"subscriptions" json:"subscriptions,omitempty" validate:"omitempty,unique,dive,startswith=sub_"`
// Text is the text to search.
Text string `form:"text" json:"text" validate:"omitempty,required"`
// Timezone represents the timezone of the browser (i.e., user), used for calculating published_within offset.
Timezone string `form:"timezone" json:"timezone" validate:"required,timezone"`
// View The state of objects to view.
View View `form:"view" json:"view" validate:"required,oneof=read unread all"`
}
SearchRequest represents a search request by the user.
func NewSearchRequest ¶
func NewSearchRequest() *SearchRequest
NewSearchRequest creates a new SearchRequest object with default values. Defaults are search all objects within last week, sorted by most relevant.
func (*SearchRequest) HXVals ¶
func (r *SearchRequest) HXVals() string
HXVals returns a string that represents the search as hx-vals.
func (*SearchRequest) Query ¶
func (r *SearchRequest) Query() string
Query returns a string that represents the search as query parameters.
func (*SearchRequest) Sanitise ¶
func (r *SearchRequest) Sanitise() error
Sanitise will sanitise the search request data.
func (*SearchRequest) Valid ¶
func (r *SearchRequest) Valid() error
Valid returns a boolean indicating whether the search request data is valid.
func (*SearchRequest) Values ¶ added in v0.101.0
func (r *SearchRequest) Values() map[string]any
type SearchRequestPublishedWithin ¶
type SearchRequestPublishedWithin string
SearchRequestPublishedWithin represents a time range within which the objects should be published
const ( SearchRequestPublishedWithinAllTime SearchRequestPublishedWithin = "all_time" SearchRequestPublishedWithinLast12hours SearchRequestPublishedWithin = "last_12hours" SearchRequestPublishedWithinLast5mins SearchRequestPublishedWithin = "last_5mins" SearchRequestPublishedWithinLastDay SearchRequestPublishedWithin = "last_day" SearchRequestPublishedWithinLastHour SearchRequestPublishedWithin = "last_hour" SearchRequestPublishedWithinLastMonth SearchRequestPublishedWithin = "last_month" SearchRequestPublishedWithinLastWeek SearchRequestPublishedWithin = "last_week" )
Defines values for SearchRequestPublishedWithin.
func (SearchRequestPublishedWithin) Valid ¶ added in v0.79.0
func (e SearchRequestPublishedWithin) Valid() bool
Valid indicates whether the value is a known member of the SearchRequestPublishedWithin enum.
type SearchResults ¶ added in v0.28.1
type SearchResults struct {
Articles Articles `json:"articles,omitempty"`
// Categories is a list of categories.
Categories []Category `form:"categories" json:"categories" validate:"omitnil,unique,dive,url_encoded"`
// Pagination contains data for paginating through results.
Pagination *Pagination `form:"pagination" json:"pagination,omitempty" validate:"omitempty,url_encoded"`
// Search represents a search request by the user.
Search SearchRequest `form:"search" json:"search" validate:"required"`
Subscriptions Subscriptions `json:"subscriptions,omitempty"`
}
SearchResults contains the results of a search.
type SearchSubscription ¶
type SearchSubscription struct {
// Search represents a search request by the user.
Search SearchRequest `form:"search" json:"search" validate:"required"`
}
SearchSubscription is a custom subscription created from a search request.
func (*SearchSubscription) Valid ¶
func (s *SearchSubscription) Valid() error
Valid returns a boolean indicating if the Subscription contains valid data (true). If it contains invalid data (false) a non-nil error is also returned which contains validation issues.
type SearchSubscriptionRequest ¶
type SearchSubscriptionRequest struct {
// Customisation contains object fields that can be customised (overridden) by a user.
Customisation *SubscriptionCustomisation `form:"customisation" json:"customisation,omitempty"`
// Search represents a search request by the user.
Search SearchRequest `form:"search" json:"search" validate:"required"`
// Settings contains options that control how the subscription is stored/displayed.
Settings *SubscriptionSettings `form:"settings" json:"settings,omitempty"`
// SuggestedCategories is a list of suggested categories for the subscription.
SuggestedCategories []Category `form:"-" json:"-"`
}
SearchSubscriptionRequest represents a request to create a search subscription.
func NewSearchSubscriptionRequest ¶ added in v0.54.0
func NewSearchSubscriptionRequest( search SearchRequest, suggestedCategories []Category, ) *SearchSubscriptionRequest
func (*SearchSubscriptionRequest) Sanitise ¶
func (r *SearchSubscriptionRequest) Sanitise() error
func (*SearchSubscriptionRequest) Valid ¶
func (r *SearchSubscriptionRequest) Valid() error
type ShareArticleRequest ¶ added in v0.34.1
type ShareArticleRequest struct {
ItemID ItemID `form:"item_id" json:"item_id" validate:"required,startswith=item_"`
Link string `form:"link" json:"link" validate:"required,url"`
Title string `form:"title" json:"title" validate:"required"`
}
ShareArticleRequest contains parameters for sharing an article.
func (*ShareArticleRequest) Sanitise ¶ added in v0.34.1
func (r *ShareArticleRequest) Sanitise() error
func (*ShareArticleRequest) Valid ¶ added in v0.34.1
func (r *ShareArticleRequest) Valid() error
type Sort ¶
type Sort string
Sort is how a list of objects is sorted.
type SourceType ¶ added in v0.26.0
type SourceType string
SourceType indicates what type of source the object came from.
const ( SourceTypeAtom SourceType = "Atom" SourceTypeEmail SourceType = "Email" SourceTypeJSONFeed SourceType = "JSONFeed" SourceTypeRSS SourceType = "RSS" )
Defines values for SourceType.
func (SourceType) Valid ¶ added in v0.79.0
func (e SourceType) Valid() bool
Valid indicates whether the value is a known member of the SourceType enum.
type Subscription ¶
type Subscription struct {
// CreatedAt records when the object was created in the database.
CreatedAt CreatedAt `json:"created_at" validate:"required"`
// Customisation contains object fields that can be customised (overridden) by a user.
Customisation *SubscriptionCustomisation `form:"customisation" json:"customisation,omitempty"`
// EmailData is a subscription to an email newsletter source.
EmailData *EmailSubscription `json:"email_data,omitempty" validate:"omitempty"`
// Favorite indicates whether this subscription has been marked as a favorite by the user.
Favorite bool `json:"favorite"`
// FeedData represents a feed a user has subscribed to.
FeedData *FeedSubscription `json:"feed_data,omitempty" validate:"omitempty"`
// GroupData represents a subscription that combines other subscriptions.
GroupData *GroupSubscription `json:"group_data,omitempty" validate:"omitempty"`
// MarkedReadAt indicates when the subscription was last marked read. Any articles older than this timestamp are considered read, any newer unread.
MarkedReadAt *time.Time `json:"marked_read_at,omitempty"`
// SearchData is a custom subscription created from a search request.
SearchData *SearchSubscription `json:"search_data,omitempty" validate:"omitempty"`
// Settings contains options that control how the subscription is stored/displayed.
Settings SubscriptionSettings `form:"settings" json:"settings"`
// Stats contains stats about a subscription.
Stats *SubscriptionStats `json:"-" validate:"-"`
// SubscriptionID is the unique ID of a subscription.
SubscriptionID SubscriptionID `form:"subscription_id" json:"subscription_id" validate:"required,startswith=sub_"`
// Type is the type of subscription.
Type SubscriptionType `json:"type" validate:"required,oneof=feed search group email"`
// UpdatedAt records when the object was last updated in the database.
UpdatedAt *UpdatedAt `json:"updated_at,omitempty" validate:"omitnil"`
// UserID is the unique ID of a user.
UserID UserID `form:"user_id" json:"user_id" validate:"required,startswith=user_"`
}
Subscription defines model for Subscription.
func NewEmailSubscription ¶ added in v0.25.0
func NewFeedSubscription ¶
func NewFeedSubscription( ctx context.Context, feed *Feed, customisation *SubscriptionCustomisation, ) (*Subscription, error)
NewFeedSubscription creates a new subscription for a feed with any user customisations given.
func NewGroupSubscription ¶
func NewGroupSubscription(ctx context.Context, request *GroupSubscriptionRequest) (*Subscription, error)
NewGroupSubscription creates a GroupSubscription. A GroupSubscription is a kind of meta-subscription that aggregates all articles from multiple individual subscriptions into a single custom subscription.
func NewSearchSubscription ¶
func NewSearchSubscription(ctx context.Context, request *SearchSubscriptionRequest) (*Subscription, error)
NewSearchSubscription creates a new SearchSubscription. A SearchSubscription collates articles that match a search into a single custom subscription.
func (*Subscription) GetArticleFilters ¶ added in v0.26.0
func (s *Subscription) GetArticleFilters() SubscriptionArticleFilters
func (*Subscription) GetCategories ¶
func (s *Subscription) GetCategories(maxCount int) Categories
GetCategories returns the categories of the subscription. It is the combined list of any user-assigned categories and the categories in the feed content.
func (*Subscription) GetFeedID ¶ added in v0.26.0
func (s *Subscription) GetFeedID() FeedID
GetFeedID returns the unqiue FeedID of the subscription. Not all subscription types will have a FeedID.
func (*Subscription) GetID ¶
func (s *Subscription) GetID() SubscriptionID
GetID returns the unqiue ID of the subscription.
func (*Subscription) GetImage ¶
func (s *Subscription) GetImage() URL
GetImage retrieves the image that represents the subscription, or nil if no image is available.
func (*Subscription) GetItemState ¶ added in v0.26.0
func (s *Subscription) GetItemState(itemID ItemID) *ArticleState
GetItemState retrieves the item state (read/unread/saved) from the subscription. By default it will return unread unless the user has explicitly marked or saved the item.
func (*Subscription) GetLink ¶
func (s *Subscription) GetLink() string
GetLink returns the source feed link. For a search subscription, there is no source so this returns an empty string.
func (*Subscription) GetMarkedReadAt ¶ added in v0.26.0
func (s *Subscription) GetMarkedReadAt() time.Time
func (*Subscription) GetReadItems ¶ added in v0.26.0
func (s *Subscription) GetReadItems() []ItemID
GetReadItems retrieves a list of ItemIDs for the feed subscription that user has explicitly marked as read.
func (*Subscription) GetStats ¶
func (s *Subscription) GetStats() *SubscriptionStats
GetStats returns the stats object containing the dynamically generated stats (i.e., unread count, article rate) of the subscription.
func (*Subscription) GetSubscriptionType ¶
func (s *Subscription) GetSubscriptionType() SubscriptionType
GetSubscriptionType returns the type of subscription (i.e., feed, search, group, etc.).
func (*Subscription) GetTitle ¶
func (s *Subscription) GetTitle() string
GetTitle returns the title (or user nickname if assigned) of the subscription.
func (*Subscription) GetUnreadItems ¶ added in v0.26.0
func (s *Subscription) GetUnreadItems() []ItemID
GetUnreadItems retrieves a list of ItemIDs for the feed subscription that user has explicitly marked as unread.
func (*Subscription) GetUpdatedDate ¶
func (s *Subscription) GetUpdatedDate() time.Time
GetUpdatedDate returns the timestamp that represents when the subscription was last updated. Usually, this means the timestamp of the newest article in the subscription.
func (*Subscription) IsFavorite ¶
func (s *Subscription) IsFavorite() bool
IsFavorite returns a boolean indicating whether the user has marked this subscription as a favorite. Note for some subscription types, this will always return true.
func (*Subscription) Mark ¶
func (s *Subscription) Mark(user *User, mark Mark)
Mark applies the given mark (read/unread) to a subscription.
func (*Subscription) MarkItems ¶
func (s *Subscription) MarkItems(mark Mark, itemIDs ...ItemID)
MarkItems marks the given items in a user subscription the given mark.
func (*Subscription) MarkItemsRead ¶
func (s *Subscription) MarkItemsRead(itemIDs ...ItemID)
MarkItemsRead will mark the given items as read for the subscription.
func (*Subscription) MarkItemsUnread ¶
func (s *Subscription) MarkItemsUnread(itemIDs ...ItemID)
MarkItemsUnread will mark the given items as unread for the subscription.
func (*Subscription) SetItemState ¶ added in v0.26.0
func (s *Subscription) SetItemState(itemID ItemID, state *ArticleState)
SetItemState will set the state of the item to the given state.
func (*Subscription) Valid ¶
func (s *Subscription) Valid() error
Valid returns a boolean indicating if the Subscription contains valid data (true). If it contains invalid data (false) a non-nil error is also returned which contains validation issues.
type SubscriptionArticleFilters ¶
type SubscriptionArticleFilters struct {
// Authors is the author filters to apply.
Authors *string `form:"authors" json:"authors,omitempty"`
// Categories is the category filters to apply.
Categories *string `form:"categories" json:"categories,omitempty"`
// Text is the filters on the title/content to apply.
Text *string `form:"text" json:"text,omitempty"`
}
SubscriptionArticleFilters holds filters to apply to the articles within a subscription.
func (*SubscriptionArticleFilters) Sanitise ¶ added in v0.82.4
func (f *SubscriptionArticleFilters) Sanitise() error
func (*SubscriptionArticleFilters) Valid ¶ added in v0.82.4
func (f *SubscriptionArticleFilters) Valid() error
type SubscriptionCustomisation ¶
type SubscriptionCustomisation struct {
// Categories is a custom list of categories for an object.
Categories []Category `form:"categories" json:"categories,omitempty" validate:"omitempty,unique"`
// ImageURL is a custom image to represent the object.
ImageURL *string `json:"image_url,omitempty" validate:"omitzero,url"`
// Nickname is an optional alias or label for an object.
Nickname *string `form:"nickname" json:"nickname,omitempty" validate:"omitempty"`
}
SubscriptionCustomisation contains object fields that can be customised (overridden) by a user.
func (*SubscriptionCustomisation) GetCategories ¶ added in v0.82.4
func (c *SubscriptionCustomisation) GetCategories() Categories
func (*SubscriptionCustomisation) GetImageURL ¶ added in v0.82.4
func (c *SubscriptionCustomisation) GetImageURL() string
func (*SubscriptionCustomisation) GetNickname ¶ added in v0.82.4
func (c *SubscriptionCustomisation) GetNickname() string
func (*SubscriptionCustomisation) Sanitise ¶ added in v0.82.4
func (c *SubscriptionCustomisation) Sanitise() error
func (*SubscriptionCustomisation) Valid ¶ added in v0.82.4
func (c *SubscriptionCustomisation) Valid() error
type SubscriptionID ¶
type SubscriptionID = string
SubscriptionID is the unique ID of a subscription.
type SubscriptionMetadata ¶
type SubscriptionMetadata struct {
// CreatedAt records when the object was created in the database.
CreatedAt CreatedAt `json:"created_at" validate:"required"`
// Customisation contains object fields that can be customised (overridden) by a user.
Customisation *SubscriptionCustomisation `form:"customisation" json:"customisation,omitempty"`
// Favorite indicates whether this subscription has been marked as a favorite by the user.
Favorite bool `json:"favorite"`
// MarkedReadAt indicates when the subscription was last marked read. Any articles older than this timestamp are considered read, any newer unread.
MarkedReadAt *time.Time `json:"marked_read_at,omitempty"`
// Settings contains options that control how the subscription is stored/displayed.
Settings SubscriptionSettings `form:"settings" json:"settings"`
// SubscriptionID is the unique ID of a subscription.
SubscriptionID SubscriptionID `form:"subscription_id" json:"subscription_id" validate:"required,startswith=sub_"`
// Type is the type of subscription.
Type SubscriptionMetadataType `json:"type" validate:"required,oneof=feed search group email"`
// UpdatedAt records when the object was last updated in the database.
UpdatedAt *UpdatedAt `json:"updated_at,omitempty" validate:"omitnil"`
// UserID is the unique ID of a user.
UserID UserID `form:"user_id" json:"user_id" validate:"required,startswith=user_"`
}
SubscriptionMetadata contains common fields across all subscription types.
type SubscriptionMetadataType ¶
type SubscriptionMetadataType string
SubscriptionMetadataType is the type of subscription.
const ( SubscriptionMetadataTypeEmail SubscriptionMetadataType = "email" SubscriptionMetadataTypeFeed SubscriptionMetadataType = "feed" SubscriptionMetadataTypeGroup SubscriptionMetadataType = "group" SubscriptionMetadataTypeSearch SubscriptionMetadataType = "search" )
Defines values for SubscriptionMetadataType.
func (SubscriptionMetadataType) Valid ¶ added in v0.79.0
func (e SubscriptionMetadataType) Valid() bool
Valid indicates whether the value is a known member of the SubscriptionMetadataType enum.
type SubscriptionSettings ¶
type SubscriptionSettings struct {
// ShowFullArticleContent toggles whether articles in the subscription should be always displayed with remote content.
ShowFullArticleContent bool `form:"show_full_article_content" json:"show_full_article_content"`
}
SubscriptionSettings contains options that control how the subscription is stored/displayed.
type SubscriptionStats ¶
type SubscriptionStats struct {
// AvgDailyUpdates is the avergage number of articles published per day.
AvgDailyUpdates float64 `json:"-" validate:"gte=0"`
// LastUpdate is the timestamp of the most newest item that matches the search.
LastUpdate time.Time `json:"-" validate:"required"`
// UnreadCount is the value of items that are not explicitly marked unread by the user for this subscription.
UnreadCount int `json:"-" validate:"gte=0"`
}
SubscriptionStats contains stats about a subscription.
func (*SubscriptionStats) IsUnread ¶
func (s *SubscriptionStats) IsUnread() bool
IsUnread returns a boolean indicating whether the subscription is considered unread.
func (*SubscriptionStats) UnreadTotal ¶
func (s *SubscriptionStats) UnreadTotal() int
UnreadTotal returns the unread count of items in the subscription.
func (*SubscriptionStats) UpdateFrequency ¶
func (s *SubscriptionStats) UpdateFrequency() string
UpdateFrequency returns a string that roughly indicates how often the subscription is updated.
type SubscriptionType ¶
type SubscriptionType string
SubscriptionType is the type of subscription.
const ( SubscriptionTypeEmail SubscriptionType = "email" SubscriptionTypeFeed SubscriptionType = "feed" SubscriptionTypeGroup SubscriptionType = "group" SubscriptionTypeSearch SubscriptionType = "search" )
Defines values for SubscriptionType.
func (SubscriptionType) Valid ¶ added in v0.79.0
func (e SubscriptionType) Valid() bool
Valid indicates whether the value is a known member of the SubscriptionType enum.
type Subscriptions ¶
type Subscriptions []*Subscription
Subscriptions is a slice of subscriptions of any type.
func SubscriptionsFromCtx ¶
func SubscriptionsFromCtx(ctx context.Context) Subscriptions
SubscriptionsFromCtx retrieves the slice of Subscriptions from the context. If no Subscriptions slice is in the context, it returns an empty slice.
func (Subscriptions) ExcludeIDs ¶ added in v0.128.0
func (s Subscriptions) ExcludeIDs(ids ...SubscriptionID) Subscriptions
ExcludeIDs returns a new slice containing the subscriptions which DO NOT have an id matching the given IDs.
func (Subscriptions) FilterByCategories ¶
func (s Subscriptions) FilterByCategories(categories ...Category) Subscriptions
FilterByCategories returns a new slice containing the subscriptions which have a category matching the given categories.
func (Subscriptions) FilterByFavorites ¶
func (s Subscriptions) FilterByFavorites(value bool) Subscriptions
FilterByFavorites returns a slice containing only favorite subscriptions.
func (Subscriptions) FilterByFeedIDs ¶ added in v0.128.0
func (s Subscriptions) FilterByFeedIDs(ids ...FeedID) Subscriptions
FilterByFeedIDs returns a new slice containing the subscriptions which have a FeedID matching the given ids.
func (Subscriptions) FilterByIDs ¶ added in v0.128.0
func (s Subscriptions) FilterByIDs(ids ...SubscriptionID) Subscriptions
FilterByIDs returns a new slice containing the subscriptions which have a SubscriptionID matching the given ids.
func (Subscriptions) FilterByType ¶
func (s Subscriptions) FilterByType(t ...SubscriptionType) Subscriptions
FilterByType returns a slice containing subscriptions of the specified type.
func (Subscriptions) FilterByView ¶
func (s Subscriptions) FilterByView(view View) Subscriptions
FilterByView returns a slice containing the subscription which match the given view state.
func (Subscriptions) FilterEmailIDs ¶ added in v0.128.0
func (s Subscriptions) FilterEmailIDs(ids ...string) Subscriptions
func (Subscriptions) GetByFeedID ¶
func (s Subscriptions) GetByFeedID(id FeedID) *Subscription
GetByFeedID will return the subscription that matches the given feed ID, if any.
func (Subscriptions) GetByID ¶ added in v0.128.0
func (s Subscriptions) GetByID(id SubscriptionID) *Subscription
GetByID will return the subscription that matches the given ID, if any.
func (Subscriptions) GetCategories ¶ added in v0.54.0
func (s Subscriptions) GetCategories() Categories
GetCategories returns all categories across all the subscriptions. Duplicates are removed.
func (Subscriptions) GetFeedIDs ¶
func (s Subscriptions) GetFeedIDs() []FeedID
GetFeedIDs returns the IDs of feeds the subscriptions are for. This may return an empty slice if the subscriptions are only of type search, for example as those subscriptions do not represent any particular feed.
func (Subscriptions) GetIDs ¶
func (s Subscriptions) GetIDs() []SubscriptionID
GetIDs returns the subscription ids for all subscription states in the slice.
func (Subscriptions) Paginate ¶
func (s Subscriptions) Paginate(pagination Pagination, count int) (Subscriptions, Pagination)
Paginate will paginate through a slice of subscriptions, returning a new slice of subscriptions and the next pagination value (if any).
func (Subscriptions) Sort ¶
func (s Subscriptions) Sort(sort Sort) Subscriptions
Sort will sort the slice of subscriptions by the given sort option. Favorite subscriptions are always sorted before other subscriptions, and the sort option is used as a tiebreaker.
type User ¶
type User struct {
// AvatarURL is a link to an image file to user as an avatar for the user.
AvatarURL *string `form:"avatar_url" json:"avatar_url,omitempty" validate:"omitempty,url"`
// CreatedAt records when the object was created in the database.
CreatedAt CreatedAt `json:"created_at" validate:"required"`
// Email is the email address of the user.
Email string `form:"email" json:"email" validate:"required,email"`
// ExternalUserID is the ID of the user on the external backend that was used to create the account.
ExternalUserID string `json:"external_user_id" validate:"required"`
// ItemFavorites is the IDs of items (articles) the user has favorited.
ItemFavorites []ItemID `json:"item_favorites,omitempty" validate:"omitempty,dive,startswith=item_"`
// LastLogin is the timestamp of when the user last logged in to the app.
LastLogin time.Time `json:"last_login"`
// LoginCount is the total number of logins of the user.
LoginCount int `json:"login_count"`
// Metadata contains metadata related to the user's account.
Metadata UserMetadata `json:"metadata"`
// Nickname is a nickname for the user.
Nickname string `form:"nickname" json:"nickname" validate:"required"`
// PromotionalEmail is a flag indicating whether the user is accepting promotional (non-account/administrative) emails.
PromotionalEmail bool `form:"promotional_email" json:"promotional_email" validate:"required"`
// Provider is the backend provider that was used to create the account.
Provider string `json:"provider" validate:"required"`
// Settings contains user-specific settings for the application.
Settings UserSettings `json:"settings"`
Subscription *User_Subscription `json:"subscription,omitempty"`
// UserSubscriptionType is the type of subscription the user has purchased.
UserSubscriptionType *UserSubscriptionType `json:"subscription_type,omitempty" validate:"omitempty,oneof=paddle android"`
// UpdatedAt records when the object was last updated in the database.
UpdatedAt *UpdatedAt `json:"updated_at,omitempty" validate:"omitnil"`
// UserID is the unique ID of a user.
UserID UserID `form:"user_id" json:"user_id" validate:"required,startswith=user_"`
}
User defines model for User.
func UserFromCtx ¶
UserFromCtx retrieves a user from the context, if any.
func (*User) GetExternalID ¶
GetExternalID returns the backend ID for the user.
func (*User) GetMaxHistory ¶
GetMaxHistory returns a timestamp in the past from which the user can view items. If there is an issue retrieving and parsing the value from the user's metadata, it will default to using the lowest plan max history.
func (*User) GetNickname ¶
GetNickname retrieves the nickname of the user.
func (*User) GetSettings ¶
func (u *User) GetSettings() *UserSettings
GetSettings returns the user's settings. If the user has no settings (i.e. new user), default settings will be returned.
func (*User) GetUpdatesFrequency ¶
GetUpdatesFrequency returns a duration on which the user will see new updates. If there is an issue retrieving and parsing the value from the user's metadata, it will use the lowest plan updates frequency.
func (*User) HasValidSubscription ¶ added in v0.158.1
HasValidSubscription returns a boolean indicating whether the user has a valid subscription. A valid subscription only indicates the user has a subscription of some type. It does not indicate the state of the subscription.
func (*User) InTrial ¶ added in v0.143.0
InTrial returns a boolean indicating whether this user account is in its trial period.
func (*User) InTrialGracePeriod ¶ added in v0.162.0
InTrialGracePeriod returns a boolean indicating whether the user account is in its trial grace period. The trial grace period starts after the trial has expired and lasts for one week. It allows a user who may have forgotten or otherwise let a trial temporarily lapse to continue to use the app for a short period, with the hope they will buy a subscription.
type UserCustomisation ¶
type UserCustomisation struct {
// AvatarURL is a link to an image file to user as an avatar for the user.
AvatarURL *string `form:"avatar_url" json:"avatar_url,omitempty" validate:"omitempty,url"`
// Email is the email address of the user.
Email string `form:"email" json:"email" validate:"required,email"`
// Nickname is a nickname for the user.
Nickname string `form:"nickname" json:"nickname" validate:"required"`
// PromotionalEmail is a flag indicating whether the user is accepting promotional (non-account/administrative) emails.
PromotionalEmail bool `form:"promotional_email" json:"promotional_email" validate:"required"`
}
UserCustomisation contains account fields that a user can customize.
type UserLimit ¶ added in v0.151.0
type UserLimit struct {
// Exceeded indicates whether this limit has been exceeded.
Exceeded bool `json:"exceeded"`
// Timestamp is the timestamp when the limit was last changed.
Timestamp time.Time `json:"timestamp"`
}
UserLimit represents details about a user account limit
type UserMessage ¶
type UserMessage struct {
// Details is a longer description and/or background details about the message.
Details *string `json:"details,omitempty"`
// Status indicates the severity or importance of the message.
Status UserMessageStatus `json:"status" validate:"required"`
// Summary is a user-level brief description for the message, which can be used as a title or summary.
Summary string `json:"summary" validate:"required"`
}
UserMessage represents a message that can be displayed to the user as the result of an action.
func NewErrorMessage ¶
func NewErrorMessage(summary string, details string) *UserMessage
NewErrorMessage creates a new UserMessage indicating an error with the given summary and (optional) details.
func NewInfoMessage ¶
func NewInfoMessage(summary string, details string) *UserMessage
NewInfoMessage creates a new UserMessage indicating informational details with the given summary and (optional) details.
func NewSuccessMessage ¶
func NewSuccessMessage(summary string, details string) *UserMessage
NewSuccessMessage creates a new UserMessage indicating success with the given summary and (optional) details.
func NewWarningMessage ¶
func NewWarningMessage(summary string, details string) *UserMessage
NewWarningMessage creates a new UserMessage indicating a warning with the given summary and (optional) details.
func (*UserMessage) HasDetails ¶
func (msg *UserMessage) HasDetails() bool
HasDetails returns a boolean indicating whether the message has additional details.
func (*UserMessage) IsError ¶
func (msg *UserMessage) IsError() bool
IsError returns true when the message indicates an error.
func (*UserMessage) IsInfo ¶
func (msg *UserMessage) IsInfo() bool
IsInfo returns true when the message indicates informational status.
func (*UserMessage) IsSuccess ¶
func (msg *UserMessage) IsSuccess() bool
IsSuccess returns true when the message indicates success.
func (*UserMessage) IsWarning ¶
func (msg *UserMessage) IsWarning() bool
IsWarning returns true when the message indicates a warning.
func (*UserMessage) String ¶
func (msg *UserMessage) String() string
String returns the message as a formatted string. This allows Message to satisfy the Stringer interface.
type UserMessageStatus ¶
type UserMessageStatus string
UserMessageStatus indicates the severity or importance of the message.
const ( UserMessageStatusError UserMessageStatus = "error" UserMessageStatusInfo UserMessageStatus = "info" UserMessageStatusSuccess UserMessageStatus = "success" UserMessageStatusWarning UserMessageStatus = "warning" )
Defines values for UserMessageStatus.
func (UserMessageStatus) Valid ¶ added in v0.79.0
func (e UserMessageStatus) Valid() bool
Valid indicates whether the value is a known member of the UserMessageStatus enum.
type UserMetadata ¶
type UserMetadata struct {
// Blocked indicates whether the user is blocked from the app.
Blocked bool `json:"blocked"`
// EmailVerified indicates whether the user has verfied their email address.
EmailVerified bool `json:"email_verified" validate:"required"`
// NewsletterLimit represents details about a user account limit
NewsletterLimit *UserLimit `json:"newsletter_limit,omitempty"`
// PendingDeletion indicates whether the user account is pending deletion.
PendingDeletion *bool `json:"pending_deletion,omitempty,omitzero"`
// PoliciesAccepted indicates whether the user has accepted the app policies.
PoliciesAccepted bool `json:"policies_accepted" validate:"required"`
// PromotionalEmail is a flag indicating whether the user is accepting promotional (non-account/administrative) emails.
PromotionalEmail bool `json:"promotional_email" validate:"required"`
// SubscriptionLimit represents details about a user account limit
SubscriptionLimit *UserLimit `json:"subscription_limit,omitempty"`
}
UserMetadata contains metadata related to the user's account.
func (*UserMetadata) Valid ¶
func (s *UserMetadata) Valid() error
Valid returns a boolean indicating if the UserSettings contains valid data (true). If it contains invalid data (false) a non-nil error is also returned which contains validation issues.
type UserSession ¶
type UserSession struct {
// Data the encoded session data.
Data []byte `json:"data"`
// Expiry the time at which this session token expires.
Expiry time.Time `json:"expiry"`
// Token the session token for the user.
Token string `json:"token"`
}
UserSession tracks a user session.
type UserSettings ¶
type UserSettings struct {
// MarkArticleReadOnView indicates whether to automatically mark an article as read when viewed.
MarkArticleReadOnView bool `form:"mark_article_read_on_view" json:"mark_article_read_on_view"`
// MaxViewHistory is a user-specified limit on how far back in time to view articles.
MaxViewHistory time.Duration `form:"max_view_history" json:"max_view_history" validate:"gte=0"`
// ShowOnboarding indicates whether to show onboarding information (i.e., for a new user).
ShowOnboarding bool `form:"-" json:"show_onboarding"`
// ShowSubscriptionStats indicates whether various subscription stats (e.g., unread counts, articles/day, etc.) should be shown.
ShowSubscriptionStats bool `form:"show_subscription_stats" json:"show_subscription_stats"`
// SubscriptionEmail is an email address the user can use to subscribe to email newsletters.
SubscriptionEmail *string `form:"subscription_email" json:"subscription_email,omitempty" validate:"omitempty,email"`
// UpdatesInterval is the interval on which to check for new updates.
UpdatesInterval time.Duration `form:"update_interval" json:"updates_interval" validate:"gte=0"`
}
UserSettings contains user-specific settings for the application.
func (*UserSettings) Sanitise ¶
func (s *UserSettings) Sanitise() error
Sanitise will sanitise UserSettings values.
func (*UserSettings) Valid ¶
func (s *UserSettings) Valid() error
Valid returns a boolean indicating if the UserSettings contains valid data (true). If it contains invalid data (false) a non-nil error is also returned which contains validation issues.
type UserSubscriptionType ¶ added in v0.157.0
type UserSubscriptionType string
UserSubscriptionType is the type of subscription the user has purchased.
const ( UserSubscriptionTypeAndroid UserSubscriptionType = "android" UserSubscriptionTypePaddle UserSubscriptionType = "paddle" )
Defines values for UserSubscriptionType.
func (UserSubscriptionType) Valid ¶ added in v0.157.0
func (e UserSubscriptionType) Valid() bool
Valid indicates whether the value is a known member of the UserSubscriptionType enum.
type User_Subscription ¶ added in v0.157.0
type User_Subscription struct {
// contains filtered or unexported fields
}
User_Subscription defines model for User.Subscription.
func (User_Subscription) AsAndroidSubscription ¶ added in v0.157.0
func (t User_Subscription) AsAndroidSubscription() (AndroidSubscription, error)
AsAndroidSubscription returns the union data inside the User_Subscription as a AndroidSubscription
func (User_Subscription) AsPaddleSubscription ¶ added in v0.157.0
func (t User_Subscription) AsPaddleSubscription() (PaddleSubscription, error)
AsPaddleSubscription returns the union data inside the User_Subscription as a PaddleSubscription
func (*User_Subscription) FromAndroidSubscription ¶ added in v0.157.0
func (t *User_Subscription) FromAndroidSubscription(v AndroidSubscription) error
FromAndroidSubscription overwrites any union data inside the User_Subscription as the provided AndroidSubscription
func (*User_Subscription) FromPaddleSubscription ¶ added in v0.157.0
func (t *User_Subscription) FromPaddleSubscription(v PaddleSubscription) error
FromPaddleSubscription overwrites any union data inside the User_Subscription as the provided PaddleSubscription
func (User_Subscription) MarshalJSON ¶ added in v0.157.0
func (t User_Subscription) MarshalJSON() ([]byte, error)
func (*User_Subscription) MergeAndroidSubscription ¶ added in v0.157.0
func (t *User_Subscription) MergeAndroidSubscription(v AndroidSubscription) error
MergeAndroidSubscription performs a merge with any union data inside the User_Subscription, using the provided AndroidSubscription
func (*User_Subscription) MergePaddleSubscription ¶ added in v0.157.0
func (t *User_Subscription) MergePaddleSubscription(v PaddleSubscription) error
MergePaddleSubscription performs a merge with any union data inside the User_Subscription, using the provided PaddleSubscription
func (*User_Subscription) UnmarshalJSON ¶ added in v0.157.0
func (t *User_Subscription) UnmarshalJSON(b []byte) error
type YoutubeVideoStatistics ¶ added in v0.138.0
type YoutubeVideoStatistics struct {
// CommentCount is the number of comments for the video.
CommentCount *int64 `json:"comment_count,omitempty"`
// DislikeCount is the number of users who have indicated that they disliked the video by giving it a negative rating.
DislikeCount *int64 `json:"dislike_count,omitempty"`
// FavoriteCount is the number of users who currently have the video marked as a favorite video.
FavoriteCount *int64 `json:"favorite_count,omitempty"`
// LikeCount is the number of users who have indicated that they liked the video
LikeCount *int64 `json:"like_count,omitempty"`
// ViewCount is the number of times the video has been viewed.
ViewCount *int64 `json:"view_count,omitempty"`
}
YoutubeVideoStatistics contains statistics about a Youtube video.