|
| 1 | +import type { CancellationToken } from 'vscode'; |
| 2 | +import { IssuesCloudHostIntegrationId } from '../../../constants.integrations'; |
| 3 | +import type { Account } from '../../../git/models/author'; |
| 4 | +import type { Issue, IssueShape } from '../../../git/models/issue'; |
| 5 | +import type { IssueOrPullRequest, IssueOrPullRequestType } from '../../../git/models/issueOrPullRequest'; |
| 6 | +import type { IssueResourceDescriptor, ResourceDescriptor } from '../../../git/models/resourceDescriptor'; |
| 7 | +import type { IntegrationAuthenticationProviderDescriptor } from '../authentication/integrationAuthenticationProvider'; |
| 8 | +import type { ProviderAuthenticationSession } from '../authentication/models'; |
| 9 | +import { IssuesIntegration } from '../models/issuesIntegration'; |
| 10 | +import type { IssueFilter } from './models'; |
| 11 | +import { providersMetadata, toIssueShape } from './models'; |
| 12 | + |
| 13 | +const metadata = providersMetadata[IssuesCloudHostIntegrationId.Linear]; |
| 14 | +const authProvider = Object.freeze({ id: metadata.id, scopes: metadata.scopes }); |
| 15 | +const maxPagesPerRequest = 10; |
| 16 | + |
| 17 | +export interface LinearTeamDescriptor extends IssueResourceDescriptor { |
| 18 | + url: string; |
| 19 | +} |
| 20 | + |
| 21 | +export interface LinearProjectDescriptor extends IssueResourceDescriptor {} |
| 22 | + |
| 23 | +export class LinearIntegration extends IssuesIntegration<IssuesCloudHostIntegrationId.Linear> { |
| 24 | + protected override getProviderResourcesForUser( |
| 25 | + _session: ProviderAuthenticationSession, |
| 26 | + ): Promise<ResourceDescriptor[] | undefined> { |
| 27 | + throw new Error('Method not implemented.'); |
| 28 | + } |
| 29 | + protected override getProviderProjectsForResources( |
| 30 | + _session: ProviderAuthenticationSession, |
| 31 | + _resources: ResourceDescriptor[], |
| 32 | + ): Promise<ResourceDescriptor[] | undefined> { |
| 33 | + throw new Error('Method not implemented.'); |
| 34 | + } |
| 35 | + readonly authProvider: IntegrationAuthenticationProviderDescriptor = authProvider; |
| 36 | + |
| 37 | + protected override getProviderAccountForResource( |
| 38 | + _session: ProviderAuthenticationSession, |
| 39 | + _resource: ResourceDescriptor, |
| 40 | + ): Promise<Account | undefined> { |
| 41 | + throw new Error('Method not implemented.'); |
| 42 | + } |
| 43 | + |
| 44 | + protected override getProviderIssuesForProject( |
| 45 | + _session: ProviderAuthenticationSession, |
| 46 | + _project: ResourceDescriptor, |
| 47 | + _options?: { user?: string; filters?: IssueFilter[] }, |
| 48 | + ): Promise<IssueShape[] | undefined> { |
| 49 | + throw new Error('Method not implemented.'); |
| 50 | + } |
| 51 | + |
| 52 | + override get id(): IssuesCloudHostIntegrationId.Linear { |
| 53 | + return IssuesCloudHostIntegrationId.Linear; |
| 54 | + } |
| 55 | + protected override get key(): 'linear' { |
| 56 | + return 'linear'; |
| 57 | + } |
| 58 | + override get name(): string { |
| 59 | + return metadata.name; |
| 60 | + } |
| 61 | + override get domain(): string { |
| 62 | + return metadata.domain; |
| 63 | + } |
| 64 | + protected override async searchProviderMyIssues( |
| 65 | + _session: ProviderAuthenticationSession, |
| 66 | + _resources?: ResourceDescriptor[], |
| 67 | + _cancellation?: CancellationToken, |
| 68 | + ): Promise<IssueShape[] | undefined> { |
| 69 | + return Promise.resolve(undefined); |
| 70 | + } |
| 71 | + protected override getProviderIssueOrPullRequest( |
| 72 | + _session: ProviderAuthenticationSession, |
| 73 | + _resource: ResourceDescriptor, |
| 74 | + _id: string, |
| 75 | + _type: undefined | IssueOrPullRequestType, |
| 76 | + ): Promise<IssueOrPullRequest | undefined> { |
| 77 | + throw new Error('Method not implemented.'); |
| 78 | + } |
| 79 | + protected override getProviderIssue( |
| 80 | + _session: ProviderAuthenticationSession, |
| 81 | + _resource: ResourceDescriptor, |
| 82 | + _id: string, |
| 83 | + ): Promise<Issue | undefined> { |
| 84 | + throw new Error('Method not implemented.'); |
| 85 | + } |
| 86 | +} |
0 commit comments