Skip to content

Commit

Permalink
Add linkpreview and auth callbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
rohitchouhan8 committed May 8, 2023
1 parent 47774c9 commit 8ad4ca8
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions plugin-api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ interface PluginAPI {
type: 'codegen',
callback: (event: CodegenEvent) => Promise<CodegenResult[]> | CodegenResult[],
): void
on(
type: 'linkpreview',
callback: (event: LinkPreviewEvent) => Promise<LinkPreviewResult> | LinkPreviewResult,
): void
on(
type: 'auth',
callback: (event: AuthEvent) => Promise<AuthResult> | AuthResult,
): void
once(type: ArgFreeEventType, callback: () => void): void
once(type: 'run', callback: (event: RunEvent) => void): void
once(type: 'drop', callback: (event: DropEvent) => boolean): void
Expand All @@ -63,6 +71,14 @@ interface PluginAPI {
type: 'codegen',
callback: (event: CodegenEvent) => Promise<CodegenResult[]> | CodegenResult[],
): void
once(
type: 'linkpreview',
callback: (event: LinkPreviewEvent) => Promise<LinkPreviewResult> | LinkPreviewResult,
): void
once(
type: 'auth',
callback: (event: AuthEvent) => Promise<AuthResult> | AuthResult,
): void
off(type: ArgFreeEventType, callback: () => void): void
off(type: 'run', callback: (event: RunEvent) => void): void
off(type: 'drop', callback: (event: DropEvent) => boolean): void
Expand All @@ -75,6 +91,14 @@ interface PluginAPI {
type: 'codegen',
callback: (event: CodegenEvent) => Promise<CodegenResult[]> | CodegenResult[],
): void
off(
type: 'linkpreview',
callback: (event: LinkPreviewEvent) => Promise<LinkPreviewResult> | LinkPreviewResult,
): void
off(
type: 'auth',
callback: (event: AuthEvent) => Promise<AuthResult> | AuthResult,
): void
readonly mixed: unique symbol
createRectangle(): RectangleNode
createLine(): LineNode
Expand Down Expand Up @@ -525,6 +549,25 @@ declare type CodegenResult = {
| 'BASH'
}

declare type LinkPreviewEvent = {
link: RelatedLink
}

declare type LinkPreviewResult = {
type: 'AUTH_REQUIRED'
} | {
type: 'PLAIN_TEXT'
text: string
} | null

declare type AuthEvent = {
links: RelatedLink[]
}

declare type AuthResult = {
type: 'AUTH_SUCCESS'
} | null

declare type Transform = [[number, number, number], [number, number, number]]
interface Vector {
readonly x: number
Expand Down

0 comments on commit 8ad4ca8

Please sign in to comment.