Documentation ¶
Index ¶
- type CalendarSubscription
- type Store
- func (s *Store) Authorize(ctx context.Context, tok authtoken.Token) (context.Context, error)
- func (s *Store) CreateTx(ctx context.Context, tx *sql.Tx, cs *CalendarSubscription) (*CalendarSubscription, error)
- func (s *Store) DeleteTx(ctx context.Context, tx *sql.Tx, userID string, ids ...string) error
- func (s *Store) FindAllByUser(ctx context.Context, userID string) ([]CalendarSubscription, error)
- func (s *Store) FindOne(ctx context.Context, id string) (*CalendarSubscription, error)
- func (s *Store) FindOneForUpdateTx(ctx context.Context, tx *sql.Tx, userID, id string) (*CalendarSubscription, error)
- func (s *Store) ServeICalData(w http.ResponseWriter, req *http.Request)
- func (s *Store) UpdateTx(ctx context.Context, tx *sql.Tx, cs *CalendarSubscription) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CalendarSubscription ¶
type CalendarSubscription struct { ID string Name string UserID string ScheduleID string LastAccess time.Time Disabled bool // Config provides necessary parameters CalendarSubscription Config (i.e. ReminderMinutes) Config struct { ReminderMinutes []int } // contains filtered or unexported fields }
CalendarSubscription stores the information from user subscriptions
func (CalendarSubscription) Normalize ¶
func (cs CalendarSubscription) Normalize() (*CalendarSubscription, error)
Normalize will validate and produce a normalized CalendarSubscription struct.
func (CalendarSubscription) Token ¶
func (cs CalendarSubscription) Token() string
Token returns the authorization token associated with this CalendarSubscription. It is only available when calling CreateTx.
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 ¶
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 *CalendarSubscription) (*CalendarSubscription, error)
CreateTx will return a created calendar subscription with the given input.
func (*Store) DeleteTx ¶
DeleteTx removes calendar subscriptions with the given ids for the given user.
func (*Store) FindAllByUser ¶
FindAllByUser returns all calendar subscriptions of a user.
func (*Store) FindOneForUpdateTx ¶
func (s *Store) FindOneForUpdateTx(ctx context.Context, tx *sql.Tx, userID, id string) (*CalendarSubscription, error)
FindOneForUpdateTx will return a CalendarSubscription for the given userID that is locked for updating.
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.