calendar_events

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 9 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CreateCmd = &cobra.Command{
	Use:               "create <mailbox-resource-id> <calendar-uuid>",
	Short:             "Create calendar event",
	Long:              "Create an event in one calendar of the mailbox. `calendarUuid` comes from `listCalendars`: use the calendar with `default` true unless another one is named. A calendar the mailbox can only read is rejected with `403` and code `ERR_EVENT_NOT_EDITABLE`.\nThe mailbox becomes the organizer and every address in `attendees` immediately receives an email invitation, which cannot be recalled. Without attendees no email is sent.\nA timed event needs `allDay` false, `start`, `end` and `timeZone`. An all-day event needs `allDay` true and a `start` date; `end` is optional. Set `recurrenceRule` for a repeating event and `reminder` for an alarm.\nReturns the created event. Its `uuid` is the `eventUuid` for `getCalendarEvent`, `updateCalendarEvent`, `rescheduleCalendarEvent` and `deleteCalendarEvent`.\n\nJSON flags take inline JSON, @file.json, or - to read stdin. Example values:\n\n  --attendees\n    [\n      {\n        \"email\": \"john@example.com\",\n        \"name\": \"John\"\n      }\n    ]\n\n  --recurrencerule\n    {\n      \"byDay\": [\n        {\n          \"day\": \"friday\",\n          \"position\": -1\n        }\n      ],\n      \"byMonth\": [\n        3\n      ],\n      \"byMonthDay\": [\n        15\n      ],\n      \"count\": 10,\n      \"frequency\": \"WEEKLY\",\n      \"interval\": 1,\n      \"until\": \"string\",\n      \"weekStart\": \"monday\"\n    }\n\n  --reminder\n    {\n      \"unit\": \"minutes\",\n      \"value\": 15\n    }",
	Example:           "  hostinger-mail calendar-events create my-mailbox-resource-id 9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d --allday=false --start 2026-09-28T13:00:00+03:00 --title Planning",
	ValidArgsFunction: cobra.NoFileCompletions,
	RunE: func(cmd *cobra.Command, args []string) error {
		args = utils.PromptedArgs(cmd, args)
		body, err := createBody(cmd)
		if err != nil {
			return err
		}
		payload, err := json.Marshal(body)
		if err != nil {
			return err
		}
		call := func(ctx context.Context) ([]byte, int, error) {
			r, err := api.Request().CreateCalendarEventWithBodyWithResponse(ctx, args[0], uuid.MustParse(args[1]), "application/json", bytes.NewReader(payload))
			if err != nil {
				return nil, 0, err
			}
			return r.Body, r.StatusCode(), nil
		}
		respBody, status, err := call(cmd.Context())
		if err != nil {
			return err
		}
		return output.Format(cmd, respBody, status)
	},
}
View Source
var DeleteCmd = &cobra.Command{
	Use:               "delete <mailbox-resource-id> <calendar-uuid> <event-uuid>",
	Short:             "Delete calendar event",
	Long:              "Delete an event, one occurrence of a recurring event, or a recurring event from one occurrence on. This cannot be undone. `calendarUuid` and `eventUuid` come from `listCalendarEvents`.\nFor a one-off event omit `scope` and `recurrenceId`. For a recurring event, `scope` `this` removes only the occurrence at `recurrenceId`, `future` removes it and every later one, `all` (the default) deletes the whole series.\nAn event with `editable` true can be deleted with any scope, and its attendees receive a cancellation or the updated series by email. An invitation from someone else on the own calendar of the mailbox can be deleted with `all` or `this`: the organizer receives a decline for the removed occurrences. Any other event is rejected with `403` and code `ERR_EVENT_NOT_EDITABLE`. `notifyAttendees` false deletes without sending any email.",
	Example:           "  hostinger-mail calendar-events delete my-mailbox-resource-id 9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d 9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
	ValidArgsFunction: cobra.NoFileCompletions,
	RunE: func(cmd *cobra.Command, args []string) error {
		args = utils.PromptedArgs(cmd, args)
		if err := utils.EnumCheck(cmd, "scope", []string{"this", "future", "all"}); err != nil {
			return err
		}
		if err := utils.EnumCheck(cmd, "notifyattendees", []string{"true", "false", "1", "0"}); err != nil {
			return err
		}
		if err := utils.FormatCheck(cmd, "recurrenceid", "date-time"); err != nil {
			return err
		}
		params := deleteParams(cmd)

		if err := utils.Confirm(cmd, "Delete calendar event", args); err != nil {
			return err
		}
		call := func(ctx context.Context) ([]byte, int, error) {
			r, err := api.Request().DeleteCalendarEventWithResponse(ctx, args[0], uuid.MustParse(args[1]), uuid.MustParse(args[2]), params)
			if err != nil {
				return nil, 0, err
			}
			return r.Body, r.StatusCode(), nil
		}
		respBody, status, err := call(cmd.Context())
		if err != nil {
			return err
		}
		return output.Format(cmd, respBody, status)
	},
}
View Source
var GetCmd = &cobra.Command{
	Use:               "get <mailbox-resource-id> <calendar-uuid> <event-uuid>",
	Short:             "Get calendar event",
	Long:              "Retrieve the full details of one event: title, times, description, location, meeting link, recurrence rule, reminder, organizer, attendees with their answers, and its `etag`. `calendarUuid` and `eventUuid` come from `listCalendarEvents` (the `calendarUuid` and `uuid` of an item). For one occurrence of a recurring event pass the `recurrenceId` of the item; without it the whole series is returned and `recurrenceId` is null. A `recurrenceId` that matches no occurrence returns `404`.\nCall it before `updateCalendarEvent`, which replaces every field, so the values that should stay can be sent back. `replyable` true means the mailbox was invited by someone else and can answer with `replyToCalendarEvent`. `editable` true means the event can be changed or moved.",
	Example:           "  hostinger-mail calendar-events get my-mailbox-resource-id 9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d 9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
	ValidArgsFunction: cobra.NoFileCompletions,
	RunE: func(cmd *cobra.Command, args []string) error {
		args = utils.PromptedArgs(cmd, args)
		if err := utils.FormatCheck(cmd, "recurrenceid", "date-time"); err != nil {
			return err
		}
		params := getParams(cmd)
		call := func(ctx context.Context) ([]byte, int, error) {
			r, err := api.Request().GetCalendarEventWithResponse(ctx, args[0], uuid.MustParse(args[1]), uuid.MustParse(args[2]), params)
			if err != nil {
				return nil, 0, err
			}
			return r.Body, r.StatusCode(), nil
		}
		respBody, status, err := call(cmd.Context())
		if err != nil {
			return err
		}
		return output.Format(cmd, respBody, status)
	},
}
View Source
var GroupCmd = &cobra.Command{
	Use:   "calendar-events",
	Short: "Calendar Events commands",
	Args:  cobra.ArbitraryArgs,
	RunE:  utils.GroupRunE,
}
View Source
var ListCmd = &cobra.Command{
	Use:               "list <mailbox-resource-id> <calendar-uuid>",
	Short:             "List calendar events",
	Long:              "List the events of one calendar that overlap a time range. It covers one calendar only: get the calendars from `listCalendars` and call it for each. The range runs from `start` (inclusive) to `end` (exclusive), at most 32 days; for a longer period call it again with the next range. Recurring events are expanded: each occurrence is a separate item with the same `uuid` and its own `recurrenceId`. Results are not paginated.\nItems hold summary fields only. For description, location, attendees and organizer call `getCalendarEvent` with the `calendarUuid`, `uuid` (as `eventUuid`) and `recurrenceId` of the item. Times are in UTC; `timeZone` is the zone the event was created in. `participationStatus` is the answer of the mailbox to an invitation from someone else, null for its own events. `status` CANCELLED means the organizer cancelled the event.",
	Example:           "  hostinger-mail calendar-events list my-mailbox-resource-id 9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d --start 2025-01-31T10:00:00Z --end 2025-01-31T10:00:00Z",
	ValidArgsFunction: cobra.NoFileCompletions,
	RunE: func(cmd *cobra.Command, args []string) error {
		args = utils.PromptedArgs(cmd, args)
		if err := utils.FormatCheck(cmd, "start", "date-time"); err != nil {
			return err
		}
		if err := utils.FormatCheck(cmd, "end", "date-time"); err != nil {
			return err
		}
		params := listParams(cmd)
		call := func(ctx context.Context) ([]byte, int, error) {
			r, err := api.Request().ListCalendarEventsWithResponse(ctx, args[0], uuid.MustParse(args[1]), params)
			if err != nil {
				return nil, 0, err
			}
			return r.Body, r.StatusCode(), nil
		}
		respBody, status, err := call(cmd.Context())
		if err != nil {
			return err
		}
		return output.Format(cmd, respBody, status)
	},
}
View Source
var ReplyToCmd = &cobra.Command{
	Use:               "reply-to <mailbox-resource-id> <calendar-uuid> <event-uuid>",
	Short:             "Reply to calendar event",
	Long:              "Answer an invitation from someone else: accept, decline or tentatively accept. It saves the answer on the event and emails it to the organizer, which cannot be recalled. `calendarUuid` and `eventUuid` come from `listCalendarEvents`.\nIt works only when `getCalendarEvent` returns `replyable` true. An event the mailbox organizes or is not invited to is rejected with `403` and code `ERR_EVENT_NOT_REPLYABLE`, an event the organizer cancelled with `409` and code `ERR_EVENT_CANCELLED`. Send the `recurrenceId` of an item to answer one occurrence of a recurring event, or omit it to answer the whole series. Returns the event with the new `participationStatus`.",
	Example:           "  hostinger-mail calendar-events reply-to my-mailbox-resource-id 9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d 9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d --participationstatus ACCEPTED",
	ValidArgsFunction: cobra.NoFileCompletions,
	RunE: func(cmd *cobra.Command, args []string) error {
		args = utils.PromptedArgs(cmd, args)
		if err := utils.EnumCheck(cmd, "participationstatus", []string{"ACCEPTED", "DECLINED", "TENTATIVE"}); err != nil {
			return err
		}
		params := replyToParams(cmd)
		body, err := replyToBody(cmd)
		if err != nil {
			return err
		}
		payload, err := json.Marshal(body)
		if err != nil {
			return err
		}
		call := func(ctx context.Context) ([]byte, int, error) {
			r, err := api.Request().ReplyToCalendarEventWithBodyWithResponse(ctx, args[0], uuid.MustParse(args[1]), uuid.MustParse(args[2]), params, "application/json", bytes.NewReader(payload))
			if err != nil {
				return nil, 0, err
			}
			return r.Body, r.StatusCode(), nil
		}
		respBody, status, err := call(cmd.Context())
		if err != nil {
			return err
		}
		return output.Format(cmd, respBody, status)
	},
}
View Source
var RescheduleCmd = &cobra.Command{
	Use:               "reschedule <mailbox-resource-id> <calendar-uuid> <event-uuid>",
	Short:             "Reschedule calendar event",
	Long:              "Move an event to another time or change its length, keeping everything else (title, attendees, description and so on) as stored, so the event does not have to be fetched first. To change other fields use `updateCalendarEvent`. `calendarUuid` and `eventUuid` come from `listCalendarEvents`. Only an event with `editable` true can be moved; any other is rejected with `403` and code `ERR_EVENT_NOT_EDITABLE`.\nFor a recurring event, `scope` `this` moves only the occurrence at `recurrenceId`, `future` ends the series before that occurrence and starts a new one with a new `uuid`, `all` (the default) moves the whole series: only the time of day and the length apply and the series keeps the date of its first occurrence.\nAttendees receive an email update unless `notifyAttendees` is false. Returns the moved event, or the moved occurrence for `scope` `this`.",
	Example:           "  hostinger-mail calendar-events reschedule my-mailbox-resource-id 9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d 9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d --allday=false --start 2026-09-28T13:00:00+03:00",
	ValidArgsFunction: cobra.NoFileCompletions,
	RunE: func(cmd *cobra.Command, args []string) error {
		args = utils.PromptedArgs(cmd, args)
		if err := utils.EnumCheck(cmd, "scope", []string{"this", "future", "all"}); err != nil {
			return err
		}
		params := rescheduleParams(cmd)
		body, err := rescheduleBody(cmd)
		if err != nil {
			return err
		}
		payload, err := json.Marshal(body)
		if err != nil {
			return err
		}
		call := func(ctx context.Context) ([]byte, int, error) {
			r, err := api.Request().RescheduleCalendarEventWithBodyWithResponse(ctx, args[0], uuid.MustParse(args[1]), uuid.MustParse(args[2]), params, "application/json", bytes.NewReader(payload))
			if err != nil {
				return nil, 0, err
			}
			return r.Body, r.StatusCode(), nil
		}
		respBody, status, err := call(cmd.Context())
		if err != nil {
			return err
		}
		return output.Format(cmd, respBody, status)
	},
}
View Source
var UpdateCmd = &cobra.Command{
	Use:               "update <mailbox-resource-id> <calendar-uuid> <event-uuid>",
	Short:             "Update calendar event",
	Long:              "Change the details of an event: title, times, description, location, attendees, recurrence and so on. Every field replaces the stored value and an omitted optional field is cleared, so call `getCalendarEvent` first and send back the values that should stay. To only move an event in time, use `rescheduleCalendarEvent`. Only an event with `editable` true can be changed; any other is rejected with `403` and code `ERR_EVENT_NOT_EDITABLE`.\nFor a recurring event, `scope` `this` changes only the occurrence at `recurrenceId`, `future` ends the series before that occurrence and starts a new one with a new `uuid`, `all` (the default) changes the whole series, keeping the date of its first occurrence.\nAttendees receive an email update, added attendees an invitation and removed ones a cancellation, unless `notifyAttendees` is false. Returns the changed event, or the changed occurrence for `scope` `this`.\n\nJSON flags take inline JSON, @file.json, or - to read stdin. Example values:\n\n  --attendees\n    [\n      {\n        \"email\": \"john@example.com\",\n        \"name\": \"John\"\n      }\n    ]\n\n  --recurrencerule\n    {\n      \"byDay\": [\n        {\n          \"day\": \"friday\",\n          \"position\": -1\n        }\n      ],\n      \"byMonth\": [\n        3\n      ],\n      \"byMonthDay\": [\n        15\n      ],\n      \"count\": 10,\n      \"frequency\": \"WEEKLY\",\n      \"interval\": 1,\n      \"until\": \"string\",\n      \"weekStart\": \"monday\"\n    }\n\n  --reminder\n    {\n      \"unit\": \"minutes\",\n      \"value\": 15\n    }",
	Example:           "  hostinger-mail calendar-events update my-mailbox-resource-id 9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d 9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d --allday=false --start 2026-09-28T13:00:00+03:00 --title Planning",
	ValidArgsFunction: cobra.NoFileCompletions,
	RunE: func(cmd *cobra.Command, args []string) error {
		args = utils.PromptedArgs(cmd, args)
		if err := utils.EnumCheck(cmd, "scope", []string{"this", "future", "all"}); err != nil {
			return err
		}
		params := updateParams(cmd)
		body, err := updateBody(cmd)
		if err != nil {
			return err
		}
		payload, err := json.Marshal(body)
		if err != nil {
			return err
		}
		call := func(ctx context.Context) ([]byte, int, error) {
			r, err := api.Request().UpdateCalendarEventWithBodyWithResponse(ctx, args[0], uuid.MustParse(args[1]), uuid.MustParse(args[2]), params, "application/json", bytes.NewReader(payload))
			if err != nil {
				return nil, 0, err
			}
			return r.Body, r.StatusCode(), nil
		}
		respBody, status, err := call(cmd.Context())
		if err != nil {
			return err
		}
		return output.Format(cmd, respBody, status)
	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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