import { WeavyClient } from './weavy'; import { Constructor } from '../types/generic.types'; import { FetchOptions, HeaderContentType, HttpMethodType, HttpUploadMethodType } from '../types/http.types'; export interface WeavyFetchProps { /** * Gets defaulted fetch options that includes authorization headers for the current user. * * @param options { FetchOptions } - Any RequestInit compatible fetch options that should be defaulted and updated with current Authorization. * @param authorized { boolean } - Whether to embed authorization token for the endpoint. Set to `false` for any endpoint that doesn't require authorization. Defaults to `true`. * @returns {Promise} Options for Fetch or Request */ fetchOptions: (options?: FetchOptions, authorized?: boolean) => Promise; /** * Fetch data from the Web API. Includes token handling and acts on behalf of the current user. * * @param url { string | URL } - The URL to the Web API endpoint. Note: Only Web API URL:s are supported. * @param options { FetchOptions } Optional RequestInit compatible fetch options. Note that `method` is limited to "GET" | "POST" | "PUT" | "DELETE" | "PATCH". * @returns { Promise } A standard fetch() Response */ fetch: (url: string | URL, options?: FetchOptions) => Promise; /** * Fetch file data from the server. Includes file access token handling and acts on behalf of the current user. * * @param url { string | URL } - The URL to the file. Note: Only file URL:s are supported. * @param options { FetchOptions } Optional RequestInit compatible fetch options. Note that `method` is limited to "GET" | "POST" | "PUT" | "DELETE" | "PATCH". * @returns { Promise } A standard fetch() Response */ fetchFile: (url: string | URL, options?: FetchOptions) => Promise; /** * Upload data to the Web API using a progress callback function to monitor the progress. * * @param url { string | URL } - The URL to the Web API endpoint. Note: Only Web API URL:s are supported. * @param method { "POST" | "PUT" | "PATCH" } - The http method to use. * @param body { string | FormData } - The data to send. * @param [contentType] {HeaderContentType} - Optional content type of the body. Defaults to "application/json;charset=utf-8" * @param onProgress {(progress: number) => void} Callback function for the progress. The progress parameter is provided as 0-100 percent. * @param signal {AbortSignal} Optional abort signal for cancelling the upload. * @returns { Promise } A standard fetch() Response */ upload: ( /** The URL to the Web API endpoint. Note: Only Web API URL:s are supported. */ url: string | URL, /** The http method to use. */ method: HttpUploadMethodType, /** The data to send. */ body: string | FormData, /** Optional content type of the body. Defaults to "application/json;charset=utf-8" */ contentType?: HeaderContentType, /** * Callback function for the progress. The progress parameter is provided as 0-100 percent. * @param progress { number } - The progress provided as 0-100 percent. **/ onProgress?: (progress: number) => void, /** * Optional abort signal for cancelling the upload. */ signal?: AbortSignal) => Promise; /** * DEPRECATED: Use `.fetch(url)` instead. * * Gets an Web API URL and returns a Response. * * @deprecated Use .fetch(url) instead. * @param url { string | URL } - The URL to the API endpoint. * @returns { Promise } A standard fetch() Response */ get: (url: string | URL) => Promise; /** * DEPRECATED: Use `.fetch(url, options)` instead. * * Posts data to the Web API and returns a Response. * * @deprecated Use .fetch(url, options) instead. * @param url {string | URL} - The URL of the API endpoint * @param method { "GET" | "POST" | "PUT" | "DELETE" | "PATCH" } - The http method to use. * @param [body] {BodyInit} - The body data to send. JSON must be encoded as a string. * @param [contentType] {HeaderContentType} - The content type of the body. Defaults to "application/json;charset=utf-8". * @returns { Promise } A standard fetch() Response */ post: (url: string | URL, method: HttpMethodType, body?: BodyInit, contentType?: HeaderContentType) => Promise; } export declare const WeavyFetchMixin: >(Base: TBase) => { new (...args: any[]): { fetchOptions(this: /*elided*/ any & WeavyClient & import('./weavy').StrictWeavyOptions & import('./settings').WeavySettingsProps & import('./network').WeavyNetworkProps & import('./authentication').WeavyAuthenticationProps & import('./localization').WeavyLocalizationProps & import('./connection').WeavyConnectionProps & import('./query').WeavyQueryProps & import('./version').WeavyVersionProps & WeavyFetchProps & import('./styles').WeavyStylesProps & import('./context').WeavyContextProviderProps & import('./links').WeavyLinksProps, options?: FetchOptions, authorized?: boolean): Promise; fetch(this: /*elided*/ any & WeavyClient & import('./weavy').StrictWeavyOptions & import('./settings').WeavySettingsProps & import('./network').WeavyNetworkProps & import('./authentication').WeavyAuthenticationProps & import('./localization').WeavyLocalizationProps & import('./connection').WeavyConnectionProps & import('./query').WeavyQueryProps & import('./version').WeavyVersionProps & WeavyFetchProps & import('./styles').WeavyStylesProps & import('./context').WeavyContextProviderProps & import('./links').WeavyLinksProps, url: string | URL, options?: FetchOptions, retry?: boolean): Promise; fetchFile(this: /*elided*/ any & WeavyClient & import('./weavy').StrictWeavyOptions & import('./settings').WeavySettingsProps & import('./network').WeavyNetworkProps & import('./authentication').WeavyAuthenticationProps & import('./localization').WeavyLocalizationProps & import('./connection').WeavyConnectionProps & import('./query').WeavyQueryProps & import('./version').WeavyVersionProps & WeavyFetchProps & import('./styles').WeavyStylesProps & import('./context').WeavyContextProviderProps & import('./links').WeavyLinksProps, url: string | URL, options?: FetchOptions, retry?: boolean): Promise; upload(this: /*elided*/ any & WeavyClient & import('./weavy').StrictWeavyOptions & import('./settings').WeavySettingsProps & import('./network').WeavyNetworkProps & import('./authentication').WeavyAuthenticationProps & import('./localization').WeavyLocalizationProps & import('./connection').WeavyConnectionProps & import('./query').WeavyQueryProps & import('./version').WeavyVersionProps & WeavyFetchProps & import('./styles').WeavyStylesProps & import('./context').WeavyContextProviderProps & import('./links').WeavyLinksProps, url: string | URL, method: HttpUploadMethodType, body: string | FormData, contentType?: HeaderContentType, onProgress?: (progress: number) => void, signal?: AbortSignal, retry?: boolean): Promise; get(this: /*elided*/ any & WeavyClient & import('./weavy').StrictWeavyOptions & import('./settings').WeavySettingsProps & import('./network').WeavyNetworkProps & import('./authentication').WeavyAuthenticationProps & import('./localization').WeavyLocalizationProps & import('./connection').WeavyConnectionProps & import('./query').WeavyQueryProps & import('./version').WeavyVersionProps & WeavyFetchProps & import('./styles').WeavyStylesProps & import('./context').WeavyContextProviderProps & import('./links').WeavyLinksProps, url: string | URL): Promise; post(this: /*elided*/ any & WeavyClient & import('./weavy').StrictWeavyOptions & import('./settings').WeavySettingsProps & import('./network').WeavyNetworkProps & import('./authentication').WeavyAuthenticationProps & import('./localization').WeavyLocalizationProps & import('./connection').WeavyConnectionProps & import('./query').WeavyQueryProps & import('./version').WeavyVersionProps & WeavyFetchProps & import('./styles').WeavyStylesProps & import('./context').WeavyContextProviderProps & import('./links').WeavyLinksProps, url: string | URL, method: HttpMethodType, body?: BodyInit, contentType?: HeaderContentType): Promise; readonly weavySid: string; readonly weavyId: string; readonly host: HTMLElement; cloudFilePickerUrl: string | URL; configurationTimeout: number; disableEnvironmentImports: boolean; gcTime: number; scrollBehavior: "auto" | "instant" | "smooth"; staleTime: number; tokenFactoryRetryDelay: number; tokenFactoryTimeout: number; _resolveUrl?: (url: URL) => void; _whenUrl: Promise; whenUrl(): Promise; _url?: URL; get url(): URL | undefined; set url(url: string | URL | null | undefined); get cachePrefix(): string; reset(): Promise; _isDestroyed: boolean; get isDestroyed(): boolean; destroy(): void; }; } & TBase; //# sourceMappingURL=fetch.d.ts.map