-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ts): renew typescript declaration file
- Loading branch information
Showing
4 changed files
with
69 additions
and
57 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// Type definitions for FetchQL | ||
// Project: FetchQL | ||
// Definitions by: gucheen https://github.com/gucheen/ | ||
|
||
export default FetchQL; | ||
|
||
declare class FetchQL { | ||
constructor(options: FetchQLOptions); | ||
|
||
private interceptors: FetchQLInterceptor[]; | ||
|
||
private url: string; | ||
|
||
private requestObject: Object; | ||
|
||
private EnumMap: Object; | ||
|
||
addInterceptors(interceptors: FetchQLInterceptor | FetchQLInterceptor[]): Function; | ||
|
||
clearInterceptors(): void; | ||
|
||
query(options: FetchQLQuery): Promise<{data, errors}>; | ||
|
||
getEnumTypes(enums: string[]): Promise<{data, errors}>; | ||
|
||
setUrl(): void; | ||
|
||
getUrl(): string; | ||
} | ||
|
||
export interface FetchQLInterceptor { | ||
request: (url: string, config) => { url: string, config }; | ||
reueqstError: (error) => Promise<{errors}>; | ||
response: (response) => Object; | ||
responseError: (error) => Promise<{errors}>; | ||
} | ||
|
||
export interface FetchQLOptions { | ||
url: string; | ||
interceptors?: FetchQLInterceptor | FetchQLInterceptor[]; | ||
headers?: Object; | ||
onStart?: (queueLength: number) => void; | ||
onEnd?: (queueLength: number) => void; | ||
omitEmptyVariables?: boolean; | ||
requestOptions?: Object; | ||
} | ||
|
||
export interface FetchQLQuery { | ||
operationName: string; | ||
query: string; | ||
variables?: Object; | ||
opts?: { | ||
omitEmptyVariables: boolean; | ||
}; | ||
requestOptions?: Object; | ||
} |
This file was deleted.
Oops, something went wrong.
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,12 @@ | ||
import FetchQL from '../' | ||
|
||
const ql = new FetchQL({ | ||
url: '', | ||
}) | ||
|
||
ql.query({ | ||
operationName: '', | ||
query: '', | ||
}) | ||
.then(() => {}) | ||
.catch(() => {}); |