UNPKG

node-oauth-1.0a-ts

Version:

OAuth 1.0a Request Authorization for Node and Browser.

63 lines (62 loc) 2.13 kB
/** * @private */ export declare namespace Utils { /** * Escape string according to [OAuth 1.0 section 3.6]{@link https://tools.ietf.org/html/rfc5849#section-3.6} * @param {String} str String to encode * @return {String} Encoded string */ function percentEncode(str: string): string; /** * Build OAuth Authorization header * @param {Object} oauth_data * @param {string} [separator=", "] Separator between items * @return {String} Authorization header string */ function toHeader(oauth_data: any, separator?: string): string; /** * Build parameter string part of the signing string. * * Parameter string consists of all request parameters and OAuth data * sorted by key alphabetically. * * @param {Object} request * @param {Object} oauth_data * @return {Object} string Parameter string */ function getParameterString(request: any, oauth_data: any): string; /** * Build query string from {@link Map} * * This method should be the same as {@link querystring#stringify} * but accept a `Map<string, string|Array>` instead of {@link Object} * * @param {Object} obj Input * @param {string} [sep="&"] Separator between items * @param {string} [eq="="] Separator between key and value * @param {Object} [options] * @param {Function} [options.encodeURIComponent=encodeURIComponent] * Key and value escaping algorithm * @return {string} Query string */ function stringifyQueryMap(obj: any, sep: string, eq: string, options: any): string; /** * Strip query string from URL * * @param {String} url URL to strip * @return {String} Stripped URL */ function getBaseUrl(url: string): string; /** * Return a ES6 Map with same key/value pairs as object. * * Iterating over this map would yield key/value pairs in alphabetical * order of keys. * * @param {Object} object Object to sort * @return {Map} */ function toSortedMap(object: any): Map<any, any>; } export default Utils;