UNPKG

arrakis-js

Version:

Arrakis Javascript client library

53 lines (52 loc) 1.77 kB
/** * Metadata associated with a channel. */ export declare class Channel { name: string; dataType: string; sampleRate: number; time: string; publisher: string; partitionID: number; /** * Creates a new Channel instance. * * @param name - The name associated with this channel. * @param dataType - The data type associated with this channel. * @param sampleRate - The sampling rate associated with this channel. * @param time - The timestamp when this metadata became active. * @param publisher - The publisher associated with this channel. * @param partitionID - The partition ID associated with this channel. */ constructor(name: string, dataType: string, sampleRate: number, time: string, publisher: string, partitionID: number); /** * Creates a Channel instance from a JSON object. * * This method converts a JSON representation of channel metadata * into a Channel instance, mapping JSON field names to the * corresponding Channel properties. * * @param json - JSON object containing channel metadata with snake_case field names * @returns A new Channel instance created from the JSON data * * @example * ```typescript * const jsonData = { * name: 'L1:GW-H1_STRAIN', * data_type: 'float64', * sample_rate: 4096, * time: '2023-01-01T00:00:00Z', * publisher: 'LIGO', * partition_id: 1 * }; * const channel = Channel.fromJson(jsonData); * console.log(channel.name); // 'L1:GW-H1_STRAIN' * console.log(channel.sampleRate); // 4096 * ``` */ static fromJson(json: any): Channel; } export type ChannelMessage = { done?: boolean; channel?: Channel; };