API client with type definitions for Code PushUp Portal.
npm install @code-pushup/portal-clientAPI client with type definitions for Code PushUp Portal.
``sh`
npm install @code-pushup/portal-client
`ts
import { uploadReportToPortal } from '@code-pushup/portal-client';
// ...
const report = await uploadReportToPortal({
server: '
apiKey: process.env.CODE_PUSHUP_API_KEY,
data: {
organization: '
project: '
commit: '
plugins: [
// ...
],
categories: [
// ...
],
// ...
},
});
`
`ts
import { getPortalComparisonLink } from '@code-pushup/portal-client';
// ...
const url = await getPortalComparisonLink({
server: '
apiKey: process.env.CODE_PUSHUP_API_KEY,
parameters: {
organization: '
project: '
before: '
after: '
},
});
`
`ts
import { downloadReportFromPortal } from '@code-pushup/portal-client';
// ...
const report = await downloadReportFromPortal({
server: '
apiKey: process.env.CODE_PUSHUP_API_KEY,
parameters: {
organization: '
project: '
/ OPTIONAL: if commit not provided, finds latest report in default branch /
// commit: '
/ OPTIONAL: opt in to including audit details (issues, trees, etc.), omitted by default to minimize payload /
// withAuditDetails: true,
/ OPTIONAL: maximum number of recent commits to search for latest report (ignored if commit set) /
// maxCommits: 30,
},
});
`
`ts
import { downloadProjectsFromPortal } from '@code-pushup/portal-client';
// ...
const report = await downloadProjectsFromPortal({
server: '
apiKey: process.env.CODE_PUSHUP_API_KEY,
parameters: {
/ OPTIONAL: filter projects by organization /
// organization: '
/ OPTIONAL: opt in to including each project's latest report /
// withLatestReport: true,
/ OPTIONAL: opt in to including audit details (ignored unless withLatestReport enabled) /
// withAuditDetails: true,
/ OPTIONAL: maximum number of recent commits to search for latest report (ignored unless withLatestReport enabled) /
// maxCommits: 30,
},
});
``