← All procedures

ics.write

Write an iCalendar text from events: escaped text, folded lines and CRLF line ends

CLI
Package
@procedures/ics · README
Path
["ics","write"]
CLI
mark ics write --events <object[]>
As data
{"$proc":["ics","write"],"input":{}}

Use it

In TypeScript

import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/ics/register"; // registers its procedures

const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["ics","write"], { events: [] });
console.log(JSON.stringify(result));

From the command line

$ mark ics write --events <object[]>

As data, in a program

{ "$proc": ["ics", "write"], "input": { "events": [] } }

Input

FieldTypeRequiredDefaultDescription
eventsobject[]yesThe events (VEVENT) of the calendar
prodIdstringnoThe PRODID (default: -//procedures//ics//EN)
methodstringnoThe METHOD, for example PUBLISH or CANCEL
calscalestringnoThe CALSCALE, for example GREGORIAN
calendarNamestringnoThe name of the calendar (X-WR-CALNAME)
stampstringnoThe DTSTAMP of each event (ISO 8601). The default is the current time

Output

FieldTypeRequiredDefaultDescription
textstringyesThe iCalendar text, with CRLF line ends and folded lines
JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "events": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "uid": {
              "type": "string",
              "minLength": 1,
              "description": "The UID. Keep it stable across exports"
            },
            "start": {
              "type": "string",
              "description": "The start (ISO 8601). For an all-day event, the date part is the date"
            },
            "end": {
              "description": "The end (ISO 8601). For an all-day event, the end date is exclusive",
              "type": "string"
            },
            "allDay": {
              "description": "True for an all-day event (VALUE=DATE)",
              "type": "boolean"
            },
            "summary": {
              "description": "The title",
              "type": "string"
            },
            "location": {
              "description": "The place",
              "type": "string"
            },
            "description": {
              "description": "The notes",
              "type": "string"
            },
            "url": {
              "description": "A link",
              "type": "string",
              "format": "uri"
            },
            "sequence": {
              "description": "The SEQUENCE: it increases at each change of the event",
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "status": {
              "description": "The STATUS. CANCELLED removes the event at the next import",
              "type": "string",
              "enum": [
                "TENTATIVE",
                "CONFIRMED",
                "CANCELLED"
              ]
            },
            "rrule": {
              "description": "The recurrence rule without RRULE:, for example FREQ=YEARLY",
              "type": "string",
              "pattern": "^[A-Za-z0-9=;,+-]+$"
            },
            "exdates": {
              "description": "The dates (YYYY-MM-DD) that the recurrence skips, in the zone of tzid",
              "type": "array",
              "items": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              }
            },
            "tzid": {
              "description": "The IANA zone of the event. The writer writes each EXDATE in this zone",
              "type": "string",
              "minLength": 1
            }
          },
          "required": [
            "uid",
            "start"
          ]
        },
        "description": "The events (VEVENT) of the calendar"
      },
      "prodId": {
        "description": "The PRODID (default: -//procedures//ics//EN)",
        "type": "string",
        "minLength": 1
      },
      "method": {
        "description": "The METHOD, for example PUBLISH or CANCEL",
        "type": "string",
        "pattern": "^[A-Za-z0-9-]+$"
      },
      "calscale": {
        "description": "The CALSCALE, for example GREGORIAN",
        "type": "string",
        "pattern": "^[A-Za-z0-9-]+$"
      },
      "calendarName": {
        "description": "The name of the calendar (X-WR-CALNAME)",
        "type": "string"
      },
      "stamp": {
        "description": "The DTSTAMP of each event (ISO 8601). The default is the current time",
        "type": "string"
      }
    },
    "required": [
      "events"
    ]
  },
  "output": {
    "type": "object",
    "properties": {
      "text": {
        "type": "string",
        "description": "The iCalendar text, with CRLF line ends and folded lines"
      }
    },
    "required": [
      "text"
    ],
    "additionalProperties": false
  }
}