-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
@uppy/companion-client: type changes for provider-views (#4938)
- Loading branch information
Showing
8 changed files
with
175 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
export type RequestOptions = { | ||
method?: string | ||
data?: Record<string, unknown> | ||
skipPostResponse?: boolean | ||
signal?: AbortSignal | ||
authFormData?: unknown | ||
qs?: Record<string, string> | ||
} | ||
|
||
/** | ||
* CompanionClientProvider is subset of the types of the `Provider` | ||
* class from @uppy/companion-client. | ||
* | ||
* This is needed as the `Provider` class is passed around in Uppy and we | ||
* need to have shared types for it. Although we are duplicating some types, | ||
* this is still safe as `Provider implements CompanionClientProvider` | ||
* so any changes here will error there and vice versa. | ||
* | ||
* TODO: remove this once companion-client and provider-views are merged into a single plugin. | ||
*/ | ||
export interface CompanionClientProvider { | ||
name: string | ||
provider: string | ||
login(options?: RequestOptions): Promise<void> | ||
logout<ResBody>(options?: RequestOptions): Promise<ResBody> | ||
list<ResBody>( | ||
directory: string | undefined, | ||
options: RequestOptions, | ||
): Promise<ResBody> | ||
} | ||
export interface CompanionClientSearchProvider { | ||
name: string | ||
provider: string | ||
search<ResBody>(text: string, queries?: string): Promise<ResBody> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** | ||
* CompanionFile represents a file object returned by the Companion API. | ||
*/ | ||
export type CompanionFile = { | ||
id: string | ||
name: string | ||
/* | ||
* Url to the thumbnail icon | ||
*/ | ||
icon: string | ||
type: string | ||
mimeType: string | ||
extension: string | ||
size: number | ||
isFolder: boolean | ||
modifiedDate: string | ||
thumbnail?: string | ||
requestPath: string | ||
relDirPath?: string | ||
absDirPath?: string | ||
author?: { | ||
name?: string | ||
url?: string | ||
} | ||
} |