Documentation
¶
Index ¶
- Constants
- type JSONResponseV1
- type JSONShiftV1
- 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 *Subscription) (*Subscription, 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) ([]Subscription, error)
- func (s *Store) FindOne(ctx context.Context, id string) (*Subscription, error)
- func (s *Store) FindOneForUpdate(ctx context.Context, tx *sql.Tx, id string) (*Subscription, error)
- func (s *Store) ServeICalData(w http.ResponseWriter, req *http.Request)
- func (s *Store) UpdateTx(ctx context.Context, tx *sql.Tx, cs *Subscription) error
- type Subscription
- type SubscriptionConfig
Constants ¶
const PayloadType = "calendar-subscription/v1"
PayloadType is the embedded type & version for calendar subscription payloads.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JSONResponseV1 ¶ added in v0.34.0
type JSONResponseV1 struct {
AppName string
AppVersion string
// Type is the embedded type & version for calendar subscription payloads and should be set to PayloadType.
Type string
ScheduleID uuid.UUID
ScheduleName string
ScheduleURL string
Start, End time.Time
Shifts []JSONShiftV1
}
JSONResponseV1 is the JSON response format for calendar subscription requests.
type JSONShiftV1 ¶ added in v0.34.0
type JSONShiftV1 struct {
Start, End time.Time
UserID uuid.UUID
UserName string
UserURL string
Truncated bool
}
JSONShiftV1 is the JSON response format for a shift in a calendar subscription.
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 *Subscription) (*Subscription, 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) FindOneForUpdate ¶ added in v0.31.0
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
Name string
UserID string
ScheduleID string
LastUpdate time.Time
LastAccess time.Time
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) Normalize ¶
func (cs Subscription) Normalize() (*Subscription, error)
Normalize will validate and produce a normalized CalendarSubscription struct.
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 ¶
SubscriptionConfig is the configuration for a calendar subscription.
func (*SubscriptionConfig) Scan ¶
func (scfg *SubscriptionConfig) Scan(v interface{}) error