@anmiles/google-api-wrapper 17.0.2 → 17.0.4
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/CHANGELOG.md +4 -0
- package/README.md +6 -7
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [17.0.4](../../tags/v17.0.4) - 2024-01-16
|
|
9
|
+
### Changed
|
|
10
|
+
- Fix README.md
|
|
11
|
+
|
|
8
12
|
## [17.0.2](../../tags/v17.0.2) - 2024-01-16
|
|
9
13
|
### Changed
|
|
10
14
|
- Speed-up tests by isolating modules
|
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# @anmiles/google-api-wrapper
|
|
2
2
|
|
|
3
|
-
Provides quick interface for getting google API data.
|
|
4
|
-
|
|
3
|
+
Provides quick interface for getting google API data.
|
|
4
|
+
Incapsulates auth process and getting paged items in one call
|
|
5
5
|
----
|
|
6
6
|
|
|
7
7
|
## Installation
|
|
@@ -10,11 +10,6 @@ Provides quick interface for getting google API data. Support all google APIs as
|
|
|
10
10
|
|
|
11
11
|
## Usage
|
|
12
12
|
|
|
13
|
-
``` bash
|
|
14
|
-
> $ node ./auth.js
|
|
15
|
-
> $ node ./videos.js
|
|
16
|
-
```
|
|
17
|
-
|
|
18
13
|
### Authorization
|
|
19
14
|
``` js
|
|
20
15
|
/* auth.js */
|
|
@@ -22,7 +17,9 @@ Provides quick interface for getting google API data. Support all google APIs as
|
|
|
22
17
|
import { createProfile, login } from '@anmiles/google-api-wrapper';
|
|
23
18
|
|
|
24
19
|
createProfile("username");
|
|
20
|
+
|
|
25
21
|
// Persistent credentials will be generated and stored to credentials file.
|
|
22
|
+
// Next `login` call will re-use persistent credentials without showing oauth window
|
|
26
23
|
login("username");
|
|
27
24
|
|
|
28
25
|
```
|
|
@@ -38,6 +35,7 @@ require('./auth');
|
|
|
38
35
|
|
|
39
36
|
getProfiles().map(async (profile) => {
|
|
40
37
|
// Persistent credentials will be generated and stored to credentials file.
|
|
38
|
+
// Next `getAPI` call will re-use persistent credentials without showing oauth window
|
|
41
39
|
const calendarAPI = getAPI((auth) => calendar({ version : 'v3', auth }), profile);
|
|
42
40
|
const events = await calendarAPI.getItems((api) => api.events, { timeMax: new Date().toISOString() });
|
|
43
41
|
events.forEach((event) => console.log(`Event: ${event.summary}`));
|
|
@@ -54,6 +52,7 @@ import { getProfiles, getAPI } from '@anmiles/google-api-wrapper';
|
|
|
54
52
|
|
|
55
53
|
getProfiles().map(async (profile) => {
|
|
56
54
|
// Temporary credentials will be generated and not stored to credentials file
|
|
55
|
+
// Next `getAPI` will start authorization again with showing oauth window
|
|
57
56
|
const youtubeAPI = getAPI((auth) => youtube({ version : 'v3', auth }), profile, { temporary: true });
|
|
58
57
|
const videos = await youtubeAPI.getItems((api) => api.playlistItems, { playlistId : 'LL', part : [ 'snippet' ], maxResults : 50 });
|
|
59
58
|
videos.forEach((video) => console.log(`Downloaded: ${video.snippet?.title}`));
|