From 9e64dd3032c35708adf5db8272716b274ba394ab Mon Sep 17 00:00:00 2001 From: Kamil Wolny Date: Wed, 10 Aug 2022 10:14:45 +0100 Subject: [PATCH] feat: fix plugin api report Signed-off-by: Kamil Wolny --- plugins/github-issues/api-report.md | 74 +++++++++++++++++++ .../github-issues/src/api/gitHubIssuesApi.ts | 16 +++- 2 files changed, 87 insertions(+), 3 deletions(-) diff --git a/plugins/github-issues/api-report.md b/plugins/github-issues/api-report.md index eb69fc8e8e..9852ec80c9 100644 --- a/plugins/github-issues/api-report.md +++ b/plugins/github-issues/api-report.md @@ -5,9 +5,49 @@ ```ts /// +import { ApiRef } from '@backstage/core-plugin-api'; import { BackstagePlugin } from '@backstage/core-plugin-api'; +import { ConfigApi } from '@backstage/core-plugin-api'; +import { ErrorApi } from '@backstage/core-plugin-api'; +import { OAuthApi } from '@backstage/core-plugin-api'; import { RouteRef } from '@backstage/core-plugin-api'; +// @public (undocumented) +export type Assignee = { + avatarUrl: string; + login: string; +}; + +// @public (undocumented) +export type EdgesWithNodes = { + edges: Array<{ + node: T; + }>; +}; + +// @public (undocumented) +export type GitHubIssuesApi = ReturnType; + +// @public (undocumented) +export const gitHubIssuesApi: ( + githubAuthApi: OAuthApi, + configApi: ConfigApi, + errorApi: ErrorApi, +) => { + fetchIssuesByRepoFromGitHub: ( + repos: Array, + itemsPerRepo: number, + ) => Promise; +}; + +// @public (undocumented) +export const gitHubIssuesApiRef: ApiRef<{ + fetchIssuesByRepoFromGitHub: ( + repos: Array, + itemsPerRepo: number, + ) => Promise; +}>; + // @public (undocumented) export const GitHubIssuesCard: (props: GitHubIssuesProps) => JSX.Element; @@ -29,5 +69,39 @@ export type GitHubIssuesProps = { itemsPerRepo?: number; }; +// @public (undocumented) +export type Issue = { + assignees: EdgesWithNodes; + author: IssueAuthor; + repository: { + nameWithOwner: string; + }; + title: string; + url: string; + participants: { + totalCount: number; + }; + createdAt: string; + updatedAt: string; + comments: { + totalCount: number; + }; +}; + +// @public (undocumented) +export type IssueAuthor = { + login: string; +}; + +// @public (undocumented) +export type IssuesByRepo = Record; + +// @public (undocumented) +export type RepoIssues = { + issues: { + totalCount: number; + } & EdgesWithNodes; +}; + // (No @packageDocumentation comment for this package) ``` diff --git a/plugins/github-issues/src/api/gitHubIssuesApi.ts b/plugins/github-issues/src/api/gitHubIssuesApi.ts index 06fdf3d452..2fea0dd759 100644 --- a/plugins/github-issues/src/api/gitHubIssuesApi.ts +++ b/plugins/github-issues/src/api/gitHubIssuesApi.ts @@ -23,21 +23,25 @@ import { import { readGitHubIntegrationConfigs } from '@backstage/integration'; import { ForwardedError } from '@backstage/errors'; -type Assignee = { +/** @public */ +export type Assignee = { avatarUrl: string; login: string; }; -type EdgesWithNodes = { +/** @public */ +export type EdgesWithNodes = { edges: Array<{ node: T; }>; }; -type IssueAuthor = { +/** @public */ +export type IssueAuthor = { login: string; }; +/** @public */ export type Issue = { assignees: EdgesWithNodes; author: IssueAuthor; @@ -56,19 +60,25 @@ export type Issue = { }; }; +/** @public */ export type RepoIssues = { issues: { totalCount: number; } & EdgesWithNodes; }; + +/** @public */ export type IssuesByRepo = Record; +/** @public */ export type GitHubIssuesApi = ReturnType; +/** @public */ export const gitHubIssuesApiRef = createApiRef({ id: 'plugin.githubissues.service', }); +/** @public */ export const gitHubIssuesApi = ( githubAuthApi: OAuthApi, configApi: ConfigApi,