@mindconnect/mindconnect-nodejs
Version:
MindConnect Library for NodeJS (community based)
102 lines (101 loc) • 2.89 kB
TypeScript
/**
* TokenRotation interface marks all classes which rotate the authentication token according to mindsphere specifications.
*
* @export
* @interface TokenRotation
*/
export interface TokenRotation {
/**
* Checks if the token has expired and renews it if necessary.
*
* @returns {Promise<boolean>}
*
* @memberOf TokenRotation
*/
RenewToken(): Promise<boolean>;
}
/**
* Base class for mindconnect agent (and setup) which provides headers and proxy handling.
*
* @export
* @abstract
* @class MindConnectBase
*/
export declare abstract class MindConnectBase {
/**
* This is a https proxy agent which is used in the fetch commands if the HTTP_PROXY variable is configured.
*
* @protected
* @type {*}
* @memberof MindConnectBase
*/
protected _proxyHttpAgent: any;
protected _headers: {
Accept: string;
"X-Powered-By": string;
"User-Agent": string;
};
/**
* Http headers used for /exchange endpoint handling.
*
* @protected
* @memberof MindConnectBase
*/
protected _multipartHeaders: {
"Content-Type": string;
Accept: string;
"X-Powered-By": string;
"User-Agent": string;
};
protected _multipartFormData: {
"Content-Type": string;
Accept: string;
"X-Powered-By": string;
"User-Agent": string;
};
/**
* Http headers used for onboarding message.
*
* @protected
* @memberof MindConnectBase
*/
protected _apiHeaders: {
"Content-Type": string;
Accept: string;
"X-Powered-By": string;
"User-Agent": string;
};
protected _octetStreamHeaders: {
"Content-Type": string;
Accept: string;
"X-Powered-By": string;
"User-Agent": string;
};
/**
* Http headers used to register the client assertion and acquire the /exchange token.
*
* @protected
* @memberof MindConnectBase
*/
protected _urlEncodedHeaders: {
"Content-Type": string;
Accept: string;
"X-Powered-By": string;
"User-Agent": string;
};
protected HttpAction({ verb, gateway, baseUrl, authorization, body, message, octetStream, multiPartFormData, additionalHeaders, noResponse, rawResponse, returnHeaders }: {
verb: "GET" | "POST" | "PATCH" | "PUT" | "DELETE";
gateway: string;
baseUrl: string;
authorization: string;
body?: Object;
message?: string;
octetStream?: boolean;
multiPartFormData?: boolean;
additionalHeaders?: Object;
noResponse?: boolean;
rawResponse?: boolean;
returnHeaders?: boolean;
}): Promise<Object>;
constructor();
}