smartacme/dist/smartacme.classes.jwebclient.d.ts

72 lines
1.9 KiB
TypeScript
Raw Normal View History

2016-11-03 17:57:42 +00:00
/// <reference types="q" />
import * as q from 'q';
export interface IReqResArg {
ans: any;
res: any;
}
2016-11-01 17:27:57 +00:00
/**
* @class JWebClient
* @constructor
* @description Implementation of HTTPS-based JSON-Web-Client
*/
export declare class JWebClient {
2016-11-03 17:57:42 +00:00
/**
* User account key pair
*/
keyPair: any;
/**
* Cached nonce returned with last request
*/
lastNonce: string;
/**
* @member {boolean} module:JWebClient~JWebClient#verbose
* @desc Determines verbose mode
*/
2016-11-01 17:27:57 +00:00
verbose: boolean;
constructor();
/**
* createJWT
* @description create JSON-Web-Token signed object
* @param {string|undefined} nonce
* @param {Object|string|number|boolean} payload
* @param {string} alg
* @param {Object|string} key
* @param {Object} jwk
* @return {string}
*/
createJWT(nonce: any, payload: any, alg: any, key: any, jwk: any): string;
/**
* request
* @description make GET or POST request over HTTPS and use JOSE as payload type
* @param {string} query
* @param {string} payload
* @param {function} callback
* @param {function} errorCallback
*/
2016-11-03 17:57:42 +00:00
request(query: string, payload?: string): q.Promise<{}>;
2016-11-01 17:27:57 +00:00
/**
* get
* @description make GET request
* @param {string} uri
* @param {function} callback
* @param {function} errorCallback
*/
2016-11-03 17:57:42 +00:00
get(uri: string): q.Promise<IReqResArg>;
2016-11-01 17:27:57 +00:00
/**
2016-11-03 17:57:42 +00:00
* make POST request
2016-11-01 17:27:57 +00:00
* @param {string} uri
* @param {Object|string|number|boolean} payload
* @param {function} callback
* @param {function} errorCallback
*/
2016-11-03 17:57:42 +00:00
post(uri: string, payload: any): q.Promise<IReqResArg>;
2016-11-01 17:27:57 +00:00
/**
2016-11-03 17:57:42 +00:00
* checks if status is expected and log errors
2016-11-01 17:27:57 +00:00
* @param {string} uri
* @param {Object|string|number|boolean} payload
* @param {Object|string} ans
* @param {Object} res
*/
evaluateStatus(uri: any, payload: any, ans: any, res: any): void;
}