model

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2023 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAlreadyExists = errors.New("already exists")

ErrAlreadyExists if an object already exists

Functions

This section is empty.

Types

type Article

type Article struct {
	ID          uint       `json:"id,omitempty"`
	UserID      uint       `json:"user_id,omitempty"`
	CategoryID  *uint      `json:"category_id,omitempty"`
	Title       string     `json:"title,omitempty"`
	Text        *string    `json:"text,omitempty"`
	HTML        *string    `json:"html,omitempty"`
	URL         *string    `json:"url,omitempty"`
	Image       *string    `json:"image,omitempty"`
	Hash        string     `json:"hash,omitempty"`
	Status      string     `json:"status,omitempty"`
	Stars       uint       `json:"stars,omitempty"`
	PublishedAt *time.Time `json:"published_at,omitempty"`
	CreatedAt   *time.Time `json:"created_at,omitempty"`
	UpdatedAt   *time.Time `json:"updated_at,omitempty"`
}

Article structure definition

func (Article) String

func (a Article) String() string

String convert article to JSON string

func (Article) ToMap

func (a Article) ToMap() map[string]interface{}

ToMap convert article to map

type ArticleCreateForm

type ArticleCreateForm struct {
	Title       string     `json:"title,omitempty"`
	Text        *string    `json:"text,omitempty"`
	HTML        *string    `json:"html,omitempty"`
	URL         *string    `json:"url,omitempty"`
	Image       *string    `json:"image,omitempty"`
	PublishedAt *time.Time `json:"published_at,omitempty"`
	CategoryID  *uint      `json:"category,omitempty"`
	Origin      *string    `json:"origin,omitempty"`
	Tags        *string    `json:"tags,omitempty"`
}

ArticleCreateForm structure definition

func (ArticleCreateForm) Hash

func (form ArticleCreateForm) Hash() string

Hash return form hash

func (ArticleCreateForm) IsComplete

func (form ArticleCreateForm) IsComplete() bool

IsComplete test if the form is complete

func (ArticleCreateForm) Payload

func (form ArticleCreateForm) Payload() string

Payload return form payload (content without HTML tags)

func (ArticleCreateForm) TruncatedTitle

func (form ArticleCreateForm) TruncatedTitle() string

TruncatedTitle return truncated title

type ArticleCreateFormBuilder

type ArticleCreateFormBuilder struct {
	// contains filtered or unexported fields
}

ArticleCreateFormBuilder is a builder to create an Article create form

func NewArticleCreateFormBuilder

func NewArticleCreateFormBuilder() ArticleCreateFormBuilder

NewArticleCreateFormBuilder creates new Article create form builder instance

func (*ArticleCreateFormBuilder) Build

Build creates the article create form

func (*ArticleCreateFormBuilder) CategoryID

func (b *ArticleCreateFormBuilder) CategoryID(categoryID uint) *ArticleCreateFormBuilder

CategoryID set article category ID

func (*ArticleCreateFormBuilder) FromArticle

FromArticle fill article create form internal article

func (*ArticleCreateFormBuilder) HTML

HTML set article HTML

func (*ArticleCreateFormBuilder) Origin

Origin set article origin

func (*ArticleCreateFormBuilder) Random

Random fill article create form with random data

func (*ArticleCreateFormBuilder) Tags

Tags set article tags

func (*ArticleCreateFormBuilder) Text

Text set article text

func (*ArticleCreateFormBuilder) Title

Title set article title

type ArticleUpdateForm

type ArticleUpdateForm struct {
	ID         uint
	Title      *string
	Text       *string
	CategoryID *uint
	Status     *string
	Stars      *int
}

ArticleUpdateForm structure definition

type ArticlesPageRequest

type ArticlesPageRequest struct {
	Status      *string
	Starred     *bool
	Category    *uint
	Query       *string
	AfterCursor *uint
	SortOrder   *string
	SortBy      *string
	Limit       *int
}

ArticlesPageRequest request structure for a paginated list of articles

type ArticlesPageResponse

type ArticlesPageResponse struct {
	TotalCount uint
	EndCursor  uint
	HasNext    bool
	Entries    []*Article
}

ArticlesPageResponse response structure for a paginated list of articles

type Category

type Category struct {
	ID        *uint      `json:"id,omitempty"`
	UserID    *uint      `json:"user_id,omitempty"`
	Title     string     `json:"title,omitempty"`
	CreatedAt *time.Time `json:"created_at,omitempty"`
	UpdatedAt *time.Time `json:"updated_at,omitempty"`
}

Category structure definition

type CategoryCreateForm

type CategoryCreateForm struct {
	Title string
}

CategoryCreateForm structure definition

type CategoryCreateFormBuilder

type CategoryCreateFormBuilder struct {
	// contains filtered or unexported fields
}

CategoryCreateFormBuilder is a builder to create an CategoryCreateForm

func NewCategoryCreateFormBuilder

func NewCategoryCreateFormBuilder() CategoryCreateFormBuilder

NewCategoryCreateFormBuilder creates new Category create form builder instance

func (*CategoryCreateFormBuilder) Build

Build creates the category create form

func (*CategoryCreateFormBuilder) Random

Random fill category with random data

type CategoryUpdateForm

type CategoryUpdateForm struct {
	ID    uint
	Title *string
}

CategoryUpdateForm structure definition

type CreatedArticlesResponse

type CreatedArticlesResponse struct {
	Articles []*Article
	Errors   []error
}

CreatedArticlesResponse structure definition

type Device

type Device struct {
	ID           *uint                 `json:"id,omitempty"`
	UserID       *uint                 `json:"user_id,omitempty"`
	Key          string                `json:"key,omitempty"`
	Subscription *webpush.Subscription `json:"_"`
	LastSeenAt   *time.Time            `json:"last_seen_at,omitempty"`
	CreatedAt    *time.Time            `json:"created_at,omitempty"`
}

Device structure definition Device key is a hash of the subscription payload and is used to prevent subscription duplication

func (*Device) GetSubscription

func (d *Device) GetSubscription() (string, error)

GetSubscription get JSON string of the subscription

func (*Device) SetSubscription

func (d *Device) SetSubscription(sub string) error

SetSubscription set subscription from JSON string

type DeviceBuilder

type DeviceBuilder struct {
	// contains filtered or unexported fields
}

DeviceBuilder is a builder to create an Device

func NewDeviceBuilder

func NewDeviceBuilder() DeviceBuilder

NewDeviceBuilder creates new Device builder instance

func (*DeviceBuilder) Build

func (ab *DeviceBuilder) Build() *Device

Build creates the device

func (*DeviceBuilder) Subscription

func (ab *DeviceBuilder) Subscription(sub string) *DeviceBuilder

Subscription set device subscription

func (*DeviceBuilder) UserID

func (ab *DeviceBuilder) UserID(userID uint) *DeviceBuilder

UserID set device user ID

type DeviceNotification

type DeviceNotification struct {
	Title string `json:"title,omitempty"`
	Body  string `json:"body,omitempty"`
	Href  string `json:"href,omitempty"`
}

DeviceNotification structure definition

type IncomingWebhook

type IncomingWebhook struct {
	ID          *uint      `json:"id,omitempty"`
	UserID      uint       `json:"user_id,omitempty"`
	Alias       string     `json:"alias,omitempty"`
	Token       string     `json:"token,omitempty"`
	Script      string     `json:"script,omitempty"`
	LastUsageAt *time.Time `json:"last_usage_at,omitempty"`
	CreatedAt   *time.Time `json:"created_at,omitempty"`
	UpdatedAt   *time.Time `json:"updated_at,omitempty"`
}

IncomingWebhook structure definition

type IncomingWebhookCreateForm

type IncomingWebhookCreateForm struct {
	Alias  string
	Token  string
	Script string
}

IncomingWebhookCreateForm structure definition

type IncomingWebhookCreateFormBuilder

type IncomingWebhookCreateFormBuilder struct {
	// contains filtered or unexported fields
}

IncomingWebhookCreateFormBuilder is a builder to create an incoming webhook create form

func NewIncomingWebhookCreateFormBuilder

func NewIncomingWebhookCreateFormBuilder() IncomingWebhookCreateFormBuilder

NewIncomingWebhookCreateFormBuilder creates new incoming webhook builder instance

func (*IncomingWebhookCreateFormBuilder) Alias

Alias set incoming webhook alias

func (*IncomingWebhookCreateFormBuilder) Build

Build creates the incoming webhook

func (*IncomingWebhookCreateFormBuilder) Script

Script set incoming webhook script

type IncomingWebhookUpdateForm

type IncomingWebhookUpdateForm struct {
	ID     uint
	Alias  *string
	Script *string
}

IncomingWebhookUpdateForm structure definition

type OutgoingWebhook

type OutgoingWebhook struct {
	ID        *uint          `json:"id,omitempty"`
	UserID    *uint          `json:"user_id,omitempty"`
	Alias     string         `json:"alias,omitempty"`
	IsDefault bool           `json:"is_default,omitempty"`
	Provider  string         `json:"provider,omitempty"`
	Config    string         `json:"config,omitempty"`
	Secrets   secret.Secrets `json:"-"`
	CreatedAt *time.Time     `json:"created_at,omitempty"`
	UpdatedAt *time.Time     `json:"updated_at,omitempty"`
}

OutgoingWebhook structure definition

type OutgoingWebhookCreateForm

type OutgoingWebhookCreateForm struct {
	Alias     string
	IsDefault bool
	Provider  string
	Config    string
	Secrets   secret.Secrets
}

OutgoingWebhookCreateForm structure definition

type OutgoingWebhookCreateFormBuilder

type OutgoingWebhookCreateFormBuilder struct {
	// contains filtered or unexported fields
}

OutgoingWebhookCreateFormBuilder is a builder to create an outgoing webhook create form

func NewOutgoingWebhookCreateFormBuilder

func NewOutgoingWebhookCreateFormBuilder() OutgoingWebhookCreateFormBuilder

NewOutgoingWebhookCreateFormBuilder creates new outgoing webhook builder instance

func (*OutgoingWebhookCreateFormBuilder) Alias

Alias set alias

func (*OutgoingWebhookCreateFormBuilder) Build

Build creates the outgoing webhook create form

func (*OutgoingWebhookCreateFormBuilder) Config

Config set config

func (*OutgoingWebhookCreateFormBuilder) Dummy

Dummy fill outgoing webhook with test data

func (*OutgoingWebhookCreateFormBuilder) IsDefault

IsDefault set is default

func (*OutgoingWebhookCreateFormBuilder) Provider

Provider set provider

func (*OutgoingWebhookCreateFormBuilder) Secrets

Secrets set secrets

type OutgoingWebhookUpdateForm

type OutgoingWebhookUpdateForm struct {
	ID        uint
	Alias     *string
	IsDefault *bool
	Provider  *string
	Config    *string
	Secrets   *secret.Secrets
}

OutgoingWebhookUpdateForm structure definition

type Properties

type Properties struct {
	Rev             *uint
	VAPIDPublicKey  string
	VAPIDPrivateKey string
	CreatedAt       *time.Time
}

Properties structure definition

type User

type User struct {
	ID          *uint      `json:"id,omitempty"`
	Username    string     `json:"username,omitempty"`
	Enabled     bool       `json:"enabled,omitempty"`
	Plan        string     `json:"plan,omitempty"`
	CustomerID  string     `json:"customer_id,omitempty"`
	LastLoginAt *time.Time `json:"last_login_at,omitempty"`
	CreatedAt   *time.Time `json:"created_at,omitempty"`
	UpdatedAt   *time.Time `json:"updated_at,omitempty"`
}

User structure definition

type UserForm

type UserForm struct {
	ID         uint
	Enabled    *bool
	Plan       *string
	CustomerID *string
}

UserForm structure definition

Jump to

Keyboard shortcuts

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