moeralib
Version:
Library to interact with Moera decentralized social network
110 lines • 3.71 kB
TypeScript
export declare const REDIRECTOR = "moera.page";
/**
* Represents location part of a universal Moera URL.
*/
declare class UniversalLocation {
private _nodeName;
private _scheme;
private _authority;
private _path;
/**
* Query component of the URL.
*/
query: string | null;
/**
* Fragment identifier of the URL.
*/
fragment: string | null;
/**
* @param {string | null} nodeName - the node name
* @param {string | null} scheme - scheme specifier of the node location (``'https'``, if set to `null` or empty)
* @param {string | null} authority - authority (host name and optional port) of the node location
* @param {string | null} path - virtual path at the node (``'/'``, if set to `null` or empty)
* @param {string | null} query - query component of the URL (without ``?``)
* @param {string | null} fragment - fragment identifier of the URL (without ``#``)
*/
constructor(nodeName?: string | null, scheme?: string | null, authority?: string | null, path?: string | null, query?: string | null, fragment?: string | null);
/**
* The node name.
*
* @return {string | null}
*/
get nodeName(): string | null;
/**
* The node name.
*
* @param {string | null} nodeName
*/
set nodeName(nodeName: string | null);
/**
* Scheme specifier of the node location.
*
* @return {string | null}
*/
get scheme(): string;
/**
* Scheme specifier of the node location.
*
* @param {string | null} scheme
*/
set scheme(scheme: string | null);
/**
* Authority (host name and optional port) of the node location.
*
* @return {string | null}
*/
get authority(): string | null;
/**
* Authority (host name and optional port) of the node location.
*
* @param {string | null} authority
*/
set authority(authority: string | null);
/**
* Virtual path at the node.
*
* @return {string | null}
*/
get path(): string | null;
/**
* Virtual path at the node.
*
* @param {string | null} path
*/
set path(path: string | null);
/**
* Universal Moera location (without query and fragment).
*
* @return {string | null}
*/
get location(): string;
toString(): string;
}
/**
* Parse the location part (including query and fragment) of a universal URL.
*
* @param {string | null} url - the URL to be parsed
* @return {UniversalLocation} the parsed location
*/
export declare function parse(url: string | null): UniversalLocation;
/**
* Build a universal Moera URL from the direct URL of a page on a node, adding the node name provided.
*
* @param {string | null} nodeName - the node name
* @param {string | null} url - the direct URL
* @return {string} the universal URL
*/
export declare function redirectToUrl(nodeName: string | null, url?: string | null): string;
/**
* Build a universal Moera URL from the node name, the Moera root URL of the node, virtual path and other components.
*
* @param {string | null} nodeName - the node name
* @param {string | null} rootUrl - the Moera root URL of the node
* @param {string | null} path - virtual path at the node (``'/'``, if set to `null` or empty)
* @param {string | null} query - query component of the URL
* @param {string | null} fragment - fragment identifier of the URL
* @return {string} the universal URL
*/
export declare function redirectTo(nodeName: string | null, rootUrl: string | null, path?: string | null, query?: string | null, fragment?: string | null): string;
export {};
//# sourceMappingURL=universal-location.d.ts.map