@anmiles/google-api-wrapper 17.0.1 → 17.0.3

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 CHANGED
@@ -5,6 +5,14 @@ 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.3](../../tags/v17.0.3) - 2024-01-16
9
+ ### Changed
10
+ - Fix README.md
11
+
12
+ ## [17.0.2](../../tags/v17.0.2) - 2024-01-16
13
+ ### Changed
14
+ - Speed-up tests by isolating modules
15
+
8
16
  ## [17.0.1](../../tags/v17.0.1) - 2024-01-16
9
17
  ### Changed
10
18
  - Expose `api` from class `API`
package/README.md CHANGED
@@ -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,9 +52,14 @@ 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}`));
60
59
  });
61
60
 
62
61
  ```
62
+
63
+ ### Live examples
64
+ - [youtube-likes-downloader](https://www.npmjs.com/package/youtube-likes-downloader) - download all liked videos from youtube
65
+ - [google-calendar-entries](https://www.npmjs.com/package/google-calendar-entries) - view and manage google calendar entries
package/jest.config.js CHANGED
@@ -1,7 +1,10 @@
1
1
  module.exports = {
2
2
  preset : 'ts-jest',
3
3
  transform : {
4
- '^.+\\.tsx?$' : 'ts-jest',
4
+ '^.+\\.tsx?$' : [ 'ts-jest', {
5
+ isolatedModules : true, // otherwise tests are slowing down a lot because of googleapis
6
+ tsconfig : './tsconfig.test.json',
7
+ } ],
5
8
  },
6
9
 
7
10
  clearMocks : true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anmiles/google-api-wrapper",
3
- "version": "17.0.1",
3
+ "version": "17.0.3",
4
4
  "description": "Provides quick interface for getting google API data",
5
5
  "keywords": [
6
6
  "google",
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+
4
+ "compilerOptions": {
5
+ "moduleResolution": "Node",
6
+ },
7
+ }