koyomi

package module
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2023 License: MIT Imports: 19 Imported by: 0

README

koyomi

CI Status MIT License

Koyomi is a simple schedule client for Google Calendar.

Usage

Usage: koyomi <command>

Flags:
  -h, --help                            Show context-sensitive help.
      --credential="credential.json"    JSON credential file for access to calendar
      --loglevel="INFO"                 Logging level: DEBUG, INFO, WARN, ERROR
  -v, --version                         Show Version

Commands:
  list --calendar-id=STRING --start-time=STRING --end-time=STRING
    List events

  create --calendar-id=STRING --start-time=STRING --end-time=STRING
    Creates an event

  update --calendar-id=STRING --id=STRING
    Updates an event

  delete --calendar-id=STRING --id=STRING
    Deletes an event
List Events
Usage: koyomi list --calendar-id=STRING --start-time=STRING --end-time=STRING

List events

Flags:
      --calendar-id=STRING              Calendar identifier
  -s, --start-time=STRING               The start time of the event
  -e, --end-time=STRING                 The end time of the event
Creates an Event
Usage: koyomi create --calendar-id=STRING --start-time=STRING --end-time=STRING

Creates an event

Flags:
      --calendar-id=STRING              Calendar identifier
      --summary=STRING                  Title of the event
      --description=STRING              Descriptuon of the event
  -s, --start-time=STRING               The start time of the event
  -e, --end-time=STRING                 The end time of the event
Updates an Event
Usage: koyomi update --calendar-id=STRING --id=STRING

Updates an event

Flags:
      --calendar-id=STRING              Calendar identifier
      --id=STRING                       Identifier of the event
      --summary=STRING                  Title of the event
      --description=STRING              Description of the event
  -s, --start-time=STRING               The start time of the event
  -e, --end-time=STRING                 The end time of the event
Deletes an Event
Usage: koyomi delete --calendar-id=STRING --id=STRING

Deletes an event

Flags:
      --calendar-id=STRING              Calendar identifier
      --id=STRING                       Identifier of the event

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Version string
)

Functions

func Run

func Run(ctx context.Context, args []string) error

Types

type CLIOptions

type CLIOptions struct {
	List           *ListOption      `cmd:"" help:"List events"`
	Create         *CreateOption    `cmd:"" help:"Creates an event"`
	Update         *UpdateOption    `cmd:"" help:"Updates an event"`
	Delete         *DeleteOption    `cmd:"" help:"Deletes an event"`
	CredentialPath string           `name:"credential" help:"JSON credential file for access to calendar" default:"credential.json"`
	LogLevel       string           `name:"loglevel" help:"Logging level: DEBUG, INFO, WARN, ERROR" enum:"DEBUG,INFO,WARN,ERROR" default:"INFO"`
	Version        kong.VersionFlag `short:"v" help:"Show Version"`
}

type CalendarService

type CalendarService interface {
	List(ctx context.Context, calendarID string, startTime, endTime time.Time) ([]*Event, error)
	Insert(ctx context.Context, calendarID string, event *Event) (*Event, error)
	Update(ctx context.Context, calendarID string, event *Event) (*Event, error)
	Delete(ctx context.Context, calendarID, eventID string) error
}

type CreateOption

type CreateOption struct {
	CalendarID  string `required:"" help:"Calendar identifier"`
	Summary     string `help:"Title of the event"`
	Description string `help:"Descriptuon of the event"`
	StartTime   string `help:"The start time of the event" short:"s"`
	EndTime     string `help:"The end time of the event" short:"e"`
}

type DeleteOption

type DeleteOption struct {
	CalendarID string `required:"" help:"Calendar identifier"`
	ID         string `required:"" help:"Identifier of the event"`
}

type Event added in v0.1.0

type Event struct {
	ID          string    `json:"id"`
	Summary     string    `json:"summary"`
	Description string    `json:"description"`
	StartTime   time.Time `json:"start_time"`
	EndTime     time.Time `json:"end_time"`
}

type Koyomi

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

func New

func New(ctx context.Context, credentialPath string) (*Koyomi, error)

func (*Koyomi) Create

func (k *Koyomi) Create(ctx context.Context, opt *CreateOption) error

func (*Koyomi) Delete

func (k *Koyomi) Delete(ctx context.Context, opt *DeleteOption) error

func (*Koyomi) Dispatch

func (k *Koyomi) Dispatch(ctx context.Context, command string, opts *CLIOptions) error

func (*Koyomi) List

func (k *Koyomi) List(ctx context.Context, opt *ListOption) error

func (*Koyomi) Update

func (k *Koyomi) Update(ctx context.Context, opt *UpdateOption) error

type ListOption

type ListOption struct {
	CalendarID string `required:"" help:"Calendar identifier"`
	StartTime  string `required:"" help:"The start time of the event" short:"s"`
	EndTime    string `required:"" help:"The end time of the event" short:"e"`
}

type UpdateOption

type UpdateOption struct {
	CalendarID  string `required:"" help:"Calendar identifier"`
	ID          string `required:"" help:"Identifier of the event"`
	Summary     string `help:"Title of the event"`
	Description string `help:"Description of the event"`
	StartTime   string `help:"The start time of the event" short:"s"`
	EndTime     string `help:"The end time of the event" short:"e"`
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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