UNPKG

@mindconnect/mindconnect-nodejs

Version:

NodeJS Library for Siemens Insights Hub Connectivity - TypeScript SDK for Insights Hub and Industrial IoT - Command Line Interface - Insights Hub Development Proxy (Siemens Insights Hub was formerly known as MindSphere)

144 lines (143 loc) 3.88 kB
import { TokenRotation } from "./mindconnect-base"; /** * If the SDK is run in Browser this class implements the necessary HTTP handling. * * @export * @class BrowserAuth * @implements {TokenRotation} */ export declare class BrowserAuth implements TokenRotation { protected _headers: { Accept: string; "X-Powered-By": string; }; /** * Http headers used for /exchange endpoint handling. * * @protected * @memberof MindConnectBase */ protected _multipartHeaders: { "Content-Type": string; Accept: string; "X-Powered-By": string; }; protected _multipartFormData: { "Content-Type": string; Accept: string; "X-Powered-By": string; }; /** * Http headers used for onboarding message. * * @protected * @memberof MindConnectBase */ protected _apiHeaders: { "Content-Type": string; Accept: string; "X-Powered-By": string; }; protected _octetStreamHeaders: { "Content-Type": string; Accept: string; "X-Powered-By": 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; }; /** * perform http action * * @param {({ * 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; * ignoreCodes?: number[]; * })} { * verb, * gateway, * baseUrl, * authorization, * body, * message, * octetStream, * multiPartFormData, * additionalHeaders, * noResponse, * rawResponse, * returnHeaders, * ignoreCodes, * } * @returns {Promise<Object>} * * @memberOf MindConnectBase */ HttpAction({ verb, gateway, baseUrl, authorization, body, message, octetStream, multiPartFormData, additionalHeaders, noResponse, rawResponse, returnHeaders, ignoreCodes, }: { 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; ignoreCodes?: number[]; }): Promise<Object | undefined>; /** * * Returns true; MindSphere Gateway is taking care of this * * @returns {Promise<boolean>} * * @memberOf BrowserAuth */ RenewToken(): Promise<boolean>; /** * * Returns ""; MindSphere Gateway is taking care of this * * @returns {Promise<string>} * * @memberOf BrowserAuth */ GetToken(): Promise<string>; /** * * Returns ""; MindSphere Gateway is taking care of this * * @returns {string} * * @memberOf BrowserAuth */ GetGateway(): string; /** * * * Returns ""; MindSphere Gateway is taking care of this * * @returns {string} * * @memberOf BrowserAuth */ GetTenant(): string; private getCookieValue; constructor(); }