Skip to content

Commit db23f5e

Browse files
committed
refactor: update OAuth2Client references to AuthClient
- Changed return types and parameter types from OAuth2Client to AuthClient in adminSDK/reports, adminSDK/reseller, apps-script/quickstart, calendar/quickstart, chat/client-libraries/cloud/authentication-utils, chat/quickstart, classroom/quickstart, docs/quickstart, drive/activity-v2, drive/quickstart, gmail/quickstart, meet/quickstart, people/quickstart, sheets/quickstart, slides/quickstart, and tasks/quickstart. - Removed deprecated package.json and tsconfig.json files from drive/snippets/files. - Updated package.json to override google-auth-library version to 10.3.0. - Cleaned up pnpm-lock.yaml by removing outdated dependencies and ensuring consistency in google-auth-library versioning.
1 parent b684831 commit db23f5e

File tree

21 files changed

+90
-221
lines changed

21 files changed

+90
-221
lines changed

adminSDK/directory/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const CREDENTIALS_PATH = path.join(process.cwd(), 'credentials.json');
3232
/**
3333
* Reads previously authorized credentials from the save file.
3434
*
35-
* @return {Promise<OAuth2Client|null>}
35+
* @return {Promise<import("google-auth-library").AuthClient|null>}
3636
*/
3737
async function loadSavedCredentialsIfExist() {
3838
try {
@@ -47,7 +47,7 @@ async function loadSavedCredentialsIfExist() {
4747
/**
4848
* Serializes credentials to a file compatible with GoogleAuth.fromJSON.
4949
*
50-
* @param {OAuth2Client} client
50+
* @param {import("google-auth-library").AuthClient} client
5151
* @return {Promise<void>}
5252
*/
5353
async function saveCredentials(client) {
@@ -85,7 +85,7 @@ async function authorize() {
8585
/**
8686
* Lists the first 10 users in the domain.
8787
*
88-
* @param {google.auth.OAuth2} auth An authorized OAuth2 client.
88+
* @param {import("google-auth-library").AuthClient} auth An authorized OAuth2 client.
8989
*/
9090
async function listUsers(auth) {
9191
const service = google.admin({version: 'directory_v1', auth});

adminSDK/reports/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const CREDENTIALS_PATH = path.join(process.cwd(), 'credentials.json');
3232
/**
3333
* Reads previously authorized credentials from the save file.
3434
*
35-
* @return {Promise<OAuth2Client|null>}
35+
* @return {Promise<import("google-auth-library").AuthClient|null>}
3636
*/
3737
async function loadSavedCredentialsIfExist() {
3838
try {
@@ -47,7 +47,7 @@ async function loadSavedCredentialsIfExist() {
4747
/**
4848
* Serializes credentials to a file compatible with GoogleAuth.fromJSON.
4949
*
50-
* @param {OAuth2Client} client
50+
* @param {import("google-auth-library").AuthClient} client
5151
* @return {Promise<void>}
5252
*/
5353
async function saveCredentials(client) {
@@ -85,7 +85,7 @@ async function authorize() {
8585
/**
8686
* Lists the last 10 login events for the domain.
8787
*
88-
* @param {google.auth.OAuth2} auth An authorized OAuth2 client.
88+
* @param {import("google-auth-library").AuthClient} auth An authorized OAuth2 client.
8989
*/
9090
async function listLoginEvents(auth) {
9191
const service = google.admin({version: 'reports_v1', auth});

adminSDK/reseller/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const CREDENTIALS_PATH = path.join(process.cwd(), 'credentials.json');
3232
/**
3333
* Reads previously authorized credentials from the save file.
3434
*
35-
* @return {Promise<OAuth2Client|null>}
35+
* @return {Promise<import("google-auth-library").AuthClient|null>}
3636
*/
3737
async function loadSavedCredentialsIfExist() {
3838
try {
@@ -47,7 +47,7 @@ async function loadSavedCredentialsIfExist() {
4747
/**
4848
* Serializes credentials to a file compatible with GoogleAuth.fromJSON.
4949
*
50-
* @param {OAuth2Client} client
50+
* @param {import("google-auth-library").AuthClient} client
5151
* @return {Promise<void>}
5252
*/
5353
async function saveCredentials(client) {
@@ -85,7 +85,7 @@ async function authorize() {
8585
/**
8686
* Lists the first 10 subscriptions you manage.
8787
*
88-
* @param {google.auth.OAuth2} auth An authorized OAuth2 client.
88+
* @param {import("google-auth-library").AuthClient} auth An authorized OAuth2 client.
8989
*/
9090
async function listSubscriptions(auth) {
9191
const service = google.reseller({version: 'v1', auth});

apps-script/quickstart/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const CREDENTIALS_PATH = path.join(process.cwd(), 'credentials.json');
3232
/**
3333
* Reads previously authorized credentials from the save file.
3434
*
35-
* @return {Promise<OAuth2Client|null>}
35+
* @return {Promise<import("google-auth-library").AuthClient|null>}
3636
*/
3737
async function loadSavedCredentialsIfExist() {
3838
try {
@@ -47,7 +47,7 @@ async function loadSavedCredentialsIfExist() {
4747
/**
4848
* Serializes credentials to a file compatible with GoogleAuth.fromJSON.
4949
*
50-
* @param {OAuth2Client} client
50+
* @param {import("google-auth-library").AuthClient} client
5151
* @return {Promise<void>}
5252
*/
5353
async function saveCredentials(client) {
@@ -84,7 +84,7 @@ async function authorize() {
8484

8585
/**
8686
* Creates a new script project, upload a file, and log the script's URL.
87-
* @param {google.auth.OAuth2} auth An authorized OAuth2 client.
87+
* @param {import("google-auth-library").AuthClient} auth An authorized OAuth2 client.
8888
*/
8989
async function callAppsScript(auth) {
9090
const script = google.script({version: 'v1', auth});

calendar/quickstart/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const CREDENTIALS_PATH = path.join(process.cwd(), 'credentials.json');
3232
/**
3333
* Reads previously authorized credentials from the save file.
3434
*
35-
* @return {Promise<OAuth2Client|null>}
35+
* @return {Promise<import("google-auth-library").AuthClient|null>}
3636
*/
3737
async function loadSavedCredentialsIfExist() {
3838
try {
@@ -47,7 +47,7 @@ async function loadSavedCredentialsIfExist() {
4747
/**
4848
* Serializes credentials to a file compatible with GoogleAuth.fromJSON.
4949
*
50-
* @param {OAuth2Client} client
50+
* @param {import("google-auth-library").AuthClient} client
5151
* @return {Promise<void>}
5252
*/
5353
async function saveCredentials(client) {
@@ -84,7 +84,7 @@ async function authorize() {
8484

8585
/**
8686
* Lists the next 10 events on the user's primary calendar.
87-
* @param {google.auth.OAuth2} auth An authorized OAuth2 client.
87+
* @param {import("google-auth-library").AuthClient} auth An authorized OAuth2 client.
8888
*/
8989
async function listEvents(auth) {
9090
const calendar = google.calendar({version: 'v3', auth});

chat/client-libraries/cloud/authentication-utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import url from 'url';
2121
import open from 'open';
2222
import destroyer from 'server-destroy';
2323
import {readFile} from 'fs/promises';
24-
import {OAuth2Client} from 'google-auth-library';
24+
import {import("google-auth-library").AuthClient} from 'google-auth-library';
2525
import {ChatServiceClient} from '@google-apps/chat';
2626

2727
// Application authentication
@@ -67,7 +67,7 @@ export async function createClientWithUserCredentials(scopes) {
6767
* Create a new OAuth2 client and go through the OAuth2 flow.
6868
*
6969
* @param {Array<string>} scopes Required scopes for the desired API requests
70-
* @return {Promise<OAuth2Client>} The resulting Google OAuth2 client
70+
* @return {Promise<import("google-auth-library").AuthClient>} The resulting Google OAuth2 client
7171
*/
7272
function getAuthenticatedUserOAuth2Client(scopes) {
7373
return new Promise((resolve, reject) => {

chat/quickstart/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const CREDENTIALS_PATH = path.join(process.cwd(), 'credentials.json');
3535
/**
3636
* Reads previously authorized credentials from the save file.
3737
*
38-
* @return {Promise<OAuth2Client|null>}
38+
* @return {Promise<import("google-auth-library").AuthClient|null>}
3939
*/
4040
async function loadSavedCredentialsIfExist() {
4141
try {
@@ -51,7 +51,7 @@ async function loadSavedCredentialsIfExist() {
5151
/**
5252
* Serializes credentials to a file compatible with GoogleAuth.fromJSON.
5353
*
54-
* @param {OAuth2Client} client
54+
* @param {import("google-auth-library").AuthClient} client
5555
* @return {Promise<void>}
5656
*/
5757
async function saveCredentials(client) {
@@ -70,7 +70,7 @@ async function saveCredentials(client) {
7070
/**
7171
* Load or request or authorization to call APIs.
7272
*
73-
* @return {Promise<OAuth2Client>}
73+
* @return {Promise<import("google-auth-library").AuthClient>}
7474
*/
7575
async function authorize() {
7676
let client = await loadSavedCredentialsIfExist();
@@ -89,7 +89,7 @@ async function authorize() {
8989

9090
/**
9191
* Lists spaces with user credential.
92-
* @param {OAuth2Client} authClient An authorized OAuth2 client.
92+
* @param {import("google-auth-library").AuthClient} authClient An authorized OAuth2 client.
9393
*/
9494
async function listSpaces(authClient) {
9595
// Create a client

classroom/quickstart/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const CREDENTIALS_PATH = path.join(process.cwd(), 'credentials.json');
3232
/**
3333
* Reads previously authorized credentials from the save file.
3434
*
35-
* @return {Promise<OAuth2Client|null>}
35+
* @return {Promise<import("google-auth-library").AuthClient|null>}
3636
*/
3737
async function loadSavedCredentialsIfExist() {
3838
try {
@@ -47,7 +47,7 @@ async function loadSavedCredentialsIfExist() {
4747
/**
4848
* Serializes credentials to a file compatible with GoogleAuth.fromJSON.
4949
*
50-
* @param {OAuth2Client} client
50+
* @param {import("google-auth-library").AuthClient} client
5151
* @return {Promise<void>}
5252
*/
5353
async function saveCredentials(client) {
@@ -85,7 +85,7 @@ async function authorize() {
8585
/**
8686
* Lists the first 10 courses the user has access to.
8787
*
88-
* @param {google.auth.OAuth2} auth An authorized OAuth2 client.
88+
* @param {import("google-auth-library").AuthClient} auth An authorized OAuth2 client.
8989
*/
9090
async function listCourses(auth) {
9191
const classroom = google.classroom({version: 'v1', auth});

docs/quickstart/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const CREDENTIALS_PATH = path.join(process.cwd(), 'credentials.json');
3232
/**
3333
* Reads previously authorized credentials from the save file.
3434
*
35-
* @return {Promise<OAuth2Client|null>}
35+
* @return {Promise<import("google-auth-library").AuthClient|null>}
3636
*/
3737
async function loadSavedCredentialsIfExist() {
3838
try {
@@ -47,7 +47,7 @@ async function loadSavedCredentialsIfExist() {
4747
/**
4848
* Serializes credentials to a file compatible with GoogleAuth.fromJSON.
4949
*
50-
* @param {OAuth2Client} client
50+
* @param {import("google-auth-library").AuthClient} client
5151
* @return {Promise<void>}
5252
*/
5353
async function saveCredentials(client) {
@@ -85,7 +85,7 @@ async function authorize() {
8585
/**
8686
* Prints the title of a sample doc:
8787
* https://docs.google.com/document/d/195j9eDD3ccgjQRttHhJPymLJUCOUjs-jmwTrekvdjFE/edit
88-
* @param {google.auth.OAuth2} auth The authenticated Google OAuth 2.0 client.
88+
* @param {import("google-auth-library").AuthClient} auth The authenticated Google OAuth 2.0 client.
8989
*/
9090
async function printDocTitle(auth) {
9191
const docs = google.docs({version: 'v1', auth});

drive/activity-v2/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const CREDENTIALS_PATH = path.join(process.cwd(), 'credentials.json');
3232
/**
3333
* Reads previously authorized credentials from the save file.
3434
*
35-
* @return {Promise<OAuth2Client|null>}
35+
* @return {Promise<import("google-auth-library").AuthClient|null>}
3636
*/
3737
async function loadSavedCredentialsIfExist() {
3838
try {
@@ -47,7 +47,7 @@ async function loadSavedCredentialsIfExist() {
4747
/**
4848
* Serializes credentials to a file compatible with GoogleAuth.fromJSON.
4949
*
50-
* @param {OAuth2Client} client
50+
* @param {import("google-auth-library").AuthClient} client
5151
* @return {Promise<void>}
5252
*/
5353
async function saveCredentials(client) {
@@ -85,7 +85,7 @@ async function authorize() {
8585
/**
8686
* Lists the recent activity in your Google Drive.
8787
*
88-
* @param {google.auth.OAuth2} auth An authorized OAuth2 client.
88+
* @param {import("google-auth-library").AuthClient} auth An authorized OAuth2 client.
8989
*/
9090
async function listDriveActivity(auth) {
9191
const service = google.driveactivity({version: 'v2', auth});

0 commit comments

Comments
 (0)