CompanionClientProvider.ts 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. export type RequestOptions = {
  2. method?: string
  3. data?: Record<string, unknown>
  4. skipPostResponse?: boolean
  5. signal?: AbortSignal
  6. authFormData?: unknown
  7. qs?: Record<string, string>
  8. }
  9. /**
  10. * CompanionClientProvider is subset of the types of the `Provider`
  11. * class from @uppy/companion-client.
  12. *
  13. * This is needed as the `Provider` class is passed around in Uppy and we
  14. * need to have shared types for it. Although we are duplicating some types,
  15. * this is still safe as `Provider implements CompanionClientProvider`
  16. * so any changes here will error there and vice versa.
  17. *
  18. * TODO: remove this once companion-client and provider-views are merged into a single plugin.
  19. */
  20. export interface CompanionClientProvider {
  21. name: string
  22. provider: string
  23. login(options?: RequestOptions): Promise<void>
  24. logout<ResBody>(options?: RequestOptions): Promise<ResBody>
  25. list<ResBody>(
  26. directory: string | undefined,
  27. options: RequestOptions,
  28. ): Promise<ResBody>
  29. }
  30. export interface CompanionClientSearchProvider {
  31. name: string
  32. provider: string
  33. search<ResBody>(text: string, queries?: string): Promise<ResBody>
  34. }