import { FDSNCommon, IRIS_HOST, EARTHSCOPE_HOST } from "./fdsncommon.mjs"; import { DateTime, Interval } from "luxon"; import { SeismogramDisplayData } from "./seismogram.mjs"; /** const for json format, json */ export declare const FORMAT_JSON = "json"; /** const for text format, text */ export declare const FORMAT_TEXT = "text"; /** const for geocsv format, geocsv */ export declare const FORMAT_GEOCSV = "geocsv"; /** const for request format, request */ export declare const FORMAT_REQUEST = "request"; /** const of completely empty json, \{\} */ export declare const EMPTY_JSON: RootType; /** const for service name */ export declare const AVAILABILITY_SERVICE = "availability"; /** * Major version of the FDSN spec supported here. * Currently is 1. */ export declare const SERVICE_VERSION = 1; /** * Service name as used in the FDSN DataCenters registry, * https://www.fdsn.org/datacenters */ export declare const SERVICE_NAME = "fdsnws-availability-1"; /** const for the default IRIS web service host, service.iris.edu */ export { IRIS_HOST, EARTHSCOPE_HOST }; /** * Query to a FDSN Availability web service. * * ``` * const avail = AvailabilityQuery() * .networkCode("CO") * .stationCode("BIRD") * .startTime("2021-12-27T19:18:54Z") * .endTime("2021-12-27T19:22:54Z"); * avail.query().then(sddList => { * sddList.forEach(sdd => console.log(sdd)) * }); * ``` * * @see https://www.fdsn.org/webservices/ * @param host optional host to connect to, defaults to IRIS */ export declare class AvailabilityQuery extends FDSNCommon { /** @private */ _networkCode: string | undefined; /** @private */ _stationCode: string | undefined; /** @private */ _locationCode: string | undefined; /** @private */ _channelCode: string | undefined; /** @private */ _startTime: DateTime | undefined; /** @private */ _endTime: DateTime | undefined; /** @private */ _quality: string | undefined; /** @private */ _merge: string | undefined; /** @private */ _show: string | undefined; /** @private */ _mergeGaps: number | undefined; /** @private */ _limit: number | undefined; /** @private */ _orderby: string | undefined; /** @private */ _includerestricted: boolean | undefined; /** @private */ _format: string | undefined; constructor(host?: string); /** * Gets/Sets the version of the fdsnws spec, 1 is currently the only value. * Setting this is probably a bad idea as the code may not be compatible with * the web service. * * @param value spec version, usually 1 * @returns the query when setting, the current value when no argument */ specVersion(value?: string): AvailabilityQuery; getSpecVersion(): string; /** * Gets/Sets the protocol, http or https. This should match the protocol * of the page loaded, but is autocalculated and generally need not be set. * * @param value protocol, usually http or https * @returns the query when setting, the current value when no argument */ protocol(value?: string): AvailabilityQuery; getProtocol(): string | undefined; /** * Gets/Sets the remote host to connect to. * * @param value host * @returns the query when setting, the current value when no argument */ host(value?: string): AvailabilityQuery; getHost(): string; /** * Gets/Sets the nodata parameter, usually 404 or 204 (default), controlling * the status code when no matching data is found by the service. * * @param value number for nodata, usually 404 or 204 * @returns the query when setting, the current value when no argument */ nodata(value?: number): AvailabilityQuery; getNodata(): number | undefined; /** * Gets/Sets the port, not usually set unless not on standard http or https ports * * @param value port * @returns the query when setting, the current value when no argument */ port(value?: number): AvailabilityQuery; getPort(): number; pathBase(value?: string): AvailabilityQuery; getPathBase(): string; /** * Gets/Sets the network code to check. * * @param value network code like IU * @returns the query when setting, the current value when no argument */ networkCode(value?: string): AvailabilityQuery; getNetworkCode(): string | undefined; /** * Gets/Sets the station code to check. * * @param value station code like ANMO * @returns the query when setting, the current value when no argument */ stationCode(value?: string): AvailabilityQuery; getStationCode(): string | undefined; /** * Gets/Sets the location code to check. * * @param value location code like 00 * @returns the query when setting, the current value when no argument */ locationCode(value?: string): AvailabilityQuery; getLocationCode(): string | undefined; /** * Gets/Sets the channel code to check. * * @param value channel code like BHZ * @returns the query when setting, the current value when no argument */ channelCode(value?: string): AvailabilityQuery; getChannelCode(): string | undefined; /** * Gets/Sets the start time parameter for the query. * * @param value start time * @returns the query when setting, the current value when no argument */ startTime(value?: DateTime | string): AvailabilityQuery; getStartTime(): DateTime | undefined; /** * Gets/Sets the end time parameter for the query. * * @param value end time * @returns the query when setting, the current value when no argument */ endTime(value?: DateTime | string): AvailabilityQuery; getEndTime(): DateTime | undefined; /** * Sets startTime and endTime using the given time window * * @param se time window * @returns the query */ timeRange(se: Interval): AvailabilityQuery; /** * Gets/Sets the quality parameter for the query. * * @param value quality * @returns the query when setting, the current value when no argument */ quality(value?: string): AvailabilityQuery; getQuality(): string | undefined; /** * Gets/Sets the merge parameter for the query. * * @param value merge * @returns the query when setting, the current value when no argument */ merge(value?: string): AvailabilityQuery; getMerge(): string | undefined; /** * Gets/Sets the mergegaps parameter for the query. * * @param value merge gaps * @returns the query when setting, the current value when no argument */ mergeGaps(value?: number): AvailabilityQuery; getMergeGaps(): number | undefined; /** * Gets/Sets the show parameter for the query. * * @param value show * @returns the query when setting, the current value when no argument */ show(value?: string): AvailabilityQuery; getShow(): string | undefined; /** * Gets/Sets the limit parameter for the query. * * @param value limit * @returns the query when setting, the current value when no argument */ limit(value?: number): AvailabilityQuery; getLimit(): number | undefined; /** * Gets/Sets the order by parameter for the query. * * @param value order by * @returns the query when setting, the current value when no argument */ orderby(value?: string): AvailabilityQuery; getOrderBy(): string | undefined; /** * Gets/Sets the include restricted data parameter for the query. * * @param value true to include restricted data * @returns the query when setting, the current value when no argument */ includeRestricted(value?: boolean): AvailabilityQuery; getIncludeRestricted(): boolean | undefined; /** * Gets/Sets the format parameter for the query. Usually not needed as is set * by the various query methods. * * @param value format * @returns the query when setting, the current value when no argument */ format(value?: string): AvailabilityQuery; getFormat(): string | undefined; /** * Get/Set the timeout in seconds for the request. Default is 30. * * @param value timeout in seconds * @returns the query when setting, the current value when no argument */ timeout(value?: number): AvailabilityQuery; getTimeout(): number | undefined; /** * Calls query on the remote service, using configured parameters. Calls * queryJson internally, then unpacks the result into array of SeismogramDisplayData * objects. * * @returns promise to array of SeismogramDisplayData, each representing * a channel-time window */ query(): Promise>; /** * Calls the query function the remote server and parses the returned data as json. * * @returns promise to the result as json */ queryJson(): Promise; /** * Calls extent on the remote service, using configured parameters. Calls * extentJson internally, then unpacks the result into array of SeismogramDisplayData * objects. * * @returns promise to array of SeismogramDisplayData, each representing * a channel-time window */ extent(): Promise>; /** * Call the extend function on the remote server and parses the returned data as json. * * @returns promise to the result as json */ extentJson(): Promise; /** * Calls query on the remote service using POST, using configured parameters * and forms the POST body using the channelTimeList. Calls * postQueryJson internally, then unpacks the result into array of SeismogramDisplayData * objects. * * @param channelTimeList array of channel-time windows for the request * @returns promise to array of SeismogramDisplayData, each representing * a channel-time window */ postQuery(channelTimeList: Array): Promise>; postExtent(channelTimeList: Array): Promise>; postExtentJson(channelTimeList: Array): Promise; postQueryJson(channelTimeList: Array): Promise; postJson(channelTimeList: Array, method: string): Promise; postRaw(channelTimeList: Array, method: string): Promise; extractFromJson(jsonChanTimes: RootType): Array; createPostBody(channelTimeList: Array): string; /** * Forms the base of the url for accessing the dataselect service. * * @returns URL as string */ formBaseURL(): string; formVersionURL(): string; /** * Queries the remote web service to get its version * * @returns Promise to version string */ queryVersion(): Promise; makePostParm(name: string, val: unknown): string; formURL(method?: string): string; } /** * Root type of availablility json query. */ export type RootType = { created?: FdsnDateTime; version: Record; datasources: Array; } & Record; export type FdsnDateTime = string; export type Datasource = ({ network: string; station: string; location: string; channel: string; quality?: string; samplerate?: number; timespans?: Array>; earliest?: FdsnDateTime; latest?: FdsnDateTime; updated?: FdsnDateTime; timespanCount?: number; restriction?: string; } & Record) & (({ timespans: unknown; } & Record) | ({ earliest: FdsnDateTime; latest: FdsnDateTime; } & Record)); export declare function isValidRootType(jsonValue: unknown): jsonValue is RootType; export declare function isValidDatasource(jsonValue: unknown): jsonValue is Datasource; //# sourceMappingURL=fdsnavailability.d.mts.map