Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add typespec and typedoc for event #69

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions lib/icalendar.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ defmodule ICalendar do
"""

defstruct events: []

@typedoc """
An ICalendar struct

* `events`: A list of events
"""

@type t :: %__MODULE__{
events: [ICalendar.Event.t()]
}

defdelegate to_ics(events, options \\ []), to: ICalendar.Serialize
defdelegate from_ics(events), to: ICalendar.Deserialize

Expand Down
45 changes: 45 additions & 0 deletions lib/icalendar/event.ex
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,51 @@ defmodule ICalendar.Event do
organizer: nil,
sequence: nil,
attendees: []

@typedoc """
An Event struct

* `summary`: The summary of the event
* `dtstart`: The start time of the event
* `dtend`: The end time of the event
* `rrule`: The recurrence rule
* `exdates`: The exception dates
* `description`: The description of the event
* `location`: The location of the event
* `url`: The URL of the event
* `uid`: The unique identifier of the event
* `prodid`: The product identifier of the event
* `status`: The status of the event
* `categories`: The categories of the event
* `class`: The class of the event
* `comment`: An optional comment
* `geo`: The latitude and longitude of the event
* `modified`: The last modified time of the event
* `organizer`: The organizer of the event
* `sequence`: The sequence number of the event
* `attendees`: The attendees of the event
"""
@type t :: %__MODULE__{
summary: String.t(),
dtstart: DateTime.t(),
dtend: DateTime.t(),
rrule: map(),
exdates: [DateTime.t()],
description: String.t(),
location: String.t(),
url: String.t(),
uid: String.t() | integer(),
prodid: String.t(),
status: String.t(),
categories: [String.t()],
class: String.t(),
comment: String.t(),
geo: {float(), float()},
modified: DateTime.t(),
organizer: String.t(),
sequence: integer(),
attendees: [map()]
}
end

defimpl ICalendar.Serialize, for: ICalendar.Event do
Expand Down