calendarevents

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package calendarevents reads and writes the phone's calendars directly. To add one event, the calendar plugin is simpler and needs no permission: it opens the system's screen. This is for showing someone's calendar in your app, or keeping it in step with your server.

nimbus native plugin add calendar-events

if ok, _ := calendarevents.Request(ctx); ok {
	id, err := calendarevents.Create(ctx, calendarevents.Event{Title: "Table for two", Start: at})
	week, err := calendarevents.List(ctx, time.Now(), time.Now().AddDate(0, 0, 7))
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(ctx context.Context, e Event) (string, error)

Create adds an event with no screen, so tell them first.

func Delete

func Delete(ctx context.Context, id string) error

Delete removes an event, and every repeat of it.

func DeleteCalendar

func DeleteCalendar(ctx context.Context, id string) error

DeleteCalendar removes a calendar and everything in it.

func NewCalendar

func NewCalendar(ctx context.Context, title string) (string, error)

NewCalendar makes a calendar of your own, kept on the phone: a good home for what your app adds.

func Request

func Request(ctx context.Context) (bool, error)

Request asks to read and write their calendars, once.

func Update

func Update(ctx context.Context, e Event) error

Update replaces an event's details. For a repeating event it changes every time it happens.

Types

type Calendar

type Calendar struct {
	ID       string `json:"id"`       // for Event.CalendarID
	Title    string `json:"title"`    // its name
	Writable bool   `json:"writable"` // whether you can add to it
	Default  bool   `json:"default"`  // where new events go
}

Calendar is one of their calendars.

func Calendars

func Calendars(ctx context.Context) ([]Calendar, error)

Calendars lists them. Call Request first, as with everything here.

type Event

type Event struct {
	ID         string    // set by Create; leave it empty for a new one
	CalendarID string    // empty means the default calendar
	Title      string    // its name
	Location   string    // where; optional
	Notes      string    // more detail; optional
	Start      time.Time // when it starts
	End        time.Time // the Start plus an hour when zero
	AllDay     bool      // it has no time of day
}

Event is something in a calendar. A repeating event comes back once for each time it happens, all with the same ID.

func List

func List(ctx context.Context, from, to time.Time) ([]Event, error)

List gives the events between two times, earliest first.

Jump to

Keyboard shortcuts

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