@anmiles/google-api-wrapper 2.1.0 → 2.1.2

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,7 +5,15 @@ 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
- ## [2.0.2](../../tags/v2.0.2) - 2023-03-13
8
+ ## [2.1.2](../../tags/v2.1.2) - 2023-03-13
9
+ ### Changed
10
+ - Fixed exported types
11
+
12
+ ## [2.1.1](../../tags/v2.1.1) - 2023-03-13
13
+ ### Changed
14
+ - Fixed exported types
15
+
16
+ ## [2.1.0](../../tags/v2.1.0) - 2023-03-13
9
17
  ### Added
10
18
  - Calendars list API
11
19
  - Export shared `getItems` to use for any other APIs
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * as calendar from './lib/api/calendar';
2
2
  export * as youtube from './lib/api/youtube';
3
+ export { getItems } from './lib/api/shared';
3
4
  export { createProfile, getProfiles } from './lib/profiles';
4
5
  export { login } from './lib/auth';
package/dist/index.js CHANGED
@@ -23,9 +23,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.login = exports.getProfiles = exports.createProfile = exports.youtube = exports.calendar = void 0;
26
+ exports.login = exports.getProfiles = exports.createProfile = exports.getItems = exports.youtube = exports.calendar = void 0;
27
27
  exports.calendar = __importStar(require("./lib/api/calendar"));
28
28
  exports.youtube = __importStar(require("./lib/api/youtube"));
29
+ var shared_1 = require("./lib/api/shared");
30
+ Object.defineProperty(exports, "getItems", { enumerable: true, get: function () { return shared_1.getItems; } });
29
31
  var profiles_1 = require("./lib/profiles");
30
32
  Object.defineProperty(exports, "createProfile", { enumerable: true, get: function () { return profiles_1.createProfile; } });
31
33
  Object.defineProperty(exports, "getProfiles", { enumerable: true, get: function () { return profiles_1.getProfiles; } });
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+DAA+C;AAC/C,6DAA6C;AAC7C,2CAA4D;AAAnD,yGAAA,aAAa,OAAA;AAAE,uGAAA,WAAW,OAAA;AACnC,mCAAmC;AAA1B,6FAAA,KAAK,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+DAA+C;AAC/C,6DAA6C;AAC7C,2CAA4C;AAAnC,kGAAA,QAAQ,OAAA;AACjB,2CAA4D;AAAnD,yGAAA,aAAa,OAAA;AAAE,uGAAA,WAAW,OAAA;AACnC,mCAAmC;AAA1B,6FAAA,KAAK,OAAA"}
@@ -1,11 +1,13 @@
1
1
  import type GoogleApis from 'googleapis';
2
- export { getAPI, getEvents, setEvent };
2
+ export { getAPI, getEvents, getCalendars, setEvent };
3
3
  declare const _default: {
4
4
  getAPI: typeof getAPI;
5
5
  getEvents: typeof getEvents;
6
+ getCalendars: typeof getCalendars;
6
7
  setEvent: typeof setEvent;
7
8
  };
8
9
  export default _default;
9
10
  declare function getAPI(profile: string): Promise<GoogleApis.calendar_v3.Calendar>;
10
- declare function getEvents(profile: string, args: GoogleApis.calendar_v3.Params$Resource$Events$List): Promise<unknown[]>;
11
+ declare function getCalendars(profile: string, args: GoogleApis.calendar_v3.Params$Resource$Calendarlist$List): Promise<GoogleApis.calendar_v3.Schema$CalendarList[]>;
12
+ declare function getEvents(profile: string, args: GoogleApis.calendar_v3.Params$Resource$Events$List): Promise<GoogleApis.calendar_v3.Schema$Events[]>;
11
13
  declare function setEvent(profile: string, eventId: string | undefined, args: GoogleApis.calendar_v3.Params$Resource$Events$Update): Promise<void>;
@@ -3,12 +3,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.setEvent = exports.getEvents = exports.getAPI = void 0;
6
+ exports.setEvent = exports.getCalendars = exports.getEvents = exports.getAPI = void 0;
7
7
  const googleapis_1 = require("googleapis");
8
8
  const auth_1 = require("../auth");
9
9
  const shared_1 = require("./shared");
10
10
  const calendar_1 = __importDefault(require("./calendar"));
11
- exports.default = { getAPI, getEvents, setEvent };
11
+ exports.default = { getAPI, getEvents, getCalendars, setEvent };
12
12
  async function getAPI(profile) {
13
13
  const googleAuth = await (0, auth_1.getAuth)(profile);
14
14
  return googleapis_1.google.calendar({
@@ -17,6 +17,11 @@ async function getAPI(profile) {
17
17
  });
18
18
  }
19
19
  exports.getAPI = getAPI;
20
+ async function getCalendars(profile, args) {
21
+ const api = await calendar_1.default.getAPI(profile);
22
+ return (0, shared_1.getItems)(api.calendarList, args);
23
+ }
24
+ exports.getCalendars = getCalendars;
20
25
  async function getEvents(profile, args) {
21
26
  const api = await calendar_1.default.getAPI(profile);
22
27
  return (0, shared_1.getItems)(api.events, args);
@@ -1 +1 @@
1
- {"version":3,"file":"calendar.js","sourceRoot":"","sources":["../../../src/lib/api/calendar.ts"],"names":[],"mappings":";;;;;;AAAA,2CAAoC;AAEpC,kCAAkC;AAClC,qCAAoC;AACpC,0DAAkC;AAGlC,kBAAe,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC;AAE/C,KAAK,UAAU,MAAM,CAAC,OAAe;IACpC,MAAM,UAAU,GAAG,MAAM,IAAA,cAAO,EAAC,OAAO,CAAC,CAAC;IAE1C,OAAO,mBAAM,CAAC,QAAQ,CAAC;QACtB,OAAO,EAAG,IAAI;QACd,IAAI,EAAM,UAAU;KACpB,CAAC,CAAC;AACJ,CAAC;AAVQ,wBAAM;AAWf,KAAK,UAAU,SAAS,CAAC,OAAe,EAAE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AC,OAAO,CAAC,CAAC;IAC3C,OAAO,IAAA,iBAAQ,EAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AACnC,CAAC;AApBgB,8BAAS;AAsB1B,KAAK,UAAU,QAAQ,CAAC,OAAe,EAAE,OAA2B,EAAE,IAA0D;IAC/H,MAAM,GAAG,GAAG,MAAM,kBAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC3C,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC;AACzC,CAAC;AAzByC,4BAAQ"}
@@ -6,4 +6,4 @@ declare const _default: {
6
6
  };
7
7
  export default _default;
8
8
  declare function getAPI(profile: string): Promise<GoogleApis.youtube_v3.Youtube>;
9
- declare function getPlaylistItems(profile: string, args: GoogleApis.youtube_v3.Params$Resource$Playlistitems$List): Promise<unknown[]>;
9
+ declare function getPlaylistItems(profile: string, args: GoogleApis.youtube_v3.Params$Resource$Playlistitems$List): Promise<GoogleApis.youtube_v3.Schema$PlaylistItem[]>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anmiles/google-api-wrapper",
3
- "version": "2.1.0",
3
+ "version": "2.1.2",
4
4
  "description": "Provides quick interface for getting google API data",
5
5
  "keywords": [
6
6
  "google",
@@ -26,7 +26,8 @@
26
26
  "test:watch:coverage": "npm test -- --watch --coverage",
27
27
  "test:report:coverage": "nyc report --nycrc-path ./coverage.config.js -t ./coverage --report-dir ./coverage",
28
28
  "create": "node ./dist/create.js",
29
- "login": "node ./dist/login.js"
29
+ "login": "node ./dist/login.js",
30
+ "save": "npm run build && npm publish --access public"
30
31
  },
31
32
  "dependencies": {
32
33
  "colorette": "^2.0.19",
@@ -16,12 +16,12 @@ async function getAPI(profile: string): Promise<GoogleApis.calendar_v3.Calendar>
16
16
  });
17
17
  }
18
18
 
19
- async function getCalendars(profile: string, args: GoogleApis.calendar_v3.Params$Resource$Calendarlist$List) {
19
+ async function getCalendars(profile: string, args: GoogleApis.calendar_v3.Params$Resource$Calendarlist$List): Promise<GoogleApis.calendar_v3.Schema$CalendarList[]> {
20
20
  const api = await calendar.getAPI(profile);
21
21
  return getItems(api.calendarList, args);
22
22
  }
23
23
 
24
- async function getEvents(profile: string, args: GoogleApis.calendar_v3.Params$Resource$Events$List) {
24
+ async function getEvents(profile: string, args: GoogleApis.calendar_v3.Params$Resource$Events$List): Promise<GoogleApis.calendar_v3.Schema$Events[]> {
25
25
  const api = await calendar.getAPI(profile);
26
26
  return getItems(api.events, args);
27
27
  }
@@ -16,7 +16,7 @@ async function getAPI(profile: string): Promise<GoogleApis.youtube_v3.Youtube> {
16
16
  });
17
17
  }
18
18
 
19
- async function getPlaylistItems(profile: string, args: GoogleApis.youtube_v3.Params$Resource$Playlistitems$List) {
19
+ async function getPlaylistItems(profile: string, args: GoogleApis.youtube_v3.Params$Resource$Playlistitems$List): Promise<GoogleApis.youtube_v3.Schema$PlaylistItem[]> {
20
20
  const api = await youtube.getAPI(profile);
21
21
  return getItems(api.playlistItems, args);
22
22
  }