@maxim_mazurok/gapi.client.calendar-v3 0.0.20231116 → 0.0.20231201
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +2436 -3654
- package/package.json +6 -6
- package/readme.md +95 -58
- package/tests.ts +0 -1263
- package/tsconfig.json +0 -18
- package/tslint.json +0 -6
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maxim_mazurok/gapi.client.calendar-v3",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.20231201",
|
|
4
4
|
"description": "TypeScript typings for Calendar API v3",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/Maxim-Mazurok/google-api-typings-generator.git"
|
|
8
|
+
},
|
|
5
9
|
"license": "MIT",
|
|
6
10
|
"author": {
|
|
7
|
-
"email": "maxim@mazurok.com",
|
|
8
11
|
"name": "Maxim Mazurok",
|
|
12
|
+
"email": "maxim@mazurok.com",
|
|
9
13
|
"url": "https://maxim.mazurok.com"
|
|
10
14
|
},
|
|
11
|
-
"repository": {
|
|
12
|
-
"type": "git",
|
|
13
|
-
"url": "https://github.com/Maxim-Mazurok/google-api-typings-generator.git"
|
|
14
|
-
},
|
|
15
15
|
"types": "index.d.ts",
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@types/gapi.client": "*",
|
package/readme.md
CHANGED
|
@@ -25,10 +25,13 @@ gapi.load('client', () => {
|
|
|
25
25
|
Then load api client wrapper:
|
|
26
26
|
|
|
27
27
|
```typescript
|
|
28
|
-
gapi.client.load(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
gapi.client.load(
|
|
29
|
+
'https://calendar-json.googleapis.com/$discovery/rest?version=v3',
|
|
30
|
+
() => {
|
|
31
|
+
// now we can use:
|
|
32
|
+
// gapi.client.calendar
|
|
33
|
+
}
|
|
34
|
+
);
|
|
32
35
|
```
|
|
33
36
|
|
|
34
37
|
```typescript
|
|
@@ -45,221 +48,255 @@ Don't forget to authenticate your client before sending any request to resources
|
|
|
45
48
|
// declare client_id registered in Google Developers Console
|
|
46
49
|
var client_id = '',
|
|
47
50
|
scope = [
|
|
48
|
-
|
|
49
|
-
|
|
51
|
+
// See, edit, share, and permanently delete all the calendars you can access using Google Calendar
|
|
52
|
+
'https://www.googleapis.com/auth/calendar',
|
|
50
53
|
|
|
51
|
-
|
|
52
|
-
|
|
54
|
+
// View and edit events on all your calendars
|
|
55
|
+
'https://www.googleapis.com/auth/calendar.events',
|
|
53
56
|
|
|
54
|
-
|
|
55
|
-
|
|
57
|
+
// View events on all your calendars
|
|
58
|
+
'https://www.googleapis.com/auth/calendar.events.readonly',
|
|
56
59
|
|
|
57
|
-
|
|
58
|
-
|
|
60
|
+
// See and download any calendar you can access using your Google Calendar
|
|
61
|
+
'https://www.googleapis.com/auth/calendar.readonly',
|
|
59
62
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
63
|
+
// View your Calendar settings
|
|
64
|
+
'https://www.googleapis.com/auth/calendar.settings.readonly',
|
|
65
|
+
],
|
|
66
|
+
immediate = true;
|
|
64
67
|
// ...
|
|
65
68
|
|
|
66
69
|
gapi.auth.authorize(
|
|
67
|
-
{
|
|
70
|
+
{client_id: client_id, scope: scope, immediate: immediate},
|
|
68
71
|
authResult => {
|
|
69
72
|
if (authResult && !authResult.error) {
|
|
70
|
-
|
|
73
|
+
/* handle successful authorization */
|
|
71
74
|
} else {
|
|
72
|
-
|
|
75
|
+
/* handle authorization error */
|
|
73
76
|
}
|
|
74
|
-
}
|
|
77
|
+
}
|
|
78
|
+
);
|
|
75
79
|
```
|
|
76
80
|
|
|
77
81
|
After that you can use Calendar API resources: <!-- TODO: make this work for multiple namespaces -->
|
|
78
82
|
|
|
79
83
|
```typescript
|
|
80
|
-
|
|
81
84
|
/*
|
|
82
85
|
Deletes an access control rule.
|
|
83
86
|
*/
|
|
84
|
-
await gapi.client.calendar.acl.delete({
|
|
87
|
+
await gapi.client.calendar.acl.delete({
|
|
88
|
+
calendarId: 'calendarId',
|
|
89
|
+
ruleId: 'ruleId',
|
|
90
|
+
});
|
|
85
91
|
|
|
86
92
|
/*
|
|
87
93
|
Returns an access control rule.
|
|
88
94
|
*/
|
|
89
|
-
await gapi.client.calendar.acl.get({
|
|
95
|
+
await gapi.client.calendar.acl.get({
|
|
96
|
+
calendarId: 'calendarId',
|
|
97
|
+
ruleId: 'ruleId',
|
|
98
|
+
});
|
|
90
99
|
|
|
91
100
|
/*
|
|
92
101
|
Creates an access control rule.
|
|
93
102
|
*/
|
|
94
|
-
await gapi.client.calendar.acl.insert({
|
|
103
|
+
await gapi.client.calendar.acl.insert({calendarId: 'calendarId'});
|
|
95
104
|
|
|
96
105
|
/*
|
|
97
106
|
Returns the rules in the access control list for the calendar.
|
|
98
107
|
*/
|
|
99
|
-
await gapi.client.calendar.acl.list({
|
|
108
|
+
await gapi.client.calendar.acl.list({calendarId: 'calendarId'});
|
|
100
109
|
|
|
101
110
|
/*
|
|
102
111
|
Updates an access control rule. This method supports patch semantics.
|
|
103
112
|
*/
|
|
104
|
-
await gapi.client.calendar.acl.patch({
|
|
113
|
+
await gapi.client.calendar.acl.patch({
|
|
114
|
+
calendarId: 'calendarId',
|
|
115
|
+
ruleId: 'ruleId',
|
|
116
|
+
});
|
|
105
117
|
|
|
106
118
|
/*
|
|
107
119
|
Updates an access control rule.
|
|
108
120
|
*/
|
|
109
|
-
await gapi.client.calendar.acl.update({
|
|
121
|
+
await gapi.client.calendar.acl.update({
|
|
122
|
+
calendarId: 'calendarId',
|
|
123
|
+
ruleId: 'ruleId',
|
|
124
|
+
});
|
|
110
125
|
|
|
111
126
|
/*
|
|
112
127
|
Watch for changes to ACL resources.
|
|
113
128
|
*/
|
|
114
|
-
await gapi.client.calendar.acl.watch({
|
|
129
|
+
await gapi.client.calendar.acl.watch({calendarId: 'calendarId'});
|
|
115
130
|
|
|
116
131
|
/*
|
|
117
132
|
Removes a calendar from the user's calendar list.
|
|
118
133
|
*/
|
|
119
|
-
await gapi.client.calendar.calendarList.delete({
|
|
134
|
+
await gapi.client.calendar.calendarList.delete({calendarId: 'calendarId'});
|
|
120
135
|
|
|
121
136
|
/*
|
|
122
137
|
Returns a calendar from the user's calendar list.
|
|
123
138
|
*/
|
|
124
|
-
await gapi.client.calendar.calendarList.get({
|
|
139
|
+
await gapi.client.calendar.calendarList.get({calendarId: 'calendarId'});
|
|
125
140
|
|
|
126
141
|
/*
|
|
127
142
|
Inserts an existing calendar into the user's calendar list.
|
|
128
143
|
*/
|
|
129
|
-
await gapi.client.calendar.calendarList.insert({
|
|
144
|
+
await gapi.client.calendar.calendarList.insert({});
|
|
130
145
|
|
|
131
146
|
/*
|
|
132
147
|
Returns the calendars on the user's calendar list.
|
|
133
148
|
*/
|
|
134
|
-
await gapi.client.calendar.calendarList.list({
|
|
149
|
+
await gapi.client.calendar.calendarList.list({});
|
|
135
150
|
|
|
136
151
|
/*
|
|
137
152
|
Updates an existing calendar on the user's calendar list. This method supports patch semantics.
|
|
138
153
|
*/
|
|
139
|
-
await gapi.client.calendar.calendarList.patch({
|
|
154
|
+
await gapi.client.calendar.calendarList.patch({calendarId: 'calendarId'});
|
|
140
155
|
|
|
141
156
|
/*
|
|
142
157
|
Updates an existing calendar on the user's calendar list.
|
|
143
158
|
*/
|
|
144
|
-
await gapi.client.calendar.calendarList.update({
|
|
159
|
+
await gapi.client.calendar.calendarList.update({calendarId: 'calendarId'});
|
|
145
160
|
|
|
146
161
|
/*
|
|
147
162
|
Watch for changes to CalendarList resources.
|
|
148
163
|
*/
|
|
149
|
-
await gapi.client.calendar.calendarList.watch({
|
|
164
|
+
await gapi.client.calendar.calendarList.watch({});
|
|
150
165
|
|
|
151
166
|
/*
|
|
152
167
|
Clears a primary calendar. This operation deletes all events associated with the primary calendar of an account.
|
|
153
168
|
*/
|
|
154
|
-
await gapi.client.calendar.calendars.clear({
|
|
169
|
+
await gapi.client.calendar.calendars.clear({calendarId: 'calendarId'});
|
|
155
170
|
|
|
156
171
|
/*
|
|
157
172
|
Deletes a secondary calendar. Use calendars.clear for clearing all events on primary calendars.
|
|
158
173
|
*/
|
|
159
|
-
await gapi.client.calendar.calendars.delete({
|
|
174
|
+
await gapi.client.calendar.calendars.delete({calendarId: 'calendarId'});
|
|
160
175
|
|
|
161
176
|
/*
|
|
162
177
|
Returns metadata for a calendar.
|
|
163
178
|
*/
|
|
164
|
-
await gapi.client.calendar.calendars.get({
|
|
179
|
+
await gapi.client.calendar.calendars.get({calendarId: 'calendarId'});
|
|
165
180
|
|
|
166
181
|
/*
|
|
167
182
|
Creates a secondary calendar.
|
|
168
183
|
*/
|
|
169
|
-
await gapi.client.calendar.calendars.insert({
|
|
184
|
+
await gapi.client.calendar.calendars.insert({});
|
|
170
185
|
|
|
171
186
|
/*
|
|
172
187
|
Updates metadata for a calendar. This method supports patch semantics.
|
|
173
188
|
*/
|
|
174
|
-
await gapi.client.calendar.calendars.patch({
|
|
189
|
+
await gapi.client.calendar.calendars.patch({calendarId: 'calendarId'});
|
|
175
190
|
|
|
176
191
|
/*
|
|
177
192
|
Updates metadata for a calendar.
|
|
178
193
|
*/
|
|
179
|
-
await gapi.client.calendar.calendars.update({
|
|
194
|
+
await gapi.client.calendar.calendars.update({calendarId: 'calendarId'});
|
|
180
195
|
|
|
181
196
|
/*
|
|
182
197
|
Stop watching resources through this channel
|
|
183
198
|
*/
|
|
184
|
-
await gapi.client.calendar.channels.stop({
|
|
199
|
+
await gapi.client.calendar.channels.stop({});
|
|
185
200
|
|
|
186
201
|
/*
|
|
187
202
|
Returns the color definitions for calendars and events.
|
|
188
203
|
*/
|
|
189
|
-
await gapi.client.calendar.colors.get({
|
|
204
|
+
await gapi.client.calendar.colors.get({});
|
|
190
205
|
|
|
191
206
|
/*
|
|
192
207
|
Deletes an event.
|
|
193
208
|
*/
|
|
194
|
-
await gapi.client.calendar.events.delete({
|
|
209
|
+
await gapi.client.calendar.events.delete({
|
|
210
|
+
calendarId: 'calendarId',
|
|
211
|
+
eventId: 'eventId',
|
|
212
|
+
});
|
|
195
213
|
|
|
196
214
|
/*
|
|
197
215
|
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.
|
|
198
216
|
*/
|
|
199
|
-
await gapi.client.calendar.events.get({
|
|
217
|
+
await gapi.client.calendar.events.get({
|
|
218
|
+
calendarId: 'calendarId',
|
|
219
|
+
eventId: 'eventId',
|
|
220
|
+
});
|
|
200
221
|
|
|
201
222
|
/*
|
|
202
223
|
Imports an event. This operation is used to add a private copy of an existing event to a calendar.
|
|
203
224
|
*/
|
|
204
|
-
await gapi.client.calendar.events.import({
|
|
225
|
+
await gapi.client.calendar.events.import({calendarId: 'calendarId'});
|
|
205
226
|
|
|
206
227
|
/*
|
|
207
228
|
Creates an event.
|
|
208
229
|
*/
|
|
209
|
-
await gapi.client.calendar.events.insert({
|
|
230
|
+
await gapi.client.calendar.events.insert({calendarId: 'calendarId'});
|
|
210
231
|
|
|
211
232
|
/*
|
|
212
233
|
Returns instances of the specified recurring event.
|
|
213
234
|
*/
|
|
214
|
-
await gapi.client.calendar.events.instances({
|
|
235
|
+
await gapi.client.calendar.events.instances({
|
|
236
|
+
calendarId: 'calendarId',
|
|
237
|
+
eventId: 'eventId',
|
|
238
|
+
});
|
|
215
239
|
|
|
216
240
|
/*
|
|
217
241
|
Returns events on the specified calendar.
|
|
218
242
|
*/
|
|
219
|
-
await gapi.client.calendar.events.list({
|
|
243
|
+
await gapi.client.calendar.events.list({calendarId: 'calendarId'});
|
|
220
244
|
|
|
221
245
|
/*
|
|
222
246
|
Moves an event to another calendar, i.e. changes an event's organizer. Note that only default events can be moved; outOfOffice, focusTime and workingLocation events cannot be moved.
|
|
223
247
|
*/
|
|
224
|
-
await gapi.client.calendar.events.move({
|
|
248
|
+
await gapi.client.calendar.events.move({
|
|
249
|
+
calendarId: 'calendarId',
|
|
250
|
+
destination: 'destination',
|
|
251
|
+
eventId: 'eventId',
|
|
252
|
+
});
|
|
225
253
|
|
|
226
254
|
/*
|
|
227
255
|
Updates an event. This method supports patch semantics.
|
|
228
256
|
*/
|
|
229
|
-
await gapi.client.calendar.events.patch({
|
|
257
|
+
await gapi.client.calendar.events.patch({
|
|
258
|
+
calendarId: 'calendarId',
|
|
259
|
+
eventId: 'eventId',
|
|
260
|
+
});
|
|
230
261
|
|
|
231
262
|
/*
|
|
232
263
|
Creates an event based on a simple text string.
|
|
233
264
|
*/
|
|
234
|
-
await gapi.client.calendar.events.quickAdd({
|
|
265
|
+
await gapi.client.calendar.events.quickAdd({
|
|
266
|
+
calendarId: 'calendarId',
|
|
267
|
+
text: 'text',
|
|
268
|
+
});
|
|
235
269
|
|
|
236
270
|
/*
|
|
237
271
|
Updates an event.
|
|
238
272
|
*/
|
|
239
|
-
await gapi.client.calendar.events.update({
|
|
273
|
+
await gapi.client.calendar.events.update({
|
|
274
|
+
calendarId: 'calendarId',
|
|
275
|
+
eventId: 'eventId',
|
|
276
|
+
});
|
|
240
277
|
|
|
241
278
|
/*
|
|
242
279
|
Watch for changes to Events resources.
|
|
243
280
|
*/
|
|
244
|
-
await gapi.client.calendar.events.watch({
|
|
281
|
+
await gapi.client.calendar.events.watch({calendarId: 'calendarId'});
|
|
245
282
|
|
|
246
283
|
/*
|
|
247
284
|
Returns free/busy information for a set of calendars.
|
|
248
285
|
*/
|
|
249
|
-
await gapi.client.calendar.freebusy.query({
|
|
286
|
+
await gapi.client.calendar.freebusy.query({});
|
|
250
287
|
|
|
251
288
|
/*
|
|
252
289
|
Returns a single user setting.
|
|
253
290
|
*/
|
|
254
|
-
await gapi.client.calendar.settings.get({
|
|
291
|
+
await gapi.client.calendar.settings.get({setting: 'setting'});
|
|
255
292
|
|
|
256
293
|
/*
|
|
257
294
|
Returns all user settings for the authenticated user.
|
|
258
295
|
*/
|
|
259
|
-
await gapi.client.calendar.settings.list({
|
|
296
|
+
await gapi.client.calendar.settings.list({});
|
|
260
297
|
|
|
261
298
|
/*
|
|
262
299
|
Watch for changes to Settings resources.
|
|
263
300
|
*/
|
|
264
|
-
await gapi.client.calendar.settings.watch({
|
|
301
|
+
await gapi.client.calendar.settings.watch({});
|
|
265
302
|
```
|