Calendar sharing (access control rules): list, share with a user, group, domain or everyone, and remove a rule.

Roles: freeBusyReader (free/busy only), reader, writer, owner (none removes access). Scope types: user, group (email), domain (a domain name), default (public).

Scopes. Listing uses calendar.acls.readonly; sharing and removing calendar.acls (calendar also works).

Values

ROLES

ROLES: Vec [
  "none",
  "freeBusyReader",
  "reader",
  "writer",
  "owner"
]

SCOPE_TYPES

SCOPE_TYPES: Vec [
  "default",
  "user",
  "group",
  "domain"
]

Functions

build-rule

fn (role: Str, scope-type: Str, value: Str?): Map

An AclRule body (pure): {role, scope: {type, value?}}; value is omitted for default. An Err for an unknown role or scope type, or a missing value.

delete-rule

fn (calendar-id: Str, rule-id: Str): Bool
fn (calendar-id: Str, rule-id: Str, opts: Map): Bool

DELETE /calendars/{id}/acl/{ruleId} - remove a rule (rule ids look like user:ada@example.com). Returns true. Scope: calendar.acls.

insert-rule

fn (calendar-id: Str, role: Str, scope-type: Str, value: Str?): Map
fn (calendar-id: Str, role: Str, scope-type: Str, value: Str?, opts: Map): Map

POST /calendars/{id}/acl - add a rule (see build-rule). Options: sendNotifications (default true: the grantee is emailed). Returns the rule with its id. Scope: calendar.acls.

list-acl

fn (calendar-id: Str): Map
fn (calendar-id: Str, opts: Map): Map

GET /calendars/{id}/acl - one page of rules: {items: [{id, role, scope: {type, value}}], nextPageToken?, nextSyncToken?}. Options: maxResults, pageToken, showDeleted, syncToken. Scope: calendar.acls.readonly.

list-all-acl

fn (calendar-id: Str): Vec
fn (calendar-id: Str, opts: Map): Vec

Every rule on a calendar (all pages). Scope: calendar.acls.readonly.

share-calendar

fn (calendar-id: Str, email: Str, role: Str): Map
fn (calendar-id: Str, email: Str, role: Str, opts: Map): Map

Share a calendar with one person: share-calendar("team@group.calendar.google.com", "ada@example.com", "reader"). Scope: calendar.acls.