This commit is contained in:
Daniel Sogl 2018-03-17 00:26:07 +01:00 committed by GitHub
parent adf10a301e
commit 76dee252aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,5 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core'; import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
export interface HTTPResponse { export interface HTTPResponse {
/** /**
@ -66,7 +66,6 @@ export interface HTTPResponse {
}) })
@Injectable() @Injectable()
export class HTTP extends IonicNativePlugin { export class HTTP extends IonicNativePlugin {
/** /**
* This returns an object representing a basic HTTP Authorization header of the form. * This returns an object representing a basic HTTP Authorization header of the form.
* @param username {string} Username * @param username {string} Username
@ -74,7 +73,12 @@ export class HTTP extends IonicNativePlugin {
* @returns {Object} an object representing a basic HTTP Authorization header of the form {'Authorization': 'Basic base64encodedusernameandpassword'} * @returns {Object} an object representing a basic HTTP Authorization header of the form {'Authorization': 'Basic base64encodedusernameandpassword'}
*/ */
@Cordova({ sync: true }) @Cordova({ sync: true })
getBasicAuthHeader(username: string, password: string): { Authorization: string; } { return; } getBasicAuthHeader(
username: string,
password: string
): { Authorization: string } {
return;
}
/** /**
* This sets up all future requests to use Basic HTTP authentication with the given username and password. * This sets up all future requests to use Basic HTTP authentication with the given username and password.
@ -82,7 +86,7 @@ export class HTTP extends IonicNativePlugin {
* @param password {string} Password * @param password {string} Password
*/ */
@Cordova({ sync: true }) @Cordova({ sync: true })
useBasicAuth(username: string, password: string): void { } useBasicAuth(username: string, password: string): void {}
/** /**
* Set a header for all future requests. Takes a header and a value. * Set a header for all future requests. Takes a header and a value.
@ -90,20 +94,20 @@ export class HTTP extends IonicNativePlugin {
* @param value {string} The value of the header * @param value {string} The value of the header
*/ */
@Cordova({ sync: true }) @Cordova({ sync: true })
setHeader(header: string, value: string): void { } setHeader(header: string, value: string): void {}
/** /**
* Set the data serializer which will be used for all future POST and PUT requests. Takes a string representing the name of the serializer. * Set the data serializer which will be used for all future POST and PUT requests. Takes a string representing the name of the serializer.
* @param serializer {string} The name of the serializer. Can be urlencoded or json * @param serializer {string} The name of the serializer. Can be urlencoded or json
*/ */
@Cordova({ sync: true }) @Cordova({ sync: true })
setDataSerializer(serializer: string): void { } setDataSerializer(serializer: string): void {}
/** /**
* Clear all cookies * Clear all cookies
*/ */
@Cordova({ sync: true }) @Cordova({ sync: true })
clearCookies(): void { } clearCookies(): void {}
/** /**
* Remove cookies * Remove cookies
@ -111,21 +115,21 @@ export class HTTP extends IonicNativePlugin {
* @param cb * @param cb
*/ */
@Cordova({ sync: true }) @Cordova({ sync: true })
removeCookies(url: string, cb: () => void): void { } removeCookies(url: string, cb: () => void): void {}
/** /**
* Disable following redirects automatically * Disable following redirects automatically
* @param disable {boolean} Set to true to disable following redirects automatically * @param disable {boolean} Set to true to disable following redirects automatically
*/ */
@Cordova({ sync: true }) @Cordova({ sync: true })
disableRedirect(disable: boolean): void { } disableRedirect(disable: boolean): void {}
/** /**
* Set request timeout * Set request timeout
* @param timeout {number} The timeout in seconds. Default 60 * @param timeout {number} The timeout in seconds. Default 60
*/ */
@Cordova({ sync: true }) @Cordova({ sync: true })
setRequestTimeout(timeout: number): void { } setRequestTimeout(timeout: number): void {}
/** /**
* Enable or disable SSL Pinning. This defaults to false. * Enable or disable SSL Pinning. This defaults to false.
@ -137,7 +141,9 @@ export class HTTP extends IonicNativePlugin {
* @returns {Promise<void>} returns a promise that will resolve on success, and reject on failure * @returns {Promise<void>} returns a promise that will resolve on success, and reject on failure
*/ */
@Cordova() @Cordova()
enableSSLPinning(enable: boolean): Promise<void> { return; } enableSSLPinning(enable: boolean): Promise<void> {
return;
}
/** /**
* Accept all SSL certificates. Or disabled accepting all certificates. Defaults to false. * Accept all SSL certificates. Or disabled accepting all certificates. Defaults to false.
@ -145,7 +151,9 @@ export class HTTP extends IonicNativePlugin {
* @returns {Promise<void>} returns a promise that will resolve on success, and reject on failure * @returns {Promise<void>} returns a promise that will resolve on success, and reject on failure
*/ */
@Cordova() @Cordova()
acceptAllCerts(accept: boolean): Promise<void> { return; } acceptAllCerts(accept: boolean): Promise<void> {
return;
}
/** /**
* Make a POST request * Make a POST request
@ -155,7 +163,9 @@ export class HTTP extends IonicNativePlugin {
* @returns {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure * @returns {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure
*/ */
@Cordova() @Cordova()
post(url: string, body: any, headers: any): Promise<HTTPResponse> { return; } post(url: string, body: any, headers: any): Promise<HTTPResponse> {
return;
}
/** /**
* Make a GET request * Make a GET request
@ -165,7 +175,9 @@ export class HTTP extends IonicNativePlugin {
* @returns {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure * @returns {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure
*/ */
@Cordova() @Cordova()
get(url: string, parameters: any, headers: any): Promise<HTTPResponse> { return; } get(url: string, parameters: any, headers: any): Promise<HTTPResponse> {
return;
}
/** /**
* Make a PUT request * Make a PUT request
@ -175,7 +187,9 @@ export class HTTP extends IonicNativePlugin {
* @returns {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure * @returns {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure
*/ */
@Cordova() @Cordova()
put(url: string, body: any, headers: any): Promise<HTTPResponse> { return; } put(url: string, body: any, headers: any): Promise<HTTPResponse> {
return;
}
/** /**
* Make a PATCH request * Make a PATCH request
@ -185,7 +199,9 @@ export class HTTP extends IonicNativePlugin {
* @returns {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure * @returns {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure
*/ */
@Cordova() @Cordova()
patch(url: string, body: any, headers: any): Promise<HTTPResponse> { return; } patch(url: string, body: any, headers: any): Promise<HTTPResponse> {
return;
}
/** /**
* Make a DELETE request * Make a DELETE request
@ -195,7 +211,9 @@ export class HTTP extends IonicNativePlugin {
* @returns {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure * @returns {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure
*/ */
@Cordova() @Cordova()
delete(url: string, parameters: any, headers: any): Promise<HTTPResponse> { return; } delete(url: string, parameters: any, headers: any): Promise<HTTPResponse> {
return;
}
/** /**
* Make a HEAD request * Make a HEAD request
@ -205,7 +223,9 @@ export class HTTP extends IonicNativePlugin {
* @returns {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure * @returns {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure
*/ */
@Cordova() @Cordova()
head(url: string, parameters: any, headers: any): Promise<HTTPResponse> { return; } head(url: string, parameters: any, headers: any): Promise<HTTPResponse> {
return;
}
/** /**
* *
@ -217,7 +237,15 @@ export class HTTP extends IonicNativePlugin {
* @returns {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure * @returns {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure
*/ */
@Cordova() @Cordova()
uploadFile(url: string, body: any, headers: any, filePath: string, name: string): Promise<HTTPResponse> { return; } uploadFile(
url: string,
body: any,
headers: any,
filePath: string,
name: string
): Promise<HTTPResponse> {
return;
}
/** /**
* *
@ -228,5 +256,12 @@ export class HTTP extends IonicNativePlugin {
* @returns {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure * @returns {Promise<HTTPResponse>} returns a promise that resolve on success, and reject on failure
*/ */
@Cordova() @Cordova()
downloadFile(url: string, body: any, headers: any, filePath: string): Promise<HTTPResponse> { return; } downloadFile(
url: string,
body: any,
headers: any,
filePath: string
): Promise<HTTPResponse> {
return;
}
} }