update
This commit is contained in:
@@ -5,7 +5,10 @@
|
||||
// actually lives.
|
||||
package accounts
|
||||
|
||||
import "context"
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Folder struct {
|
||||
ID string `json:"id"` // provider-native folder identifier (IMAP mailbox name, etc.)
|
||||
@@ -65,3 +68,41 @@ type MailProvider interface {
|
||||
Delete(ctx context.Context, folderID, messageID string) error
|
||||
Sync(ctx context.Context, since string) (*SyncResult, error)
|
||||
}
|
||||
|
||||
// CalendarEvent and Contact are read-only views onto a linked account's
|
||||
// own calendar/contacts, native-API only (Gmail Calendar API + Google
|
||||
// People API, Microsoft Graph) — there is no IMAP-equivalent fallback for
|
||||
// these, unlike mail. Local calendars/contacts are unaffected: they keep
|
||||
// being served by internal/dav's CalDAV/CardDAV server, entirely separate
|
||||
// from this.
|
||||
type CalendarEvent struct {
|
||||
ID string `json:"id"`
|
||||
Summary string `json:"summary"`
|
||||
Location string `json:"location"`
|
||||
Description string `json:"description"`
|
||||
Start time.Time `json:"start"`
|
||||
End time.Time `json:"end"`
|
||||
AllDay bool `json:"all_day"`
|
||||
}
|
||||
|
||||
type Contact struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Emails []string `json:"emails"`
|
||||
Phones []string `json:"phones"`
|
||||
}
|
||||
|
||||
// CalendarProvider and ContactProvider are deliberately separate from
|
||||
// MailProvider — GoMailProvider (local calendar/contacts already exist
|
||||
// via CalDAV/CardDAV) and IMAPProvider (generic IMAP has no calendar/
|
||||
// contacts concept at all) don't implement either. Callers type-assert
|
||||
// (`p, ok := provider.(CalendarProvider)`) and report "not supported"
|
||||
// rather than a fake empty result — see internal/webmail/api.go's
|
||||
// calendarEvents/contacts handlers.
|
||||
type CalendarProvider interface {
|
||||
ListEvents(ctx context.Context, from, to time.Time) ([]CalendarEvent, error)
|
||||
}
|
||||
|
||||
type ContactProvider interface {
|
||||
ListContacts(ctx context.Context) ([]Contact, error)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user