-
-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
7,642 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# Typescript v1 declaration files | ||
typings/ | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
.env | ||
|
||
# IDE | ||
.vscode | ||
|
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,6 @@ | ||
language: node_js | ||
|
||
node_js: | ||
- "stable" | ||
|
||
after_success: npm run coverage |
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,157 @@ | ||
declare const _default: (url?: string, opts?: {}) => Wretcher; | ||
export default _default; | ||
/** | ||
* The Wretcher class used to perform easy fetch requests. | ||
* | ||
* Almost every method of this class return a fresh Wretcher object. | ||
*/ | ||
export declare class Wretcher { | ||
private _url; | ||
private _options; | ||
constructor(_url: string, _options?: {}); | ||
/** | ||
* Sets the default fetch options used for every subsequent fetch call. | ||
* @param opts New default options | ||
*/ | ||
defaults(opts: any): this; | ||
/** | ||
* Mixins the default fetch options used for every subsequent fetch calls. | ||
* @param opts Options to mixin with the current default options | ||
*/ | ||
mixdefaults(opts: any): this; | ||
/** | ||
* Sets the method (text, json ...) used to parse the data contained in the response body in case of an HTTP error. | ||
* | ||
* Persists for every subsequent requests. | ||
* | ||
* Default is "text". | ||
*/ | ||
errorType(method: any): this; | ||
/** | ||
* Returns a new Wretcher object with the url specified and the same options. | ||
* @param url String url | ||
*/ | ||
url(url: string): Wretcher; | ||
/** | ||
* Returns a new Wretcher object with the same url and new options. | ||
* @param options New options | ||
*/ | ||
options(options: Object): Wretcher; | ||
/** | ||
* Converts a javascript object to query parameters, | ||
* then appends this query string to the current url. | ||
* | ||
* ``` | ||
* let w = wretch("http://example.com") // url is http://example.com | ||
* w = w.query({ a: 1, b : 2 }) // url is now http://example.com?a=1&b=2 | ||
* ``` | ||
* | ||
* @param qp An object which will be converted. | ||
*/ | ||
query(qp: Object): Wretcher; | ||
/** | ||
* Shortcut to set the "Accept" header. | ||
* @param what Header value | ||
*/ | ||
accept(what: string): Wretcher; | ||
/** | ||
* Performs a get request. | ||
*/ | ||
get(opts?: {}): { | ||
res: () => any; | ||
json: () => any; | ||
blob: () => any; | ||
formData: () => any; | ||
arrayBuffer: () => any; | ||
text: () => any; | ||
error: (code: number, cb: any) => any; | ||
badRequest: (cb: any) => any; | ||
unauthorized: (cb: any) => any; | ||
forbidden: (cb: any) => any; | ||
notFound: (cb: any) => any; | ||
timeout: (cb: any) => any; | ||
internalError: (cb: any) => any; | ||
}; | ||
/** | ||
* Performs a delete request. | ||
*/ | ||
delete(opts?: {}): { | ||
res: () => any; | ||
json: () => any; | ||
blob: () => any; | ||
formData: () => any; | ||
arrayBuffer: () => any; | ||
text: () => any; | ||
error: (code: number, cb: any) => any; | ||
badRequest: (cb: any) => any; | ||
unauthorized: (cb: any) => any; | ||
forbidden: (cb: any) => any; | ||
notFound: (cb: any) => any; | ||
timeout: (cb: any) => any; | ||
internalError: (cb: any) => any; | ||
}; | ||
/** | ||
* Performs a put request. | ||
*/ | ||
put(opts?: {}): { | ||
res: () => any; | ||
json: () => any; | ||
blob: () => any; | ||
formData: () => any; | ||
arrayBuffer: () => any; | ||
text: () => any; | ||
error: (code: number, cb: any) => any; | ||
badRequest: (cb: any) => any; | ||
unauthorized: (cb: any) => any; | ||
forbidden: (cb: any) => any; | ||
notFound: (cb: any) => any; | ||
timeout: (cb: any) => any; | ||
internalError: (cb: any) => any; | ||
}; | ||
/** | ||
* Performs a post request. | ||
*/ | ||
post(opts?: {}): { | ||
res: () => any; | ||
json: () => any; | ||
blob: () => any; | ||
formData: () => any; | ||
arrayBuffer: () => any; | ||
text: () => any; | ||
error: (code: number, cb: any) => any; | ||
badRequest: (cb: any) => any; | ||
unauthorized: (cb: any) => any; | ||
forbidden: (cb: any) => any; | ||
notFound: (cb: any) => any; | ||
timeout: (cb: any) => any; | ||
internalError: (cb: any) => any; | ||
}; | ||
/** | ||
* Performs a patch request. | ||
*/ | ||
patch(opts?: {}): { | ||
res: () => any; | ||
json: () => any; | ||
blob: () => any; | ||
formData: () => any; | ||
arrayBuffer: () => any; | ||
text: () => any; | ||
error: (code: number, cb: any) => any; | ||
badRequest: (cb: any) => any; | ||
unauthorized: (cb: any) => any; | ||
forbidden: (cb: any) => any; | ||
notFound: (cb: any) => any; | ||
timeout: (cb: any) => any; | ||
internalError: (cb: any) => any; | ||
}; | ||
/** | ||
* Sets the content type header, stringifies an object and sets the request body. | ||
* @param obj An object | ||
*/ | ||
json(jsObject: any): Wretcher; | ||
/** | ||
* Converts the javascript object to a FormData and sets the request body. | ||
* @param obj An object | ||
*/ | ||
formData(obj: any): Wretcher; | ||
} |
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 @@ | ||
export declare const mix: (one: Object, two: Object, mergeArrays?: boolean) => Object; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.