implemented ical exports
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
@@ -38,9 +38,10 @@ public interface Appointment {
|
||||
|
||||
/**
|
||||
* represent this event as ical entry
|
||||
* @param calendarIdentifier used to generate a unique id. pass something that is unique, but stable over time, e.g. a hostname
|
||||
* @return the ical string
|
||||
*/
|
||||
String ical();
|
||||
String ical(String calendarIdentifier);
|
||||
|
||||
/**
|
||||
* ID of the appointment – unique within this system
|
||||
|
||||
@@ -10,6 +10,18 @@ import org.json.JSONObject;
|
||||
* @param latitude the latitude
|
||||
*/
|
||||
public record Coords(double longitude, double latitude) {
|
||||
/**
|
||||
* get a string representing this coords in the ICAL format, see <a href="https://datatracker.ietf.org/doc/html/rfc5545#section-3.8.1.6">iCalendar spec</a>
|
||||
* @return the formatted coords
|
||||
*/
|
||||
public String icalFormat(){
|
||||
return "%s;%s".formatted(latitude,longitude);
|
||||
}
|
||||
|
||||
/**
|
||||
* create a JSON object containing lat and lon of this coordinate
|
||||
* @return the json object
|
||||
*/
|
||||
public JSONObject json() {
|
||||
return new JSONObject(Map.of("lon", longitude, "lat", latitude));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user