由 Paloma 出售

Comprehensive Node.js client library for 200+ Google APIs, with built-in support for OAuth2, API keys, JWT, and application default credentials. Ideal for backend integrations with Google services including Drive, Analytics, YouTube, AI Platform, and more.
This block provides the full googleapis source tree: typed client wrappers for every Google REST API, plus OAuth2 / API-key authentication plumbing via google-auth-library and googleapis-common. It targets backend Node.js / TypeScript services that need to call Google APIs (Calendar, BigQuery, Drive, Gmail, etc.) without depending on the published npm package.
source/index.ts - Main entry point; re-exports google, GoogleApis, all per-API namespaces, Common, and Auth.source/googleapis.ts - Defines the GoogleApis class that aggregates every API factory method.source/apis/ - One sub-directory per Google API family (e.g. calendar/, bigquery/, drive/), each containing versioned implementation files and an index.ts factory.source/apis/index.ts - Barrel that imports all API families and wires them into the combined VERSIONS map used by GoogleApis.source/apis/<name>/index.ts - Per-API factory function and VERSIONS constant (see abusiveexperiencereport/index.ts as canonical example).source/apis/<name>/v*.ts - Typed resource classes and schema interfaces for a specific API version.npm install googleapis-common google-auth-library
No native build steps, no pod install, no Android linking required. Both dependencies are pure JavaScript / TypeScript.
Copy the source/ directory into your project, e.g. as lib/googleapis/.
Add path aliases in tsconfig.json so local imports resolve correctly:
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"googleapis-common": ["node_modules/googleapis-common"],
"google-auth-library": ["node_modules/google-auth-library"]
},
"esModuleInterop": true,
"resolveJsonModule": true,
"strict": true
}
}
ts-node, install tsconfig-paths:启动隔离沙箱并在服务器端直接运行 — 无需本地配置。
此版本的 Tetrees AI Review
This TypeScript cli / script completed archive review with strong static results. Structure, dependency manifests, documentation, functional source, and common risk patterns were checked by the Tetrees verification pipeline; runtime phases are stated separately.
Deterministic AVCP artifact review
管道 avcp-2026-08-04.1 · SHA-256 65936a745d18c7a4…
This version-scoped review deterministically inspects the submitted archive for structure, dependencies, documentation, functional source, and common malicious or high-risk signals. Build and test phases are reported as passed only after an isolated sandbox audition. It is not a guarantee of perfect security.
审查日期 2026年8月4日
将此产品直接导入你的 AI IDE、网页构建器或云端 IDE。
将 Tetrees 连接到兼容的 AI IDE,列出你拥有的产品并获取已验证 ZIP,同时不会开放卖家上传权限。
暂无评价。
Sign in to join the discussion
Loading discussion…
npm install --save-dev tsconfig-paths
export GOOGLE_APPLICATION_CREDENTIALS="/path/to/service-account.json"
import { google, GoogleApis } from './lib/googleapis';
googleimport { google } from './lib/googleapis';
// google is a singleton instance of GoogleApis
const blogger = google.blogger({ version: 'v3', auth: 'YOUR_API_KEY' });
The pre-constructed singleton. Use it when you need a quick API client without managing GoogleApis lifecycle. It exposes every API family as a method (e.g. google.calendar, google.drive, google.bigquery).
GoogleApisimport { GoogleApis } from './lib/googleapis';
const g = new GoogleApis({ auth: myOAuth2Client });
const calendar = g.calendar('v3');
The class behind the singleton. Instantiate directly when you need multiple independent instances with different global auth or options configurations.
Auth (re-export of google-auth-library)import { Auth } from './lib/googleapis';
const client = new Auth.OAuth2Client(
process.env.CLIENT_ID,
process.env.CLIENT_SECRET,
process.env.REDIRECT_URI
);
Full re-export of google-auth-library. Use Auth.OAuth2Client, Auth.GoogleAuth, Auth.JWT, etc. directly from this single import rather than adding a separate google-auth-library import to every file.
Common (re-export of googleapis-common)import { Common } from './lib/googleapis';
// Common.GlobalOptions, Common.MethodOptions, Common.BodyResponseCallback, etc.
function handler(err: Common.GlobalOptions) {}
Full re-export of googleapis-common types and utilities. Useful for typing request options and response callbacks without importing googleapis-common separately.
abusiveexperiencereport_v1)import { abusiveexperiencereport_v1 } from './lib/googleapis';
type Report = abusiveexperiencereport_v1.Schema$SiteSummaryResponse;
Each versioned namespace contains all resource classes, schema interfaces (Schema$*), and option types for that API version. Import them for TypeScript type-checking without constructing an API client.
A backend cron job reads upcoming events from a Google Calendar using a service account.
import { google, Auth } from './lib/googleapis';
async function listEvents() {
const auth = new Auth.GoogleAuth({
keyFile: process.env.GOOGLE_APPLICATION_CREDENTIALS,
scopes: ['https://www.googleapis.com/auth/calendar.readonly'],
});
const calendar = google.calendar({ version: 'v3', auth });
const res = await calendar.events.list({
calendarId: 'primary',
timeMin: new Date().toISOString(),
maxResults: 10,
singleEvents: true,
orderBy: 'startTime',
});
const events = res.data.items ?? [];
events.forEach(e => console.log(e.summary, e.start?.dateTime));
}
listEvents().catch(console.error);
A web server exchanges an authorization code for tokens and lists the user's Gmail messages.
import { google, Auth } from './lib/googleapis';
const oauth2Client = new Auth.OAuth2Client(
process.env.CLIENT_ID!,
process.env.CLIENT_SECRET!,
process.env.REDIRECT_URI!
);
// After receiving the auth code from Google's redirect:
async function handleCallback(code: string) {
const { tokens } = await oauth2Client.getToken(code);
oauth2Client.setCredentials(tokens);
const gmail = google.gmail({ version: 'v1', auth: oauth2Client });
const res = await gmail.users.messages.list({
userId: 'me',
maxResults: 5,
});
console.log(res.data.messages);
}
A module imports only the BigQuery API factory and its types without going through the google singleton.
import { GoogleApis, bigquery_v2 } from './lib/googleapis';
async function runQuery(projectId: string, sql: string) {
const g = new GoogleApis();
const auth = await g.auth.getClient({
scopes: ['https://www.googleapis.com/auth/bigquery'],
});
const bq = g.bigquery({ version: 'v2', auth });
const body: bigquery_v2.Schema$QueryRequest = {
query: sql,
useLegacySql: false,
};
const res = await bq.jobs.query({ projectId, requestBody: body });
console.log(res.data.rows);
}
source/index.ts - Top-level barrel: creates the google singleton, re-exports GoogleApis, Auth, Common, and every versioned API namespace. This is the only file consumers need to import from.source/googleapis.ts - Declares GoogleApis, which registers all API families and exposes google.auth / global options management.source/apis/index.ts - Auto-generated barrel that imports every API family's VERSIONS map and factory function and merges them for use by GoogleApis.source/apis/<name>/index.ts - Per-family factory: exports a VERSIONS map ({ v1: ConcreteClass, ... }) and an overloaded factory function that accepts either a version string or an options object.source/apis/<name>/v*.ts - Versioned implementation files: contain the resource class hierarchy (e.g. Resource$Projects, Resource$Projects$Datasets) and all Schema$* TypeScript interfaces auto-generated from the Discovery document.GOOGLE_APPLICATION_CREDENTIALS: Application Default Credentials silently fail at runtime. Fix: always set the env var or pass keyFile / credentials explicitly to GoogleAuth.esModuleInterop not enabled: import { google } from ... will be undefined with some bundlers. Fix: set "esModuleInterop": true in tsconfig.json.googleapis-common in node_modules and the source: the source assumes the exact peer API of user@example.com. Fix: pin "googleapis-common": "^7.x" matching what user@example.com requires.source/apis/index.ts: the barrel imports hundreds of modules at once. Fix: import individual API families (./lib/googleapis/apis/calendar) instead of the root barrel when tree-shaking matters.401 responses crash silently. Fix: call oauth2Client.on('tokens', callback) to persist refreshed tokens.googleapis-common: if your project uses "type": "module", imports of CJS-only deps can break. Fix: use "module": "CommonJS" in tsconfig.json or configure an ESM wrapper.I have copied the `googleapis` source tree into `lib/googleapis/` in my project.
See `lib/googleapis/USAGE.md` for the full integration guide.
The upstream package is `user@example.com`.
My project is a Node.js TypeScript Express server.
Please help me integrate this source step by step:
1. Add the necessary npm dependencies (`googleapis-common`, `google-auth-library`).
2. Update my `tsconfig.json` to resolve these deps correctly.
3. Create an `auth.ts` module that sets up an `Auth.GoogleAuth` or `Auth.OAuth2Client`
using environment variables.
4. Create an `<api>.service.ts` that imports from `lib/googleapis`, constructs a typed
client for [GOOGLE API NAME + VERSION], and exports a function that calls [SPECIFIC METHOD].
5. Wire the service into my Express router.
6. Show me how to type the response using the `Schema$*` interfaces from the versioned namespace.
Only use exports visible in `lib/googleapis/index.ts` and the per-API `index.ts` files.
Do not install the `googleapis` npm package; use only the local source.
The source is licensed under the Apache License 2.0 (see source/LICENSE if present, or the header comments in every source file). Upstream repository: googleapis/google-api-nodejs-client. Upstream npm package: user@example.com.
This product’s unique contribution is clean room implementation of valuable code block into AVCP compatible standard.
完整安装指南与集成提示词将在购买后解锁。
Automation, Utilities & Developer Tools
免费