api

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 2, 2026 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

A JSON API wrapper around the core.Core for multiplatform support. It's not possible to expose any "complex" data types (structs*, arrays, channels, maps, etc.), because they do not have bindings to other languages. Let's use JSON everywhere as a REST API would...

(*) You can return a *Event (pointer to struct), but you cannot receive it as argument.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Api

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

The exposed/exported JSON-only API interface.

func NewApi

func NewApi() *Api

A "constructor" for the JSON API.

func (*Api) CloneCalendar

func (a *Api) CloneCalendar(repoUrl, password string) error

func (*Api) CreateCalendar

func (a *Api) CreateCalendar(name, password string) error

func (a *Api) AddRemote(name, remoteUrl string) error { return a.inner.AddRemote(name, remoteUrl) }

func (*Api) CreateEvent

func (a *Api) CreateEvent(eventJson string) (string, error)

func (*Api) GetEvent

func (a *Api) GetEvent(id string) (string, error)

func (*Api) GetEvents

func (a *Api) GetEvents(from, to string) (string, error)

func (*Api) ListCalendars

func (a *Api) ListCalendars() (string, error)

func (*Api) LoadCalendars

func (a *Api) LoadCalendars() error

func (*Api) PullAll

func (a *Api) PullAll() error

func (*Api) PushAll

func (a *Api) PushAll() error

func (*Api) RemoveCalendar

func (a *Api) RemoveCalendar(name string) error

func (*Api) RemoveEvent

func (a *Api) RemoveEvent(eventJson string) error

func (*Api) RemoveRepeatingEvent

func (a *Api) RemoveRepeatingEvent(eventJson string, strategy int) error

func (*Api) SetCorsProxy

func (a *Api) SetCorsProxy(proxyUrl string) error

func (*Api) UpdateEvent

func (a *Api) UpdateEvent(eventJson string) (string, error)

func (*Api) UpdateRepeatingEvent

func (a *Api) UpdateRepeatingEvent(oldEventJson, newEventJson string, strategy int) (string, error)

type Event

type Event struct {
	Id          string      `json:"id"`
	Title       string      `json:"title"`
	Location    string      `json:"location"`
	Description string      `json:"description"`
	From        string      `json:"from"` // RFC3339 format e.g., 2009-11-10T23:00:00Z (the default format of json.Marshal() for time.Time)
	To          string      `json:"to"`   // RFC3339 format e.g., 2009-11-10T23:00:00Z (the default format of json.Marshal() for time.Time)
	Calendar    string      `json:"calendar"`
	Tag         string      `json:"tag"`
	ParentId    string      `json:"parentId"`
	Repeat      *Repetition `json:"repeat"`
}

A DTO (we love Java) for Kotlin/Swift to use as the event structure.

This event isn't used in Go itself, but serves as a "shape definition" for `gomobile` to bind it into Kotlin/Swift.

type Repetition

type Repetition struct {
	Frequency  int      `json:"frequency"`
	Interval   int      `json:"interval"`
	Until      string   `json:"until"`
	Count      int      `json:"count"`
	Exceptions []string `json:"exceptions"`
}

Jump to

Keyboard shortcuts

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