Direct access to google-auth-library and gaxios functionality, providing complete authentication and HTTP client capabilities without requiring separate package installations.
Complete re-export of the google-auth-library package for authentication operations.
/**
* Full namespace export of google-auth-library
* Provides access to all authentication classes, types, and utilities
*/
const googleAuthLibrary: typeof import('google-auth-library');Usage Examples:
import { googleAuthLibrary } from "googleapis-common";
// Access any google-auth-library functionality
const auth = new googleAuthLibrary.GoogleAuth({
scopes: ['https://www.googleapis.com/auth/cloud-platform']
});
const jwt = new googleAuthLibrary.JWT({
email: 'service-account@project.iam.gserviceaccount.com',
key: privateKey,
scopes: ['https://www.googleapis.com/auth/cloud-platform']
});
// Access constants and utilities
const { GCLOUD_SANDBOX_ENV } = googleAuthLibrary;Complete re-export of the gaxios package for HTTP operations.
/**
* Full namespace export of gaxios
* Provides access to all HTTP client classes, types, and utilities
*/
const gaxios: typeof import('gaxios');Usage Examples:
import { gaxios } from "googleapis-common";
// Create custom gaxios instance
const client = new gaxios.Gaxios({
baseURL: 'https://api.example.com',
timeout: 30000
});
// Make direct HTTP requests
const response = await gaxios.request({
method: 'GET',
url: 'https://api.example.com/data'
});
// Handle gaxios errors
try {
await client.request({ url: '/invalid' });
} catch (error) {
if (error instanceof gaxios.GaxiosError) {
console.log('Status:', error.response?.status);
}
}Direct access to specific google-auth-library classes as named exports.
/**
* OAuth2 client for three-legged OAuth2 flows
*/
class OAuth2Client extends import('google-auth-library').OAuth2Client {}
/**
* JWT (JSON Web Token) client for service account authentication
*/
class JWT extends import('google-auth-library').JWT {}
/**
* Compute Engine metadata service client
*/
class Compute extends import('google-auth-library').Compute {}
/**
* User refresh client for OAuth2 refresh tokens
*/
class UserRefreshClient extends import('google-auth-library').UserRefreshClient {}
/**
* Main authentication class with automatic credential detection
*/
class GoogleAuth extends import('google-auth-library').GoogleAuth {}
/**
* External account client for workload identity federation
*/
class ExternalAccountClient extends import('google-auth-library').ExternalAccountClient {}
/**
* Base class for external account clients
*/
class BaseExternalAccountClient extends import('google-auth-library').BaseExternalAccountClient {}
/**
* Identity pool client for workload identity federation with identity pools
*/
class IdentityPoolClient extends import('google-auth-library').IdentityPoolClient {}
/**
* AWS client for workload identity federation with AWS
*/
class AwsClient extends import('google-auth-library').AwsClient {}Usage Examples:
import {
OAuth2Client,
JWT,
GoogleAuth,
Compute
} from "googleapis-common";
// Direct use of authentication classes
const oauth2 = new OAuth2Client(
'client-id',
'client-secret',
'http://localhost:3000/callback'
);
const jwt = new JWT({
email: 'service@project.iam.gserviceaccount.com',
keyFile: './service-account.json',
scopes: ['https://www.googleapis.com/auth/cloud-platform']
});
const googleAuth = new GoogleAuth({
projectId: 'my-project',
keyFilename: './credentials.json'
});
// Compute Engine authentication
const compute = new Compute();
const projectId = await compute.getProjectId();Direct access to specific gaxios classes and types as named exports.
/**
* Promise type returned by gaxios requests
*/
type GaxiosPromise<T = any> = Promise<GaxiosResponse<T>>;
/**
* Main gaxios HTTP client class
*/
class Gaxios extends import('gaxios').Gaxios {}
/**
* Gaxios error class for HTTP errors
*/
class GaxiosError extends import('gaxios').GaxiosError {}
/**
* Request options interface for gaxios
*/
interface GaxiosOptions extends import('gaxios').GaxiosOptions {}
/**
* Response interface for gaxios requests
*/
interface GaxiosResponse<T = any> extends import('gaxios').GaxiosResponse<T> {}
/**
* Retry configuration for failed requests
*/
interface RetryConfig extends import('gaxios').RetryConfig {}Usage Examples:
import {
Gaxios,
GaxiosError,
GaxiosOptions,
GaxiosResponse,
RetryConfig
} from "googleapis-common";
// Configure HTTP client with retry
const retryConfig: RetryConfig = {
retry: 3,
retryDelay: 1000,
httpMethodsToRetry: ['GET', 'PUT', 'HEAD', 'OPTIONS', 'DELETE']
};
const gaxiosOptions: GaxiosOptions = {
baseURL: 'https://api.example.com',
timeout: 30000,
retryConfig: retryConfig
};
const httpClient = new Gaxios(gaxiosOptions);
// Make requests with error handling
try {
const response: GaxiosResponse<{data: string}> = await httpClient.request({
method: 'GET',
url: '/data'
});
console.log(response.data);
} catch (error) {
if (error instanceof GaxiosError) {
console.error(`HTTP ${error.response?.status}: ${error.message}`);
}
}All re-exported types maintain full compatibility with their source packages.
/**
* All google-auth-library types are available through the namespace export
*/
type GoogleAuthTypes = typeof googleAuthLibrary;
/**
* All gaxios types are available through the namespace export
*/
type GaxiosTypes = typeof gaxios;
/**
* Named exports are identical to their source package equivalents
*/
type SourceCompatibility = {
OAuth2Client: import('google-auth-library').OAuth2Client;
JWT: import('google-auth-library').JWT;
Gaxios: import('gaxios').Gaxios;
GaxiosError: import('gaxios').GaxiosError;
};