@anmiles/google-api-wrapper 9.1.0 → 11.0.0

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.
@@ -0,0 +1,206 @@
1
+ import { google } from 'googleapis';
2
+ import logger from '@anmiles/logger';
3
+ import sleep from '@anmiles/sleep';
4
+ import auth from '../auth';
5
+ import secrets from '../secrets';
6
+ import api from '../api';
7
+
8
+ const items: Array<{ data: string}> = [
9
+ { data : 'first' },
10
+ { data : 'second' },
11
+ { data : 'third' },
12
+ { data : 'forth' },
13
+ ];
14
+
15
+ const response = [
16
+ [ items[0], items[1] ],
17
+ null,
18
+ [ items[2], items[3] ],
19
+ ];
20
+
21
+ const pageTokens = [
22
+ undefined,
23
+ 'token1',
24
+ 'token2',
25
+ ];
26
+
27
+ const getAPI = <T>(items: Array<Array<T> | null>, pageTokens: Array<string | undefined>) => ({
28
+ list : jest.fn().mockImplementation(async ({ pageToken }: {pageToken?: string}) => {
29
+ const listException = getListException();
30
+
31
+ if (listException) {
32
+ throw listException;
33
+ }
34
+
35
+ const index = pageTokens.indexOf(pageToken);
36
+
37
+ return {
38
+ data : {
39
+ items : items[index],
40
+ nextPageToken : pageTokens[index + 1],
41
+ pageInfo : !items[index] ? null : {
42
+ totalResults : items.reduce((sum, list) => sum + (list?.length || 0), 0),
43
+ },
44
+ },
45
+ };
46
+ }),
47
+ update : jest.fn(),
48
+ });
49
+
50
+ const args = { key : 'value' };
51
+
52
+ const profile = 'username1';
53
+ const calendarApi = {
54
+ calendarList : getAPI(response, pageTokens),
55
+ };
56
+
57
+ const googleAuth = {
58
+ revokeCredentials : jest.fn(),
59
+ };
60
+
61
+ const scopes = [ 'scope1', 'scope2' ];
62
+
63
+ const getListException: jest.Mock<Error | undefined> = jest.fn();
64
+
65
+ beforeEach(() => {
66
+ getListException.mockReturnValue(undefined);
67
+ });
68
+
69
+ jest.mock('googleapis', () => ({
70
+ google : {
71
+ calendar : jest.fn().mockImplementation(() => calendarApi),
72
+ },
73
+ }));
74
+
75
+ jest.mock<Partial<typeof auth>>('../auth', () => ({
76
+ getAuth : jest.fn().mockImplementation(() => googleAuth),
77
+ }));
78
+
79
+ jest.mock<Partial<typeof secrets>>('../secrets', () => ({
80
+ deleteCredentials : jest.fn(),
81
+ }));
82
+
83
+ jest.mock<Partial<typeof logger>>('@anmiles/logger', () => ({
84
+ log : jest.fn(),
85
+ }));
86
+
87
+ jest.mock<Partial<typeof sleep>>('@anmiles/sleep', () => jest.fn());
88
+
89
+ describe('src/lib/api', () => {
90
+ describe('getApi', () => {
91
+ it('should call getAuth', async () => {
92
+ await api.getApi('calendar', profile);
93
+
94
+ expect(auth.getAuth).toHaveBeenCalledWith(profile, undefined);
95
+ });
96
+
97
+ it('should pass temporariness and scopes', async () => {
98
+ await api.getApi('calendar', profile, { scopes, temporary : true });
99
+
100
+ expect(auth.getAuth).toHaveBeenCalledWith(profile, { scopes, temporary : true });
101
+ });
102
+
103
+ it('should get google api', async () => {
104
+ await api.getApi('calendar', profile);
105
+
106
+ expect(google.calendar).toHaveBeenCalledWith({ version : 'v3', auth : googleAuth });
107
+ });
108
+
109
+ it('should return instance wrapper for google api', async () => {
110
+ const instance = await api.getApi('calendar', profile, { scopes, temporary : true });
111
+
112
+ expect(instance).toEqual({ apiName : 'calendar', profile, authOptions : { scopes, temporary : true }, api : calendarApi, auth : googleAuth });
113
+ });
114
+ });
115
+
116
+ describe('Api', () => {
117
+ let instance: InstanceType<typeof api.Api<'calendar'>>;
118
+
119
+ beforeEach(async () => {
120
+ instance = await api.getApi('calendar', profile);
121
+ });
122
+
123
+ describe('constructor', () => {
124
+ it('should return instance', async () => {
125
+ const instance = new api.Api('calendar', profile, { scopes, temporary : true });
126
+
127
+ expect(instance).toEqual({ apiName : 'calendar', profile, authOptions : { scopes, temporary : true } });
128
+ });
129
+ });
130
+
131
+ describe('getItems', () => {
132
+ it('should call API list method for each page', async () => {
133
+ await instance.getItems((api) => api.calendarList, args);
134
+
135
+ pageTokens.forEach((pageToken) => {
136
+ expect(calendarApi.calendarList.list).toHaveBeenCalledWith({ ...args, pageToken });
137
+ });
138
+ });
139
+
140
+ it('should output progress by default', async () => {
141
+ await instance.getItems((api) => api.calendarList, args);
142
+
143
+ expect(logger.log).toHaveBeenCalledTimes(response.length);
144
+ expect(logger.log).toHaveBeenCalledWith('Getting items (2 of 4)...');
145
+ expect(logger.log).toHaveBeenCalledWith('Getting items (2 of many)...');
146
+ expect(logger.log).toHaveBeenCalledWith('Getting items (4 of 4)...');
147
+ });
148
+
149
+ it('should not output progress if hidden', async () => {
150
+ await instance.getItems((api) => api.calendarList, args, { hideProgress : true });
151
+
152
+ expect(logger.log).not.toHaveBeenCalled();
153
+ });
154
+
155
+ it('should sleep after reach request', async () => {
156
+ await instance.getItems((api) => api.calendarList, args);
157
+
158
+ expect(sleep).toHaveBeenCalledTimes(response.length);
159
+ expect(sleep).toHaveBeenCalledWith(300);
160
+ });
161
+
162
+ it('should be initialized and called once if no API error', async () => {
163
+ const getItemsSpy = jest.spyOn(instance, 'getItems');
164
+ await instance.getItems((api) => api.calendarList, args);
165
+ expect(auth.getAuth).toHaveBeenCalledTimes(1);
166
+ expect(getItemsSpy).toHaveBeenCalledTimes(1);
167
+ });
168
+
169
+ it('should delete credentials, re-initialize api and retry while API exception is invalid_grant', async () => {
170
+ const error = new Error('invalid_grant');
171
+ // fail twice
172
+ getListException.mockReturnValueOnce(error).mockReturnValueOnce(error);
173
+
174
+ const getItemsSpy = jest.spyOn(instance, 'getItems');
175
+ await instance.getItems((api) => api.calendarList, args);
176
+ expect(secrets.deleteCredentials).toHaveBeenCalledWith(profile);
177
+ expect(auth.getAuth).toHaveBeenCalledTimes(3);
178
+ expect(getItemsSpy).toHaveBeenCalledTimes(3);
179
+ });
180
+
181
+ it('should re-throw API exception if not invalid_grant', async () => {
182
+ const error = new Error('random exception');
183
+ getListException.mockReturnValueOnce(error);
184
+ await expect(instance.getItems((api) => api.calendarList, args)).rejects.toEqual(error);
185
+ });
186
+
187
+ it('should return items data', async () => {
188
+ const items = await instance.getItems((api) => api.calendarList, args);
189
+
190
+ expect(items).toEqual(items);
191
+ });
192
+ });
193
+
194
+ describe('revoke', () => {
195
+ it('should delete credentials file for current profile', async () => {
196
+ await instance.revoke();
197
+ expect(secrets.deleteCredentials).toHaveBeenCalledWith(profile);
198
+ });
199
+
200
+ it('should revoke credentials in google API', async () => {
201
+ await instance.revoke();
202
+ expect(googleAuth.revokeCredentials).toHaveBeenCalledWith();
203
+ });
204
+ });
205
+ });
206
+ });
@@ -17,6 +17,7 @@ jest.mock<typeof secrets>('../secrets', () => ({
17
17
  getCredentials : jest.fn(),
18
18
  validateCredentials : jest.fn(),
19
19
  createCredentials : jest.fn().mockImplementation(() => credentialsJSON),
20
+ deleteCredentials : jest.fn(),
20
21
  checkSecrets : jest.fn(),
21
22
  getScopesError : jest.fn().mockImplementation(() => scopesError),
22
23
  getSecretsError : jest.fn().mockImplementation(() => secretsError),
@@ -40,6 +41,7 @@ async function makeRequest(url: string | undefined) {
40
41
 
41
42
  jest.mock<Partial<typeof fs>>('fs', () => ({
42
43
  existsSync : jest.fn().mockImplementation(() => exists),
44
+ rmSync : jest.fn(),
43
45
  }));
44
46
 
45
47
  jest.mock<Partial<typeof path>>('path', () => ({
@@ -516,6 +518,20 @@ describe('src/lib/secrets', () => {
516
518
  });
517
519
  });
518
520
 
521
+ describe('deleteCredentials', () => {
522
+ it('should delete credentials file if exists', () => {
523
+ exists = true;
524
+ original.deleteCredentials(profile);
525
+ expect(fs.rmSync).toHaveBeenCalledWith(credentialsFile);
526
+ });
527
+
528
+ it('should not do anything if credentials file does not exist', () => {
529
+ exists = false;
530
+ original.deleteCredentials(profile);
531
+ expect(fs.rmSync).not.toHaveBeenCalled();
532
+ });
533
+ });
534
+
519
535
  describe('checkSecrets', () => {
520
536
  it('should return true if redirect_uri is correct', () => {
521
537
  const result = original.checkSecrets(profile, secretsJSON, secretsFile);
package/src/lib/api.ts ADDED
@@ -0,0 +1,365 @@
1
+ import { google } from 'googleapis';
2
+ import type GoogleApis from 'googleapis';
3
+ import { log } from '@anmiles/logger';
4
+ import sleep from '@anmiles/sleep';
5
+ import type { AuthOptions, CommonOptions } from '../types';
6
+ import { getAuth } from './auth';
7
+ import { deleteCredentials } from './secrets';
8
+
9
+ const requestInterval = 300;
10
+
11
+ type CommonApi<TItem> = {
12
+ list: {
13
+ (params?: { pageToken: string | undefined }, options?: GoogleApis.Common.MethodOptions): Promise<GoogleApis.Common.GaxiosResponse<CommonResponse<TItem>>>;
14
+ (callback: (err: Error | null, res?: GoogleApis.Common.GaxiosResponse<CommonResponse<TItem>> | null) => void): void;
15
+ }
16
+ };
17
+
18
+ type CommonResponse<TItem> = {
19
+ items?: TItem[],
20
+ pageInfo?: {
21
+ totalResults?: number | null | undefined
22
+ },
23
+ nextPageToken?: string | null | undefined
24
+ };
25
+
26
+ class Api<TApi extends keyof typeof allApis> {
27
+ api: ReturnType<typeof allApis[TApi]>;
28
+ private auth: GoogleApis.Common.OAuth2Client;
29
+
30
+ private apiName: TApi;
31
+ private profile: string;
32
+ private authOptions?: AuthOptions;
33
+
34
+ constructor(apiName: TApi, profile: string, authOptions?: AuthOptions) {
35
+ this.apiName = apiName;
36
+ this.profile = profile;
37
+ this.authOptions = authOptions;
38
+ }
39
+
40
+ async init() {
41
+ this.auth = await getAuth(this.profile, this.authOptions);
42
+ this.api = allApis[this.apiName](this.auth) as ReturnType<typeof allApis[TApi]>;
43
+ }
44
+
45
+ async getItems<TItem>(selectAPI: (api: ReturnType<typeof allApis[TApi]>) => CommonApi<TItem>, params: any, options?: CommonOptions): Promise<TItem[]> {
46
+ const items: TItem[] = [];
47
+
48
+ let pageToken: string | null | undefined = undefined;
49
+
50
+ do {
51
+ let response: GoogleApis.Common.GaxiosResponse<CommonResponse<TItem>>;
52
+
53
+ try {
54
+ response = await selectAPI(this.api).list({ ...params, pageToken });
55
+ } catch (ex) {
56
+ if (ex.message === 'invalid_grant') {
57
+ deleteCredentials(this.profile);
58
+ await this.init();
59
+ return this.getItems(selectAPI, params, options);
60
+ } else {
61
+ throw ex;
62
+ }
63
+ }
64
+
65
+ response.data.items?.forEach((item) => items.push(item));
66
+
67
+ if (!options?.hideProgress) {
68
+ log(`Getting items (${items.length} of ${response.data.pageInfo?.totalResults || 'many'})...`);
69
+ }
70
+
71
+ await sleep(requestInterval);
72
+ pageToken = response.data.nextPageToken;
73
+ } while (pageToken);
74
+
75
+ return items;
76
+ }
77
+
78
+ async revoke() {
79
+ deleteCredentials(this.profile);
80
+ return this.auth.revokeCredentials();
81
+ }
82
+ }
83
+
84
+ async function getApi<TApi extends keyof typeof allApis>(apiName: TApi, profile: string, authOptions?: AuthOptions): Promise<Api<TApi>> {
85
+ const instance = new Api<TApi>(apiName, profile, authOptions);
86
+ await instance.init();
87
+ return instance;
88
+ }
89
+
90
+ /* istanbul ignore next */
91
+ const allApis = {
92
+ abusiveexperiencereport : (auth: GoogleApis.Common.OAuth2Client) => google.abusiveexperiencereport({ version : 'v1', auth }),
93
+ acceleratedmobilepageurl : (auth: GoogleApis.Common.OAuth2Client) => google.acceleratedmobilepageurl({ version : 'v1', auth }),
94
+ accessapproval : (auth: GoogleApis.Common.OAuth2Client) => google.accessapproval({ version : 'v1', auth }),
95
+ accesscontextmanager : (auth: GoogleApis.Common.OAuth2Client) => google.accesscontextmanager({ version : 'v1', auth }),
96
+ acmedns : (auth: GoogleApis.Common.OAuth2Client) => google.acmedns({ version : 'v1', auth }),
97
+ adexchangebuyer : (auth: GoogleApis.Common.OAuth2Client) => google.adexchangebuyer({ version : 'v1.2', auth }),
98
+ adexchangebuyer2 : (auth: GoogleApis.Common.OAuth2Client) => google.adexchangebuyer2({ version : 'v2beta1', auth }),
99
+ adexperiencereport : (auth: GoogleApis.Common.OAuth2Client) => google.adexperiencereport({ version : 'v1', auth }),
100
+ admin : (auth: GoogleApis.Common.OAuth2Client) => google.admin({ version : 'datatransfer_v1', auth }),
101
+ admob : (auth: GoogleApis.Common.OAuth2Client) => google.admob({ version : 'v1', auth }),
102
+ adsense : (auth: GoogleApis.Common.OAuth2Client) => google.adsense({ version : 'v1.4', auth }),
103
+ adsensehost : (auth: GoogleApis.Common.OAuth2Client) => google.adsensehost({ version : 'v4.1', auth }),
104
+ advisorynotifications : (auth: GoogleApis.Common.OAuth2Client) => google.advisorynotifications({ version : 'v1', auth }),
105
+ alertcenter : (auth: GoogleApis.Common.OAuth2Client) => google.alertcenter({ version : 'v1beta1', auth }),
106
+ analytics : (auth: GoogleApis.Common.OAuth2Client) => google.analytics({ version : 'v3', auth }),
107
+ analyticsadmin : (auth: GoogleApis.Common.OAuth2Client) => google.analyticsadmin({ version : 'v1alpha', auth }),
108
+ analyticsdata : (auth: GoogleApis.Common.OAuth2Client) => google.analyticsdata({ version : 'v1alpha', auth }),
109
+ analyticshub : (auth: GoogleApis.Common.OAuth2Client) => google.analyticshub({ version : 'v1', auth }),
110
+ analyticsreporting : (auth: GoogleApis.Common.OAuth2Client) => google.analyticsreporting({ version : 'v4', auth }),
111
+ androiddeviceprovisioning : (auth: GoogleApis.Common.OAuth2Client) => google.androiddeviceprovisioning({ version : 'v1', auth }),
112
+ androidenterprise : (auth: GoogleApis.Common.OAuth2Client) => google.androidenterprise({ version : 'v1', auth }),
113
+ androidmanagement : (auth: GoogleApis.Common.OAuth2Client) => google.androidmanagement({ version : 'v1', auth }),
114
+ androidpublisher : (auth: GoogleApis.Common.OAuth2Client) => google.androidpublisher({ version : 'v1.1', auth }),
115
+ apigateway : (auth: GoogleApis.Common.OAuth2Client) => google.apigateway({ version : 'v1', auth }),
116
+ apigeeregistry : (auth: GoogleApis.Common.OAuth2Client) => google.apigeeregistry({ version : 'v1', auth }),
117
+ apikeys : (auth: GoogleApis.Common.OAuth2Client) => google.apikeys({ version : 'v2', auth }),
118
+ appengine : (auth: GoogleApis.Common.OAuth2Client) => google.appengine({ version : 'v1', auth }),
119
+ appsactivity : (auth: GoogleApis.Common.OAuth2Client) => google.appsactivity({ version : 'v1', auth }),
120
+ area120tables : (auth: GoogleApis.Common.OAuth2Client) => google.area120tables({ version : 'v1alpha1', auth }),
121
+ artifactregistry : (auth: GoogleApis.Common.OAuth2Client) => google.artifactregistry({ version : 'v1', auth }),
122
+ assuredworkloads : (auth: GoogleApis.Common.OAuth2Client) => google.assuredworkloads({ version : 'v1', auth }),
123
+ authorizedbuyersmarketplace : (auth: GoogleApis.Common.OAuth2Client) => google.authorizedbuyersmarketplace({ version : 'v1', auth }),
124
+ baremetalsolution : (auth: GoogleApis.Common.OAuth2Client) => google.baremetalsolution({ version : 'v1', auth }),
125
+ batch : (auth: GoogleApis.Common.OAuth2Client) => google.batch({ version : 'v1', auth }),
126
+ beyondcorp : (auth: GoogleApis.Common.OAuth2Client) => google.beyondcorp({ version : 'v1', auth }),
127
+ bigquery : (auth: GoogleApis.Common.OAuth2Client) => google.bigquery({ version : 'v2', auth }),
128
+ bigqueryconnection : (auth: GoogleApis.Common.OAuth2Client) => google.bigqueryconnection({ version : 'v1beta1', auth }),
129
+ bigquerydatatransfer : (auth: GoogleApis.Common.OAuth2Client) => google.bigquerydatatransfer({ version : 'v1', auth }),
130
+ bigqueryreservation : (auth: GoogleApis.Common.OAuth2Client) => google.bigqueryreservation({ version : 'v1', auth }),
131
+ bigtableadmin : (auth: GoogleApis.Common.OAuth2Client) => google.bigtableadmin({ version : 'v1', auth }),
132
+ billingbudgets : (auth: GoogleApis.Common.OAuth2Client) => google.billingbudgets({ version : 'v1', auth }),
133
+ binaryauthorization : (auth: GoogleApis.Common.OAuth2Client) => google.binaryauthorization({ version : 'v1', auth }),
134
+ blogger : (auth: GoogleApis.Common.OAuth2Client) => google.blogger({ version : 'v2', auth }),
135
+ books : (auth: GoogleApis.Common.OAuth2Client) => google.books({ version : 'v1', auth }),
136
+ businessprofileperformance : (auth: GoogleApis.Common.OAuth2Client) => google.businessprofileperformance({ version : 'v1', auth }),
137
+ calendar : (auth: GoogleApis.Common.OAuth2Client) => google.calendar({ version : 'v3', auth }),
138
+ certificatemanager : (auth: GoogleApis.Common.OAuth2Client) => google.certificatemanager({ version : 'v1', auth }),
139
+ chat : (auth: GoogleApis.Common.OAuth2Client) => google.chat({ version : 'v1', auth }),
140
+ chromemanagement : (auth: GoogleApis.Common.OAuth2Client) => google.chromemanagement({ version : 'v1', auth }),
141
+ chromepolicy : (auth: GoogleApis.Common.OAuth2Client) => google.chromepolicy({ version : 'v1', auth }),
142
+ chromeuxreport : (auth: GoogleApis.Common.OAuth2Client) => google.chromeuxreport({ version : 'v1', auth }),
143
+ civicinfo : (auth: GoogleApis.Common.OAuth2Client) => google.civicinfo({ version : 'v2', auth }),
144
+ classroom : (auth: GoogleApis.Common.OAuth2Client) => google.classroom({ version : 'v1', auth }),
145
+ cloudasset : (auth: GoogleApis.Common.OAuth2Client) => google.cloudasset({ version : 'v1', auth }),
146
+ cloudbilling : (auth: GoogleApis.Common.OAuth2Client) => google.cloudbilling({ version : 'v1', auth }),
147
+ cloudbuild : (auth: GoogleApis.Common.OAuth2Client) => google.cloudbuild({ version : 'v1', auth }),
148
+ cloudchannel : (auth: GoogleApis.Common.OAuth2Client) => google.cloudchannel({ version : 'v1', auth }),
149
+ clouddebugger : (auth: GoogleApis.Common.OAuth2Client) => google.clouddebugger({ version : 'v2', auth }),
150
+ clouddeploy : (auth: GoogleApis.Common.OAuth2Client) => google.clouddeploy({ version : 'v1', auth }),
151
+ clouderrorreporting : (auth: GoogleApis.Common.OAuth2Client) => google.clouderrorreporting({ version : 'v1beta1', auth }),
152
+ cloudfunctions : (auth: GoogleApis.Common.OAuth2Client) => google.cloudfunctions({ version : 'v1', auth }),
153
+ cloudidentity : (auth: GoogleApis.Common.OAuth2Client) => google.cloudidentity({ version : 'v1', auth }),
154
+ cloudiot : (auth: GoogleApis.Common.OAuth2Client) => google.cloudiot({ version : 'v1', auth }),
155
+ cloudkms : (auth: GoogleApis.Common.OAuth2Client) => google.cloudkms({ version : 'v1', auth }),
156
+ cloudprofiler : (auth: GoogleApis.Common.OAuth2Client) => google.cloudprofiler({ version : 'v2', auth }),
157
+ cloudresourcemanager : (auth: GoogleApis.Common.OAuth2Client) => google.cloudresourcemanager({ version : 'v1', auth }),
158
+ cloudscheduler : (auth: GoogleApis.Common.OAuth2Client) => google.cloudscheduler({ version : 'v1', auth }),
159
+ cloudsearch : (auth: GoogleApis.Common.OAuth2Client) => google.cloudsearch({ version : 'v1', auth }),
160
+ cloudshell : (auth: GoogleApis.Common.OAuth2Client) => google.cloudshell({ version : 'v1', auth }),
161
+ cloudsupport : (auth: GoogleApis.Common.OAuth2Client) => google.cloudsupport({ version : 'v2beta', auth }),
162
+ cloudtasks : (auth: GoogleApis.Common.OAuth2Client) => google.cloudtasks({ version : 'v2', auth }),
163
+ cloudtrace : (auth: GoogleApis.Common.OAuth2Client) => google.cloudtrace({ version : 'v1', auth }),
164
+ composer : (auth: GoogleApis.Common.OAuth2Client) => google.composer({ version : 'v1', auth }),
165
+ compute : (auth: GoogleApis.Common.OAuth2Client) => google.compute({ version : 'alpha', auth }),
166
+ connectors : (auth: GoogleApis.Common.OAuth2Client) => google.connectors({ version : 'v1', auth }),
167
+ contactcenteraiplatform : (auth: GoogleApis.Common.OAuth2Client) => google.contactcenteraiplatform({ version : 'v1alpha1', auth }),
168
+ contactcenterinsights : (auth: GoogleApis.Common.OAuth2Client) => google.contactcenterinsights({ version : 'v1', auth }),
169
+ container : (auth: GoogleApis.Common.OAuth2Client) => google.container({ version : 'v1', auth }),
170
+ containeranalysis : (auth: GoogleApis.Common.OAuth2Client) => google.containeranalysis({ version : 'v1', auth }),
171
+ content : (auth: GoogleApis.Common.OAuth2Client) => google.content({ version : 'v2.1', auth }),
172
+ contentwarehouse : (auth: GoogleApis.Common.OAuth2Client) => google.contentwarehouse({ version : 'v1', auth }),
173
+ customsearch : (auth: GoogleApis.Common.OAuth2Client) => google.customsearch({ version : 'v1', auth }),
174
+ datacatalog : (auth: GoogleApis.Common.OAuth2Client) => google.datacatalog({ version : 'v1', auth }),
175
+ dataflow : (auth: GoogleApis.Common.OAuth2Client) => google.dataflow({ version : 'v1b3', auth }),
176
+ dataform : (auth: GoogleApis.Common.OAuth2Client) => google.dataform({ version : 'v1beta1', auth }),
177
+ datafusion : (auth: GoogleApis.Common.OAuth2Client) => google.datafusion({ version : 'v1', auth }),
178
+ datalabeling : (auth: GoogleApis.Common.OAuth2Client) => google.datalabeling({ version : 'v1beta1', auth }),
179
+ datalineage : (auth: GoogleApis.Common.OAuth2Client) => google.datalineage({ version : 'v1', auth }),
180
+ datamigration : (auth: GoogleApis.Common.OAuth2Client) => google.datamigration({ version : 'v1', auth }),
181
+ datapipelines : (auth: GoogleApis.Common.OAuth2Client) => google.datapipelines({ version : 'v1', auth }),
182
+ dataplex : (auth: GoogleApis.Common.OAuth2Client) => google.dataplex({ version : 'v1', auth }),
183
+ dataproc : (auth: GoogleApis.Common.OAuth2Client) => google.dataproc({ version : 'v1', auth }),
184
+ datastore : (auth: GoogleApis.Common.OAuth2Client) => google.datastore({ version : 'v1', auth }),
185
+ datastream : (auth: GoogleApis.Common.OAuth2Client) => google.datastream({ version : 'v1', auth }),
186
+ deploymentmanager : (auth: GoogleApis.Common.OAuth2Client) => google.deploymentmanager({ version : 'alpha', auth }),
187
+ dfareporting : (auth: GoogleApis.Common.OAuth2Client) => google.dfareporting({ version : 'v3.3', auth }),
188
+ dialogflow : (auth: GoogleApis.Common.OAuth2Client) => google.dialogflow({ version : 'v2', auth }),
189
+ digitalassetlinks : (auth: GoogleApis.Common.OAuth2Client) => google.digitalassetlinks({ version : 'v1', auth }),
190
+ discovery : (auth: GoogleApis.Common.OAuth2Client) => google.discovery({ version : 'v1', auth }),
191
+ discoveryengine : (auth: GoogleApis.Common.OAuth2Client) => google.discoveryengine({ version : 'v1alpha', auth }),
192
+ displayvideo : (auth: GoogleApis.Common.OAuth2Client) => google.displayvideo({ version : 'v1', auth }),
193
+ dlp : (auth: GoogleApis.Common.OAuth2Client) => google.dlp({ version : 'v2', auth }),
194
+ dns : (auth: GoogleApis.Common.OAuth2Client) => google.dns({ version : 'v1', auth }),
195
+ docs : (auth: GoogleApis.Common.OAuth2Client) => google.docs({ version : 'v1', auth }),
196
+ documentai : (auth: GoogleApis.Common.OAuth2Client) => google.documentai({ version : 'v1', auth }),
197
+ domains : (auth: GoogleApis.Common.OAuth2Client) => google.domains({ version : 'v1', auth }),
198
+ domainsrdap : (auth: GoogleApis.Common.OAuth2Client) => google.domainsrdap({ version : 'v1', auth }),
199
+ doubleclickbidmanager : (auth: GoogleApis.Common.OAuth2Client) => google.doubleclickbidmanager({ version : 'v1.1', auth }),
200
+ doubleclicksearch : (auth: GoogleApis.Common.OAuth2Client) => google.doubleclicksearch({ version : 'v2', auth }),
201
+ drive : (auth: GoogleApis.Common.OAuth2Client) => google.drive({ version : 'v2', auth }),
202
+ driveactivity : (auth: GoogleApis.Common.OAuth2Client) => google.driveactivity({ version : 'v2', auth }),
203
+ drivelabels : (auth: GoogleApis.Common.OAuth2Client) => google.drivelabels({ version : 'v2', auth }),
204
+ essentialcontacts : (auth: GoogleApis.Common.OAuth2Client) => google.essentialcontacts({ version : 'v1', auth }),
205
+ eventarc : (auth: GoogleApis.Common.OAuth2Client) => google.eventarc({ version : 'v1', auth }),
206
+ factchecktools : (auth: GoogleApis.Common.OAuth2Client) => google.factchecktools({ version : 'v1alpha1', auth }),
207
+ fcm : (auth: GoogleApis.Common.OAuth2Client) => google.fcm({ version : 'v1', auth }),
208
+ fcmdata : (auth: GoogleApis.Common.OAuth2Client) => google.fcmdata({ version : 'v1beta1', auth }),
209
+ file : (auth: GoogleApis.Common.OAuth2Client) => google.file({ version : 'v1', auth }),
210
+ firebase : (auth: GoogleApis.Common.OAuth2Client) => google.firebase({ version : 'v1beta1', auth }),
211
+ firebaseappcheck : (auth: GoogleApis.Common.OAuth2Client) => google.firebaseappcheck({ version : 'v1', auth }),
212
+ firebaseappdistribution : (auth: GoogleApis.Common.OAuth2Client) => google.firebaseappdistribution({ version : 'v1', auth }),
213
+ firebasedatabase : (auth: GoogleApis.Common.OAuth2Client) => google.firebasedatabase({ version : 'v1beta', auth }),
214
+ firebasedynamiclinks : (auth: GoogleApis.Common.OAuth2Client) => google.firebasedynamiclinks({ version : 'v1', auth }),
215
+ firebasehosting : (auth: GoogleApis.Common.OAuth2Client) => google.firebasehosting({ version : 'v1', auth }),
216
+ firebaseml : (auth: GoogleApis.Common.OAuth2Client) => google.firebaseml({ version : 'v1', auth }),
217
+ firebaserules : (auth: GoogleApis.Common.OAuth2Client) => google.firebaserules({ version : 'v1', auth }),
218
+ firebasestorage : (auth: GoogleApis.Common.OAuth2Client) => google.firebasestorage({ version : 'v1beta', auth }),
219
+ firestore : (auth: GoogleApis.Common.OAuth2Client) => google.firestore({ version : 'v1', auth }),
220
+ fitness : (auth: GoogleApis.Common.OAuth2Client) => google.fitness({ version : 'v1', auth }),
221
+ forms : (auth: GoogleApis.Common.OAuth2Client) => google.forms({ version : 'v1', auth }),
222
+ games : (auth: GoogleApis.Common.OAuth2Client) => google.games({ version : 'v1', auth }),
223
+ gamesConfiguration : (auth: GoogleApis.Common.OAuth2Client) => google.gamesConfiguration({ version : 'v1configuration', auth }),
224
+ gameservices : (auth: GoogleApis.Common.OAuth2Client) => google.gameservices({ version : 'v1', auth }),
225
+ gamesManagement : (auth: GoogleApis.Common.OAuth2Client) => google.gamesManagement({ version : 'v1management', auth }),
226
+ genomics : (auth: GoogleApis.Common.OAuth2Client) => google.genomics({ version : 'v1', auth }),
227
+ gkebackup : (auth: GoogleApis.Common.OAuth2Client) => google.gkebackup({ version : 'v1', auth }),
228
+ gkehub : (auth: GoogleApis.Common.OAuth2Client) => google.gkehub({ version : 'v1', auth }),
229
+ gmail : (auth: GoogleApis.Common.OAuth2Client) => google.gmail({ version : 'v1', auth }),
230
+ gmailpostmastertools : (auth: GoogleApis.Common.OAuth2Client) => google.gmailpostmastertools({ version : 'v1', auth }),
231
+ groupsmigration : (auth: GoogleApis.Common.OAuth2Client) => google.groupsmigration({ version : 'v1', auth }),
232
+ groupssettings : (auth: GoogleApis.Common.OAuth2Client) => google.groupssettings({ version : 'v1', auth }),
233
+ healthcare : (auth: GoogleApis.Common.OAuth2Client) => google.healthcare({ version : 'v1', auth }),
234
+ homegraph : (auth: GoogleApis.Common.OAuth2Client) => google.homegraph({ version : 'v1', auth }),
235
+ iam : (auth: GoogleApis.Common.OAuth2Client) => google.iam({ version : 'v1', auth }),
236
+ iamcredentials : (auth: GoogleApis.Common.OAuth2Client) => google.iamcredentials({ version : 'v1', auth }),
237
+ iap : (auth: GoogleApis.Common.OAuth2Client) => google.iap({ version : 'v1', auth }),
238
+ ideahub : (auth: GoogleApis.Common.OAuth2Client) => google.ideahub({ version : 'v1alpha', auth }),
239
+ identitytoolkit : (auth: GoogleApis.Common.OAuth2Client) => google.identitytoolkit({ version : 'v2', auth }),
240
+ ids : (auth: GoogleApis.Common.OAuth2Client) => google.ids({ version : 'v1', auth }),
241
+ indexing : (auth: GoogleApis.Common.OAuth2Client) => google.indexing({ version : 'v3', auth }),
242
+ integrations : (auth: GoogleApis.Common.OAuth2Client) => google.integrations({ version : 'v1alpha', auth }),
243
+ jobs : (auth: GoogleApis.Common.OAuth2Client) => google.jobs({ version : 'v2', auth }),
244
+ kgsearch : (auth: GoogleApis.Common.OAuth2Client) => google.kgsearch({ version : 'v1', auth }),
245
+ kmsinventory : (auth: GoogleApis.Common.OAuth2Client) => google.kmsinventory({ version : 'v1', auth }),
246
+ language : (auth: GoogleApis.Common.OAuth2Client) => google.language({ version : 'v1', auth }),
247
+ libraryagent : (auth: GoogleApis.Common.OAuth2Client) => google.libraryagent({ version : 'v1', auth }),
248
+ licensing : (auth: GoogleApis.Common.OAuth2Client) => google.licensing({ version : 'v1', auth }),
249
+ lifesciences : (auth: GoogleApis.Common.OAuth2Client) => google.lifesciences({ version : 'v2beta', auth }),
250
+ localservices : (auth: GoogleApis.Common.OAuth2Client) => google.localservices({ version : 'v1', auth }),
251
+ logging : (auth: GoogleApis.Common.OAuth2Client) => google.logging({ version : 'v2', auth }),
252
+ managedidentities : (auth: GoogleApis.Common.OAuth2Client) => google.managedidentities({ version : 'v1', auth }),
253
+ manufacturers : (auth: GoogleApis.Common.OAuth2Client) => google.manufacturers({ version : 'v1', auth }),
254
+ memcache : (auth: GoogleApis.Common.OAuth2Client) => google.memcache({ version : 'v1', auth }),
255
+ metastore : (auth: GoogleApis.Common.OAuth2Client) => google.metastore({ version : 'v1', auth }),
256
+ migrationcenter : (auth: GoogleApis.Common.OAuth2Client) => google.migrationcenter({ version : 'v1alpha1', auth }),
257
+ ml : (auth: GoogleApis.Common.OAuth2Client) => google.ml({ version : 'v1', auth }),
258
+ monitoring : (auth: GoogleApis.Common.OAuth2Client) => google.monitoring({ version : 'v1', auth }),
259
+ mybusinessaccountmanagement : (auth: GoogleApis.Common.OAuth2Client) => google.mybusinessaccountmanagement({ version : 'v1', auth }),
260
+ mybusinessbusinesscalls : (auth: GoogleApis.Common.OAuth2Client) => google.mybusinessbusinesscalls({ version : 'v1', auth }),
261
+ mybusinessbusinessinformation : (auth: GoogleApis.Common.OAuth2Client) => google.mybusinessbusinessinformation({ version : 'v1', auth }),
262
+ mybusinesslodging : (auth: GoogleApis.Common.OAuth2Client) => google.mybusinesslodging({ version : 'v1', auth }),
263
+ mybusinessnotifications : (auth: GoogleApis.Common.OAuth2Client) => google.mybusinessnotifications({ version : 'v1', auth }),
264
+ mybusinessplaceactions : (auth: GoogleApis.Common.OAuth2Client) => google.mybusinessplaceactions({ version : 'v1', auth }),
265
+ mybusinessqanda : (auth: GoogleApis.Common.OAuth2Client) => google.mybusinessqanda({ version : 'v1', auth }),
266
+ mybusinessverifications : (auth: GoogleApis.Common.OAuth2Client) => google.mybusinessverifications({ version : 'v1', auth }),
267
+ networkconnectivity : (auth: GoogleApis.Common.OAuth2Client) => google.networkconnectivity({ version : 'v1', auth }),
268
+ networkmanagement : (auth: GoogleApis.Common.OAuth2Client) => google.networkmanagement({ version : 'v1', auth }),
269
+ networksecurity : (auth: GoogleApis.Common.OAuth2Client) => google.networksecurity({ version : 'v1', auth }),
270
+ networkservices : (auth: GoogleApis.Common.OAuth2Client) => google.networkservices({ version : 'v1', auth }),
271
+ notebooks : (auth: GoogleApis.Common.OAuth2Client) => google.notebooks({ version : 'v1', auth }),
272
+ oauth2 : (auth: GoogleApis.Common.OAuth2Client) => google.oauth2({ version : 'v2', auth }),
273
+ ondemandscanning : (auth: GoogleApis.Common.OAuth2Client) => google.ondemandscanning({ version : 'v1', auth }),
274
+ orgpolicy : (auth: GoogleApis.Common.OAuth2Client) => google.orgpolicy({ version : 'v2', auth }),
275
+ osconfig : (auth: GoogleApis.Common.OAuth2Client) => google.osconfig({ version : 'v1', auth }),
276
+ oslogin : (auth: GoogleApis.Common.OAuth2Client) => google.oslogin({ version : 'v1', auth }),
277
+ pagespeedonline : (auth: GoogleApis.Common.OAuth2Client) => google.pagespeedonline({ version : 'v5', auth }),
278
+ paymentsresellersubscription : (auth: GoogleApis.Common.OAuth2Client) => google.paymentsresellersubscription({ version : 'v1', auth }),
279
+ people : (auth: GoogleApis.Common.OAuth2Client) => google.people({ version : 'v1', auth }),
280
+ playablelocations : (auth: GoogleApis.Common.OAuth2Client) => google.playablelocations({ version : 'v3', auth }),
281
+ playcustomapp : (auth: GoogleApis.Common.OAuth2Client) => google.playcustomapp({ version : 'v1', auth }),
282
+ playdeveloperreporting : (auth: GoogleApis.Common.OAuth2Client) => google.playdeveloperreporting({ version : 'v1alpha1', auth }),
283
+ playintegrity : (auth: GoogleApis.Common.OAuth2Client) => google.playintegrity({ version : 'v1', auth }),
284
+ plus : (auth: GoogleApis.Common.OAuth2Client) => google.plus({ version : 'v1', auth }),
285
+ policyanalyzer : (auth: GoogleApis.Common.OAuth2Client) => google.policyanalyzer({ version : 'v1', auth }),
286
+ policysimulator : (auth: GoogleApis.Common.OAuth2Client) => google.policysimulator({ version : 'v1', auth }),
287
+ policytroubleshooter : (auth: GoogleApis.Common.OAuth2Client) => google.policytroubleshooter({ version : 'v1', auth }),
288
+ poly : (auth: GoogleApis.Common.OAuth2Client) => google.poly({ version : 'v1', auth }),
289
+ privateca : (auth: GoogleApis.Common.OAuth2Client) => google.privateca({ version : 'v1', auth }),
290
+ // eslint-disable-next-line camelcase
291
+ prod_tt_sasportal : (auth: GoogleApis.Common.OAuth2Client) => google.prod_tt_sasportal({ version : 'v1alpha1', auth }),
292
+ publicca : (auth: GoogleApis.Common.OAuth2Client) => google.publicca({ version : 'v1alpha1', auth }),
293
+ pubsub : (auth: GoogleApis.Common.OAuth2Client) => google.pubsub({ version : 'v1', auth }),
294
+ pubsublite : (auth: GoogleApis.Common.OAuth2Client) => google.pubsublite({ version : 'v1', auth }),
295
+ readerrevenuesubscriptionlinking : (auth: GoogleApis.Common.OAuth2Client) => google.readerrevenuesubscriptionlinking({ version : 'v1', auth }),
296
+ realtimebidding : (auth: GoogleApis.Common.OAuth2Client) => google.realtimebidding({ version : 'v1', auth }),
297
+ recaptchaenterprise : (auth: GoogleApis.Common.OAuth2Client) => google.recaptchaenterprise({ version : 'v1', auth }),
298
+ recommendationengine : (auth: GoogleApis.Common.OAuth2Client) => google.recommendationengine({ version : 'v1beta1', auth }),
299
+ recommender : (auth: GoogleApis.Common.OAuth2Client) => google.recommender({ version : 'v1', auth }),
300
+ redis : (auth: GoogleApis.Common.OAuth2Client) => google.redis({ version : 'v1', auth }),
301
+ remotebuildexecution : (auth: GoogleApis.Common.OAuth2Client) => google.remotebuildexecution({ version : 'v1', auth }),
302
+ reseller : (auth: GoogleApis.Common.OAuth2Client) => google.reseller({ version : 'v1', auth }),
303
+ resourcesettings : (auth: GoogleApis.Common.OAuth2Client) => google.resourcesettings({ version : 'v1', auth }),
304
+ retail : (auth: GoogleApis.Common.OAuth2Client) => google.retail({ version : 'v2', auth }),
305
+ run : (auth: GoogleApis.Common.OAuth2Client) => google.run({ version : 'v1', auth }),
306
+ runtimeconfig : (auth: GoogleApis.Common.OAuth2Client) => google.runtimeconfig({ version : 'v1', auth }),
307
+ safebrowsing : (auth: GoogleApis.Common.OAuth2Client) => google.safebrowsing({ version : 'v4', auth }),
308
+ sasportal : (auth: GoogleApis.Common.OAuth2Client) => google.sasportal({ version : 'v1alpha1', auth }),
309
+ script : (auth: GoogleApis.Common.OAuth2Client) => google.script({ version : 'v1', auth }),
310
+ searchads360 : (auth: GoogleApis.Common.OAuth2Client) => google.searchads360({ version : 'v0', auth }),
311
+ searchconsole : (auth: GoogleApis.Common.OAuth2Client) => google.searchconsole({ version : 'v1', auth }),
312
+ secretmanager : (auth: GoogleApis.Common.OAuth2Client) => google.secretmanager({ version : 'v1', auth }),
313
+ securitycenter : (auth: GoogleApis.Common.OAuth2Client) => google.securitycenter({ version : 'v1', auth }),
314
+ serviceconsumermanagement : (auth: GoogleApis.Common.OAuth2Client) => google.serviceconsumermanagement({ version : 'v1', auth }),
315
+ servicecontrol : (auth: GoogleApis.Common.OAuth2Client) => google.servicecontrol({ version : 'v1', auth }),
316
+ servicedirectory : (auth: GoogleApis.Common.OAuth2Client) => google.servicedirectory({ version : 'v1', auth }),
317
+ servicemanagement : (auth: GoogleApis.Common.OAuth2Client) => google.servicemanagement({ version : 'v1', auth }),
318
+ servicenetworking : (auth: GoogleApis.Common.OAuth2Client) => google.servicenetworking({ version : 'v1', auth }),
319
+ serviceusage : (auth: GoogleApis.Common.OAuth2Client) => google.serviceusage({ version : 'v1', auth }),
320
+ sheets : (auth: GoogleApis.Common.OAuth2Client) => google.sheets({ version : 'v4', auth }),
321
+ siteVerification : (auth: GoogleApis.Common.OAuth2Client) => google.siteVerification({ version : 'v1', auth }),
322
+ slides : (auth: GoogleApis.Common.OAuth2Client) => google.slides({ version : 'v1', auth }),
323
+ smartdevicemanagement : (auth: GoogleApis.Common.OAuth2Client) => google.smartdevicemanagement({ version : 'v1', auth }),
324
+ sourcerepo : (auth: GoogleApis.Common.OAuth2Client) => google.sourcerepo({ version : 'v1', auth }),
325
+ spanner : (auth: GoogleApis.Common.OAuth2Client) => google.spanner({ version : 'v1', auth }),
326
+ speech : (auth: GoogleApis.Common.OAuth2Client) => google.speech({ version : 'v1', auth }),
327
+ sql : (auth: GoogleApis.Common.OAuth2Client) => google.sql({ version : 'v1beta4', auth }),
328
+ sqladmin : (auth: GoogleApis.Common.OAuth2Client) => google.sqladmin({ version : 'v1', auth }),
329
+ storage : (auth: GoogleApis.Common.OAuth2Client) => google.storage({ version : 'v1', auth }),
330
+ storagetransfer : (auth: GoogleApis.Common.OAuth2Client) => google.storagetransfer({ version : 'v1', auth }),
331
+ streetviewpublish : (auth: GoogleApis.Common.OAuth2Client) => google.streetviewpublish({ version : 'v1', auth }),
332
+ sts : (auth: GoogleApis.Common.OAuth2Client) => google.sts({ version : 'v1', auth }),
333
+ tagmanager : (auth: GoogleApis.Common.OAuth2Client) => google.tagmanager({ version : 'v1', auth }),
334
+ tasks : (auth: GoogleApis.Common.OAuth2Client) => google.tasks({ version : 'v1', auth }),
335
+ testing : (auth: GoogleApis.Common.OAuth2Client) => google.testing({ version : 'v1', auth }),
336
+ texttospeech : (auth: GoogleApis.Common.OAuth2Client) => google.texttospeech({ version : 'v1', auth }),
337
+ toolresults : (auth: GoogleApis.Common.OAuth2Client) => google.toolresults({ version : 'v1beta3', auth }),
338
+ tpu : (auth: GoogleApis.Common.OAuth2Client) => google.tpu({ version : 'v1', auth }),
339
+ trafficdirector : (auth: GoogleApis.Common.OAuth2Client) => google.trafficdirector({ version : 'v2', auth }),
340
+ transcoder : (auth: GoogleApis.Common.OAuth2Client) => google.transcoder({ version : 'v1', auth }),
341
+ translate : (auth: GoogleApis.Common.OAuth2Client) => google.translate({ version : 'v2', auth }),
342
+ travelimpactmodel : (auth: GoogleApis.Common.OAuth2Client) => google.travelimpactmodel({ version : 'v1', auth }),
343
+ vault : (auth: GoogleApis.Common.OAuth2Client) => google.vault({ version : 'v1', auth }),
344
+ vectortile : (auth: GoogleApis.Common.OAuth2Client) => google.vectortile({ version : 'v1', auth }),
345
+ verifiedaccess : (auth: GoogleApis.Common.OAuth2Client) => google.verifiedaccess({ version : 'v1', auth }),
346
+ versionhistory : (auth: GoogleApis.Common.OAuth2Client) => google.versionhistory({ version : 'v1', auth }),
347
+ videointelligence : (auth: GoogleApis.Common.OAuth2Client) => google.videointelligence({ version : 'v1', auth }),
348
+ vision : (auth: GoogleApis.Common.OAuth2Client) => google.vision({ version : 'v1', auth }),
349
+ vmmigration : (auth: GoogleApis.Common.OAuth2Client) => google.vmmigration({ version : 'v1', auth }),
350
+ vpcaccess : (auth: GoogleApis.Common.OAuth2Client) => google.vpcaccess({ version : 'v1', auth }),
351
+ webfonts : (auth: GoogleApis.Common.OAuth2Client) => google.webfonts({ version : 'v1', auth }),
352
+ webmasters : (auth: GoogleApis.Common.OAuth2Client) => google.webmasters({ version : 'v3', auth }),
353
+ webrisk : (auth: GoogleApis.Common.OAuth2Client) => google.webrisk({ version : 'v1', auth }),
354
+ websecurityscanner : (auth: GoogleApis.Common.OAuth2Client) => google.websecurityscanner({ version : 'v1', auth }),
355
+ workflowexecutions : (auth: GoogleApis.Common.OAuth2Client) => google.workflowexecutions({ version : 'v1', auth }),
356
+ workflows : (auth: GoogleApis.Common.OAuth2Client) => google.workflows({ version : 'v1', auth }),
357
+ workloadmanager : (auth: GoogleApis.Common.OAuth2Client) => google.workloadmanager({ version : 'v1', auth }),
358
+ workstations : (auth: GoogleApis.Common.OAuth2Client) => google.workstations({ version : 'v1beta', auth }),
359
+ youtube : (auth: GoogleApis.Common.OAuth2Client) => google.youtube({ version : 'v3', auth }),
360
+ youtubeAnalytics : (auth: GoogleApis.Common.OAuth2Client) => google.youtubeAnalytics({ version : 'v1', auth }),
361
+ youtubereporting : (auth: GoogleApis.Common.OAuth2Client) => google.youtubereporting({ version : 'v1', auth }),
362
+ } as const;
363
+
364
+ export { getApi };
365
+ export default { getApi, Api };
@@ -10,8 +10,8 @@ import { getScopesFile, getSecretsFile, getCredentialsFile } from './paths';
10
10
 
11
11
  import secrets from './secrets';
12
12
 
13
- export { getSecrets, getCredentials };
14
- export default { getScopes, getSecrets, getCredentials, validateCredentials, createCredentials, checkSecrets, getSecretsError, getScopesError };
13
+ export { getSecrets, getCredentials, deleteCredentials };
14
+ export default { getScopes, getSecrets, getCredentials, validateCredentials, createCredentials, deleteCredentials, checkSecrets, getSecretsError, getScopesError };
15
15
 
16
16
  const port = 6006;
17
17
  const host = `localhost:${port}`;
@@ -124,6 +124,14 @@ async function createCredentials(profile: string, auth: GoogleApis.Auth.OAuth2Cl
124
124
  });
125
125
  }
126
126
 
127
+ function deleteCredentials(profile: string): void {
128
+ const credentialsFile = getCredentialsFile(profile);
129
+
130
+ if (fs.existsSync(credentialsFile)) {
131
+ fs.rmSync(credentialsFile);
132
+ }
133
+ }
134
+
127
135
  function formatMessage(message: string): string {
128
136
  return [
129
137
  '<div style="width: 100%;height: 100%;display: flex;align-items: start;justify-content: center">',