calsub

package
v0.30.0 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2022 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

Store allows the lookup and management of calendar subscriptions

func NewStore

func NewStore(ctx context.Context, db *sql.DB, apiKeyring keyring.Keyring, oc *oncall.Store) (*Store, error)

NewStore will create a new Store with the given parameters.

func (*Store) Authorize

func (s *Store) Authorize(ctx context.Context, tok authtoken.Token) (context.Context, error)

Authorize will return an authorized context associated with the given token. If the token is invalid or otherwise can not be authenticated, an error is returned.

func (*Store) CreateTx

func (s *Store) CreateTx(ctx context.Context, tx *sql.Tx, cs *Subscription) (*Subscription, error)

CreateTx will return a created calendar subscription with the given input.

func (*Store) DeleteTx

func (s *Store) DeleteTx(ctx context.Context, tx *sql.Tx, userID string, ids ...string) error

DeleteTx removes calendar subscriptions with the given ids for the given user.

func (*Store) FindAllByUser

func (s *Store) FindAllByUser(ctx context.Context, userID string) ([]Subscription, error)

FindAllByUser returns all calendar subscriptions of a user.

func (*Store) FindOne

func (s *Store) FindOne(ctx context.Context, id string) (*Subscription, error)

FindOne will return a single calendar subscription for the given id.

func (*Store) ServeICalData

func (s *Store) ServeICalData(w http.ResponseWriter, req *http.Request)

ServeICalData will return an iCal file for the subscription associated with the current request.

type Subscription

type Subscription struct {
	ID         string `gorm:"<-:create"`
	Name       string
	UserID     string    `gorm:"<-:create"`
	ScheduleID string    `gorm:"<-:create"`
	LastUpdate time.Time `gorm:"autoUpdateTime"`
	LastAccess time.Time `gorm:"<-:create"`
	Disabled   bool

	// Config provides necessary parameters CalendarSubscription Config (i.e. ReminderMinutes)
	Config SubscriptionConfig
	// contains filtered or unexported fields
}

Subscription stores the information from user subscriptions

func (*Subscription) BeforeUpdate

func (cs *Subscription) BeforeUpdate(db *gorm.DB) error

func (Subscription) Normalize

func (cs Subscription) Normalize() (*Subscription, error)

Normalize will validate and produce a normalized CalendarSubscription struct.

func (Subscription) TableName

func (Subscription) TableName() string

func (Subscription) Token

func (cs Subscription) Token() string

Token returns the authorization token associated with this CalendarSubscription. It is only available when calling CreateTx.

type SubscriptionConfig

type SubscriptionConfig struct {
	ReminderMinutes []int
}

SubscriptionConfig is the configuration for a calendar subscription.

func (*SubscriptionConfig) Scan

func (scfg *SubscriptionConfig) Scan(v interface{}) error

func (SubscriptionConfig) Value

func (scfg SubscriptionConfig) Value() (driver.Value, error)

Jump to

Keyboard shortcuts

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