import { HRN, OlpClientSettings } from "@here/olp-sdk-core"; import { StreamApi } from "@here/olp-sdk-dataservice-api"; import { PollRequest, SeekRequest, SubscribeRequest, UnsubscribeRequest } from "@here/olp-sdk-dataservice-read"; export interface StreamLayerClientParams { catalogHrn: HRN; layerId: string; settings: OlpClientSettings; } /** * Describes a stream layer. */ export declare class StreamLayerClient { private readonly apiVersion; protected xCorrelationId?: string; protected subscribtionNodeBaseUrl?: string; protected readonly catalogHrn: HRN; protected readonly layerId: string; protected readonly settings: OlpClientSettings; /** * Creates the [[StreamLayerClient]] instance. * * @param params The [[StreamLayerClientParams]] instance. * @return The [[StreamLayerClient]] instance. */ constructor(params: StreamLayerClientParams); /** * Enables message consumption from a specific stream layer. Use the base path returned from the API Lookup service. * For mode = parallel, one unit of parallelism currently equals 1 MBps inbound or 2 MBps outbound, * whichever is greater, rounded up to the nearest integer. * The number of subscriptions within the same group cannot exceed the parallelism allowed. * For more details see * [Get Data from a Stream Layer](https://developer.here.com/documentation/data-api/data_dev_guide/rest/getting-data-stream.html) * * @param request The [[SubscribeRequest]] instance of the configured request parameters. * @param abortSignal A signal object that allows you to communicate with a request (such as the `fetch` request) * and, if required, abort it using the `AbortController` object. * * For more information, see the [`AbortController` documentation](https://developer.mozilla.org/en-US/docs/Web/API/AbortController). * * @returns Subscription Id */ subscribe(request: SubscribeRequest, abortSignal?: AbortSignal): Promise; /** * Consumes data from a layer. Returns messages from a stream layer. * If the data size is less than 1 MB, the data field will be populated. * If the data size is greater than 1 MB, a data handle will be returned pointing to the object stored in the Blob store. * * @param request The [[PollRequest]] instance of the configured request parameters. * @param abortSignal A signal object that allows you to communicate with a request (such as the `fetch` request) * and, if required, abort it using the `AbortController` object. * * For more information, see the [`AbortController` documentation](https://developer.mozilla.org/en-US/docs/Web/API/AbortController). * * @returns Messages [[StreamApi.Messages]] from a stream layer */ poll(request: PollRequest, abortSignal?: AbortSignal): Promise; /** * Method deletes a subscription to a layer. This operation removes the subscription from the service. * * @param request The [[UnsubscribeRequest]] instance of the configured request parameters. * @param abortSignal A signal object that allows you to communicate with a request (such as the `fetch` request) * and, if required, abort it using the `AbortController` object. * * For more information, see the [`AbortController` documentation](https://developer.mozilla.org/en-US/docs/Web/API/AbortController). */ unsubscribe(request: UnsubscribeRequest, abortSignal?: AbortSignal): Promise; /** * Fetches partition data using data handle. * * @param message The message data of partition metadata. * @param abortSignal A signal object that allows you to communicate with a request (such as the `fetch` request) * and, if required, abort it using the `AbortController` object. * * For more information, see the [`AbortController` documentation](https://developer.mozilla.org/en-US/docs/Web/API/AbortController). * * @return The data from the requested partition. */ getData(message: StreamApi.Message, abortSignal?: AbortSignal): Promise; /** * Method allows to start reading data from a specified offset. * The message pointer can be moved to any offset in the layer (topic). * Message consumption will start from that offset. Once you seek to an offset, * there is no returning to the initial offset, unless the initial offset is saved. * * @param request The [[SeekRequest]] instance of the configured request parameters. * @param abortSignal A signal object that allows you to communicate with a request (such as the `fetch` request) * and, if required, abort it using the `AbortController` object. * * For more information, see the [`AbortController` documentation](https://developer.mozilla.org/en-US/docs/Web/API/AbortController). * * @returns Response with status 200 if success. */ seek(request: SeekRequest, abortSignal?: AbortSignal): Promise; }