0.0.20241025 • Published 9 months ago

@maxim_mazurok/gapi.client.calendar-v3 v0.0.20241025

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

TypeScript typings for Calendar API v3

Manipulates events and other calendar data. For detailed description please check documentation.

Installing

Install typings for Calendar API:

npm install @types/gapi.client.calendar-v3 --save-dev

Usage

You need to initialize Google API client in your code:

gapi.load('client', () => {
  // now we can use gapi.client
  // ...
});

Then load api client wrapper:

gapi.client.load(
  'https://calendar-json.googleapis.com/$discovery/rest?version=v3',
  () => {
    // now we can use:
    // gapi.client.calendar
  }
);
// Deprecated, use discovery document URL, see https://github.com/google/google-api-javascript-client/blob/master/docs/reference.md#----gapiclientloadname----version----callback--
gapi.client.load('calendar', 'v3', () => {
  // now we can use:
  // gapi.client.calendar
});

Don't forget to authenticate your client before sending any request to resources:

// declare client_id registered in Google Developers Console
var client_id = '',
  scope = [
    // See, edit, share, and permanently delete all the calendars you can access using Google Calendar
    'https://www.googleapis.com/auth/calendar',

    // View and edit events on all your calendars
    'https://www.googleapis.com/auth/calendar.events',

    // View events on all your calendars
    'https://www.googleapis.com/auth/calendar.events.readonly',

    // See and download any calendar you can access using your Google Calendar
    'https://www.googleapis.com/auth/calendar.readonly',

    // View your Calendar settings
    'https://www.googleapis.com/auth/calendar.settings.readonly',
  ],
  immediate = true;
// ...

gapi.auth.authorize(
  {client_id: client_id, scope: scope, immediate: immediate},
  authResult => {
    if (authResult && !authResult.error) {
      /* handle successful authorization */
    } else {
      /* handle authorization error */
    }
  }
);

After that you can use Calendar API resources:

/*
Deletes an access control rule.
*/
await gapi.client.calendar.acl.delete({
  calendarId: 'calendarId',
  ruleId: 'ruleId',
});

/*
Returns an access control rule.
*/
await gapi.client.calendar.acl.get({
  calendarId: 'calendarId',
  ruleId: 'ruleId',
});

/*
Creates an access control rule.
*/
await gapi.client.calendar.acl.insert({calendarId: 'calendarId'});

/*
Returns the rules in the access control list for the calendar.
*/
await gapi.client.calendar.acl.list({calendarId: 'calendarId'});

/*
Updates an access control rule. This method supports patch semantics.
*/
await gapi.client.calendar.acl.patch({
  calendarId: 'calendarId',
  ruleId: 'ruleId',
});

/*
Updates an access control rule.
*/
await gapi.client.calendar.acl.update({
  calendarId: 'calendarId',
  ruleId: 'ruleId',
});

/*
Watch for changes to ACL resources.
*/
await gapi.client.calendar.acl.watch({calendarId: 'calendarId'});

/*
Removes a calendar from the user's calendar list.
*/
await gapi.client.calendar.calendarList.delete({calendarId: 'calendarId'});

/*
Returns a calendar from the user's calendar list.
*/
await gapi.client.calendar.calendarList.get({calendarId: 'calendarId'});

/*
Inserts an existing calendar into the user's calendar list.
*/
await gapi.client.calendar.calendarList.insert({});

/*
Returns the calendars on the user's calendar list.
*/
await gapi.client.calendar.calendarList.list({});

/*
Updates an existing calendar on the user's calendar list. This method supports patch semantics.
*/
await gapi.client.calendar.calendarList.patch({calendarId: 'calendarId'});

/*
Updates an existing calendar on the user's calendar list.
*/
await gapi.client.calendar.calendarList.update({calendarId: 'calendarId'});

/*
Watch for changes to CalendarList resources.
*/
await gapi.client.calendar.calendarList.watch({});

/*
Clears a primary calendar. This operation deletes all events associated with the primary calendar of an account.
*/
await gapi.client.calendar.calendars.clear({calendarId: 'calendarId'});

/*
Deletes a secondary calendar. Use calendars.clear for clearing all events on primary calendars.
*/
await gapi.client.calendar.calendars.delete({calendarId: 'calendarId'});

/*
Returns metadata for a calendar.
*/
await gapi.client.calendar.calendars.get({calendarId: 'calendarId'});

/*
Creates a secondary calendar.
*/
await gapi.client.calendar.calendars.insert({});

/*
Updates metadata for a calendar. This method supports patch semantics.
*/
await gapi.client.calendar.calendars.patch({calendarId: 'calendarId'});

/*
Updates metadata for a calendar.
*/
await gapi.client.calendar.calendars.update({calendarId: 'calendarId'});

/*
Stop watching resources through this channel
*/
await gapi.client.calendar.channels.stop({});

/*
Returns the color definitions for calendars and events.
*/
await gapi.client.calendar.colors.get({});

/*
Deletes an event.
*/
await gapi.client.calendar.events.delete({
  calendarId: 'calendarId',
  eventId: 'eventId',
});

/*
Returns an event based on its Google Calendar ID. To retrieve an event using its iCalendar ID, call the events.list method using the iCalUID parameter.
*/
await gapi.client.calendar.events.get({
  calendarId: 'calendarId',
  eventId: 'eventId',
});

/*
Imports an event. This operation is used to add a private copy of an existing event to a calendar. Only events with an eventType of default may be imported.
Deprecated behavior: If a non-default event is imported, its type will be changed to default and any event-type-specific properties it may have will be dropped.
*/
await gapi.client.calendar.events.import({calendarId: 'calendarId'});

/*
Creates an event.
*/
await gapi.client.calendar.events.insert({calendarId: 'calendarId'});

/*
Returns instances of the specified recurring event.
*/
await gapi.client.calendar.events.instances({
  calendarId: 'calendarId',
  eventId: 'eventId',
});

/*
Returns events on the specified calendar.
*/
await gapi.client.calendar.events.list({calendarId: 'calendarId'});

/*
Moves an event to another calendar, i.e. changes an event's organizer. Note that only default events can be moved; birthday, focusTime, fromGmail, outOfOffice and workingLocation events cannot be moved.
*/
await gapi.client.calendar.events.move({
  calendarId: 'calendarId',
  destination: 'destination',
  eventId: 'eventId',
});

/*
Updates an event. This method supports patch semantics.
*/
await gapi.client.calendar.events.patch({
  calendarId: 'calendarId',
  eventId: 'eventId',
});

/*
Creates an event based on a simple text string.
*/
await gapi.client.calendar.events.quickAdd({
  calendarId: 'calendarId',
  text: 'text',
});

/*
Updates an event.
*/
await gapi.client.calendar.events.update({
  calendarId: 'calendarId',
  eventId: 'eventId',
});

/*
Watch for changes to Events resources.
*/
await gapi.client.calendar.events.watch({calendarId: 'calendarId'});

/*
Returns free/busy information for a set of calendars.
*/
await gapi.client.calendar.freebusy.query({});

/*
Returns a single user setting.
*/
await gapi.client.calendar.settings.get({setting: 'setting'});

/*
Returns all user settings for the authenticated user.
*/
await gapi.client.calendar.settings.list({});

/*
Watch for changes to Settings resources.
*/
await gapi.client.calendar.settings.watch({});
0.0.20241025

9 months ago

0.0.20241016

9 months ago

0.0.20241011

9 months ago

0.0.20240927

10 months ago

0.0.20240920

10 months ago

0.0.20240906

10 months ago

0.0.20240823

11 months ago

0.0.20240531

1 year ago

0.0.20240809

11 months ago

0.0.20240607

1 year ago

0.0.20240806

11 months ago

0.0.20240726

12 months ago

0.0.20240523

1 year ago

0.0.20240816

11 months ago

0.0.20240614

1 year ago

0.0.20240705

1 year ago

0.0.20240621

1 year ago

0.0.20240712

12 months ago

0.0.20240517

1 year ago

0.0.20240425

1 year ago

0.0.20240419

1 year ago

0.0.20240412

1 year ago

0.0.20240405

1 year ago

0.0.20240328

1 year ago

0.0.20240322

1 year ago

0.0.20240314

1 year ago

0.0.20240308

1 year ago

0.0.20240223

1 year ago

0.0.20240216

1 year ago

0.0.20240208

1 year ago

0.0.20240201

1 year ago

0.0.20240125

1 year ago

0.0.20240121

1 year ago

0.0.20240111

1 year ago

0.0.20231215

2 years ago

0.0.20231208

2 years ago

0.0.20231201

2 years ago

0.0.20231107

2 years ago

0.0.20230929

2 years ago

0.0.20230728

2 years ago

0.0.20230721

2 years ago

0.0.20230925

2 years ago

0.0.20230804

2 years ago

0.0.20230802

2 years ago

0.0.20231020

2 years ago

0.0.20231102

2 years ago

0.0.20231027

2 years ago

0.0.20230915

2 years ago

0.0.20231006

2 years ago

0.0.20230714

2 years ago

0.0.20230907

2 years ago

0.0.20230707

2 years ago

0.0.20231116

2 years ago

0.0.20230825

2 years ago

0.0.20230901

2 years ago

0.0.20230630

2 years ago

0.0.20231123

2 years ago

0.0.20230623

2 years ago

0.0.20230519

2 years ago

0.0.20230512

2 years ago

0.0.20230616

2 years ago

0.0.20230609

2 years ago

0.0.20230602

2 years ago

0.0.20230428

2 years ago

0.0.20230414

2 years ago

0.0.20230313

2 years ago

0.0.20230419

2 years ago

0.0.20230317

2 years ago

0.0.20230324

2 years ago

0.0.20230303

2 years ago

0.0.20230226

2 years ago

0.0.20230406

2 years ago

0.0.20230331

2 years ago

0.0.20230203

2 years ago

0.0.20230127

2 years ago

0.0.20230210

2 years ago

0.0.20230106

3 years ago

0.0.20221104

3 years ago

0.0.20221114

3 years ago

0.0.20221124

3 years ago

0.0.20230119

2 years ago

0.0.20221229

3 years ago

0.0.20230112

2 years ago

0.0.20221117

3 years ago

0.0.20221020

3 years ago

0.0.20221028

3 years ago

0.0.20221007

3 years ago

0.0.20220930

3 years ago

0.0.20220916

3 years ago

0.0.20220819

3 years ago

0.0.20220908

3 years ago

0.0.20220902

3 years ago

0.0.20220826

3 years ago

0.0.20220812

3 years ago

0.0.20220805

3 years ago