Files
DefinitelyTyped/types/gapi.client.calendar/gapi.client.calendar-tests.ts
Alexey Bolisov 4f8a3d571b Add Google APIs typings (#19083)
* Add Google APIs typings

* [gapi.cliebt.* ] Add version as part of typings name and fix gapi.client tslint errors

* versions should not get their own folders
fixing a few typos
using /** syntax so comments show up in editors
export only actual (last) version for now

* export only actual (last) version for now

* merge namespaces and remove unnecessary namespace qualifiers

* remove namespace qualifier for gapi.client.Request from nested namespaces and change Request base interface to Promise

* disable await-promise rule

* fix collision between gapi.client.Request and Request from nested namespace
disable no-irregular-whitespace rule

* sort properties and namespace resources

* remove empty comments
sort resources amd methods in tests and readme.md

* update 'this is autogenerated file' banner to remove this text from gapi.client namespace hint
use multiline comments when comment has several lines

* implement no-trailing-whitespace, no-padding, max-line-length, await-promise, no-irregular-whitespace rules

* add strictFunctionTypes to tsconfig

* fix "Whitespace within parentheses is not allowed" rule

* fix ts-lint rules

* fixes

* remove deprecated replicapool and replicapoolupdater api

* fix no-irregular-whitespace

* fix no-irregular-whitespace
2017-10-09 14:55:04 -07:00

276 lines
10 KiB
TypeScript

/* This is stub file for gapi.client.{{=it.name}} definition tests */
/* IMPORTANT.
* This file was automatically generated by https://github.com/Bolisov/google-api-typings-generator. Please do not edit it manually.
* In case of any problems please post issue to https://github.com/Bolisov/google-api-typings-generator
**/
gapi.load('client', () => {
/** now we can use gapi.client */
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 */
const client_id = '<<PUT YOUR CLIENT ID HERE>>';
const scope = [
/** Manage your calendars */
'https://www.googleapis.com/auth/calendar',
/** View your calendars */
'https://www.googleapis.com/auth/calendar.readonly',
];
const immediate = true;
gapi.auth.authorize({ client_id, scope, immediate }, authResult => {
if (authResult && !authResult.error) {
/** handle succesfull authorization */
run();
} else {
/** handle authorization error */
}
});
run();
});
async function run() {
/** Deletes an access control rule. */
await gapi.client.acl.delete({
calendarId: "calendarId",
ruleId: "ruleId",
});
/** Returns an access control rule. */
await gapi.client.acl.get({
calendarId: "calendarId",
ruleId: "ruleId",
});
/** Creates an access control rule. */
await gapi.client.acl.insert({
calendarId: "calendarId",
});
/** Returns the rules in the access control list for the calendar. */
await gapi.client.acl.list({
calendarId: "calendarId",
maxResults: 2,
pageToken: "pageToken",
showDeleted: true,
syncToken: "syncToken",
});
/** Updates an access control rule. This method supports patch semantics. */
await gapi.client.acl.patch({
calendarId: "calendarId",
ruleId: "ruleId",
});
/** Updates an access control rule. */
await gapi.client.acl.update({
calendarId: "calendarId",
ruleId: "ruleId",
});
/** Watch for changes to ACL resources. */
await gapi.client.acl.watch({
calendarId: "calendarId",
maxResults: 2,
pageToken: "pageToken",
showDeleted: true,
syncToken: "syncToken",
});
/** Deletes an entry on the user's calendar list. */
await gapi.client.calendarList.delete({
calendarId: "calendarId",
});
/** Returns an entry on the user's calendar list. */
await gapi.client.calendarList.get({
calendarId: "calendarId",
});
/** Adds an entry to the user's calendar list. */
await gapi.client.calendarList.insert({
colorRgbFormat: true,
});
/** Returns entries on the user's calendar list. */
await gapi.client.calendarList.list({
maxResults: 1,
minAccessRole: "minAccessRole",
pageToken: "pageToken",
showDeleted: true,
showHidden: true,
syncToken: "syncToken",
});
/** Updates an entry on the user's calendar list. This method supports patch semantics. */
await gapi.client.calendarList.patch({
calendarId: "calendarId",
colorRgbFormat: true,
});
/** Updates an entry on the user's calendar list. */
await gapi.client.calendarList.update({
calendarId: "calendarId",
colorRgbFormat: true,
});
/** Watch for changes to CalendarList resources. */
await gapi.client.calendarList.watch({
maxResults: 1,
minAccessRole: "minAccessRole",
pageToken: "pageToken",
showDeleted: true,
showHidden: true,
syncToken: "syncToken",
});
/** Clears a primary calendar. This operation deletes all events associated with the primary calendar of an account. */
await gapi.client.calendars.clear({
calendarId: "calendarId",
});
/** Deletes a secondary calendar. Use calendars.clear for clearing all events on primary calendars. */
await gapi.client.calendars.delete({
calendarId: "calendarId",
});
/** Returns metadata for a calendar. */
await gapi.client.calendars.get({
calendarId: "calendarId",
});
/** Creates a secondary calendar. */
await gapi.client.calendars.insert({
});
/** Updates metadata for a calendar. This method supports patch semantics. */
await gapi.client.calendars.patch({
calendarId: "calendarId",
});
/** Updates metadata for a calendar. */
await gapi.client.calendars.update({
calendarId: "calendarId",
});
/** Stop watching resources through this channel */
await gapi.client.channels.stop({
});
/** Returns the color definitions for calendars and events. */
await gapi.client.colors.get({
});
/** Deletes an event. */
await gapi.client.events.delete({
calendarId: "calendarId",
eventId: "eventId",
sendNotifications: true,
});
/** Returns an event. */
await gapi.client.events.get({
alwaysIncludeEmail: true,
calendarId: "calendarId",
eventId: "eventId",
maxAttendees: 4,
timeZone: "timeZone",
});
/** Imports an event. This operation is used to add a private copy of an existing event to a calendar. */
await gapi.client.events.import({
calendarId: "calendarId",
supportsAttachments: true,
});
/** Creates an event. */
await gapi.client.events.insert({
calendarId: "calendarId",
maxAttendees: 2,
sendNotifications: true,
supportsAttachments: true,
});
/** Returns instances of the specified recurring event. */
await gapi.client.events.instances({
alwaysIncludeEmail: true,
calendarId: "calendarId",
eventId: "eventId",
maxAttendees: 4,
maxResults: 5,
originalStart: "originalStart",
pageToken: "pageToken",
showDeleted: true,
timeMax: "timeMax",
timeMin: "timeMin",
timeZone: "timeZone",
});
/** Returns events on the specified calendar. */
await gapi.client.events.list({
alwaysIncludeEmail: true,
calendarId: "calendarId",
iCalUID: "iCalUID",
maxAttendees: 4,
maxResults: 5,
orderBy: "orderBy",
pageToken: "pageToken",
privateExtendedProperty: "privateExtendedProperty",
q: "q",
sharedExtendedProperty: "sharedExtendedProperty",
showDeleted: true,
showHiddenInvitations: true,
singleEvents: true,
syncToken: "syncToken",
timeMax: "timeMax",
timeMin: "timeMin",
timeZone: "timeZone",
updatedMin: "updatedMin",
});
/** Moves an event to another calendar, i.e. changes an event's organizer. */
await gapi.client.events.move({
calendarId: "calendarId",
destination: "destination",
eventId: "eventId",
sendNotifications: true,
});
/** Updates an event. This method supports patch semantics. */
await gapi.client.events.patch({
alwaysIncludeEmail: true,
calendarId: "calendarId",
eventId: "eventId",
maxAttendees: 4,
sendNotifications: true,
supportsAttachments: true,
});
/** Creates an event based on a simple text string. */
await gapi.client.events.quickAdd({
calendarId: "calendarId",
sendNotifications: true,
text: "text",
});
/** Updates an event. */
await gapi.client.events.update({
alwaysIncludeEmail: true,
calendarId: "calendarId",
eventId: "eventId",
maxAttendees: 4,
sendNotifications: true,
supportsAttachments: true,
});
/** Watch for changes to Events resources. */
await gapi.client.events.watch({
alwaysIncludeEmail: true,
calendarId: "calendarId",
iCalUID: "iCalUID",
maxAttendees: 4,
maxResults: 5,
orderBy: "orderBy",
pageToken: "pageToken",
privateExtendedProperty: "privateExtendedProperty",
q: "q",
sharedExtendedProperty: "sharedExtendedProperty",
showDeleted: true,
showHiddenInvitations: true,
singleEvents: true,
syncToken: "syncToken",
timeMax: "timeMax",
timeMin: "timeMin",
timeZone: "timeZone",
updatedMin: "updatedMin",
});
/** Returns free/busy information for a set of calendars. */
await gapi.client.freebusy.query({
});
/** Returns a single user setting. */
await gapi.client.settings.get({
setting: "setting",
});
/** Returns all user settings for the authenticated user. */
await gapi.client.settings.list({
maxResults: 1,
pageToken: "pageToken",
syncToken: "syncToken",
});
/** Watch for changes to Settings resources. */
await gapi.client.settings.watch({
maxResults: 1,
pageToken: "pageToken",
syncToken: "syncToken",
});
}
});