solid-notification-client
Version:
Client library for Solid Notifications Protocol v0.2.0
29 lines (28 loc) • 1.67 kB
TypeScript
import { Session } from "@rubensworks/solid-client-authn-isomorphic";
export declare class WebHookSubscription2021 {
private session;
constructor(session?: Session);
/**
* Looks up the storageDescription URL of a solid pod by looking for the `http://www.w3.org/ns/solid#storageDescription` Link value.
*
* @param url - the URL of the solid pod. (any resource in the pod is fine; all resources MUST advertise this Link header when the solid pod is a Resource Server. See 2.1 Discovery of the spec )
*/
private lookupStorageDescription;
/**
* Fetches the subscription URL of a Resource Server by first fetching the solid:StorageDescription URL and then extracting the WebSocketChannel2023 from the body.
* @param url - the Url of the solid pod.
* @returns
*/
private fetchSubscriptionUrl;
/**
* Retrieves the Websocket URL by following the {@link https://solidproject.org/TR/notifications-protocol|notification protocol v0.2.0.}
*
* Discovers from the topic resource the storage description resource.
* Using the contents of the storage description resource, a search is executed to find the WebHookSubscription2021 channel URL.
* Finally, a POST request is send to the WebSocketChannel with as content the topic and features.
* @param topic - The resource in the solid pod that you want to subscribe to.
* @param features - Which features should be in the message of the notification channel.
* @returns The websocket URL of the Solid pod for this resource.
*/
subscribe(topic: string, webId: string, features: Record<string, unknown>): Promise<string>;
}