UNPKG

@microfocus/alm-octane-js-rest-sdk

Version:
86 lines 3.4 kB
interface Config { protocol?: 'http' | 'https'; host: string; port?: number; pathPrefix?: string; shared_space_id: number; workspace_id: number; proxy?: string; routesConfig?: string | { defines?: any; }; octaneCredentials?: any; headers?: Record<string, string | number | boolean>; tech_preview_API?: boolean; } /** * @class * * @param {Object} config - configurations to access Octane REST API * @param {('http'|'https')} [config.protocol] - protocol of Octane REST API URL * @param {String} config.host - server of Octane REST API URL * @param {Number} [config.port] - port of Octane REST API URL * @param {String} [config.pathPrefix] - path prefix of Octane REST API URL * @param {Number} config.shared_space_id - Octane shared space id * @param {Number} config.workspace_id - Octane workspace id * @param {String} [config.proxy] - if set, using proxy to connect to Octane * @param {String|Object} [config.routesConfig] - if set, using the specified path as API definition, or use the JSON object directly */ declare class OctaneVanilla { private config; private routes; private octaneCredentials; private constants; private baseUrl; private baseApiUrl; private requestor; private params; constructor(config: Config); /** * Login to Octane. * @param {OctaneCredentials|OctaneVanilla~authenticateCallback} [octaneCredentials] - Credentials needed to access octane. * If no credentials are given, the last given credentials will be used. * If no credentials were ever given, the callback will be called with an error. * @param {OctaneVanilla~authenticateCallback} callback - Callback that handles error and authenticated operations */ authenticate(octaneCredentials: ((err: any) => void) | undefined, callback?: Function): any; /** * setupRoute() is invoked by the constructor, takes the contents of the * JSON document that contains the definitions of all the available API * routes and iterate over them. * It first recurses through each definition block until it reaches an API * endpoint. It knows that an endpoint is found when the 'url' and 'param' * definitions are found as a direct member of a definition block. * A method is attached to the Octane instance and becomes available for use. * Inside this method, the parameter validation and typecasting is done, * according to the definition of the parameters in the 'params' block, upon * invocation. */ private setupRoutes; private prepareApi; private parseParams; private sanitizeParam; private handler; private convertBlockToBody; private httpSend; private sendError; } export default OctaneVanilla; /** * Octane API access credentials * @typedef {Object} OctaneApiCredentials * @property {String} client_id - API client id * @property {String} client_secret - API client secret * * Octane User credentials * @typedef {Object} OctaneUserCredentials * @property {String} username - username * @property {String} password - password * * Octane User credentials * @typedef {OctaneUserCredentials|OctaneApiCredentials} OctaneCredentials * * @callback OctaneVanilla~authenticateCallback * @param {Object} - error that occurred */ //# sourceMappingURL=octane-routes.d.ts.map