ics

package
v0.14.2 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2025 License: GPL-2.0 Imports: 8 Imported by: 0

Documentation

Overview

*

  • @license
  • Copyright (C) 2018 Dinko Korunic, InfoMAR *
  • This program is free software; you can redistribute it and/or modify it
  • under the terms of the GNU General Public License as published by the
  • Free Software Foundation; either version 2 of the License, or (at your
  • option) any later version. *
  • This program is distributed in the hope that it will be useful, but
  • WITHOUT ANY WARRANTY; without even the implied warranty of
  • MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  • General Public License for more details. *
  • You should have received a copy of the GNU General Public License along
  • with this program; if not, write to the Free Software Foundation, Inc.,
  • 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

Index

Constants

View Source
const (
	// URL is a country-local holiday calendar in ICS format.
	URL = "https://www.officeholidays.com/ics/ics_country_iso.php?tbl_country=%s"

	// DefaultTimeout is a default ICS fetch HTTP timeout.
	DefaultTimeout = 10 * time.Second
)

Variables

View Source
var ErrNilBody = errors.New("client body is nil")

Functions

This section is empty.

Types

type Client added in v0.7.0

type Client struct {
	URL *url.URL
	// contains filtered or unexported fields
}

Client is an ICS HTTP client for remote fetching/parsing ICS calendar.

func NewClient added in v0.7.0

func NewClient(countryCode string) (*Client, error)

NewClient creates a HTTP client structure for ICS fetch/parse.

func NewClientWithContext added in v0.7.0

func NewClientWithContext(ctx context.Context, countryCode string) (*Client, error)

NewClientWithContext creates a HTTP client structure for ICS fetch/parse with ctx Context.

func (*Client) GetResponse added in v0.7.0

func (c *Client) GetResponse() (Events, error)

GetResponse fetches a HTTP response from officeholldays site with country-local ICS as a body.

type Event added in v0.7.0

type Event struct {
	Start, End  time.Time
	ID, Summary string
}

Event is an individual parsed ICS event for ICS decoder.

type Events added in v0.7.0

type Events []Event

Events is a collection of parsed ICS events from ICS decoder.

func (*Events) ConsumeICal added in v0.7.0

func (e *Events) ConsumeICal(c *goics.Calendar, _ error) error

ConsumeICal consumes/parses an individual ICS event into an Event structure.

Jump to

Keyboard shortcuts

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