export as namespace globalping; /** * The transport protocol to use. */ declare const PingProtocol: { readonly ICMP: "ICMP"; readonly TCP: "TCP"; }; /** * The transport protocol to use. */ type PingProtocol = (typeof PingProtocol)[keyof typeof PingProtocol]; /** * EXPERIMENTAL: The IP version to use. Only allowed if the target is a hostname. * */ declare const IpVersion: { readonly 4: 4; readonly 6: 6; }; /** * EXPERIMENTAL: The IP version to use. Only allowed if the target is a hostname. * */ type IpVersion = (typeof IpVersion)[keyof typeof IpVersion]; /** * PingOptions */ type MeasurementPingOptions = { /** * The number of packets to send. */ packets?: number; protocol?: PingProtocol; /** * The destination port for the packets. Applies only for the `TCP` protocol. * */ port?: number; ipVersion?: IpVersion; }; /** * The transport protocol to use. */ declare const TracerouteProtocol: { readonly ICMP: "ICMP"; readonly TCP: "TCP"; readonly UDP: "UDP"; }; /** * The transport protocol to use. */ type TracerouteProtocol = (typeof TracerouteProtocol)[keyof typeof TracerouteProtocol]; /** * TracerouteOptions */ type MeasurementTracerouteOptions = { protocol?: TracerouteProtocol; /** * The destination port for the packets. Applies only for the `TCP` protocol. * */ port?: number; ipVersion?: IpVersion; }; /** * The type of DNS query. */ declare const DnsQueryType: { readonly A: "A"; readonly AAAA: "AAAA"; readonly ANY: "ANY"; readonly CNAME: "CNAME"; readonly DNSKEY: "DNSKEY"; readonly DS: "DS"; readonly HTTPS: "HTTPS"; readonly MX: "MX"; readonly NS: "NS"; readonly NSEC: "NSEC"; readonly PTR: "PTR"; readonly RRSIG: "RRSIG"; readonly SOA: "SOA"; readonly TXT: "TXT"; readonly SRV: "SRV"; readonly SVCB: "SVCB"; }; /** * The type of DNS query. */ type DnsQueryType = (typeof DnsQueryType)[keyof typeof DnsQueryType]; /** * A DNS resolver to use for the query. Defaults to the probe system resolver. */ type DnsMeasurementResolver = string; /** * The protocol to use for the DNS query. */ declare const DnsProtocol: { readonly TCP: "TCP"; readonly UDP: "UDP"; }; /** * The protocol to use for the DNS query. */ type DnsProtocol = (typeof DnsProtocol)[keyof typeof DnsProtocol]; /** * DnsOptions */ type MeasurementDnsOptions = { /** * The DNS query properties. */ query?: { type?: DnsQueryType; }; resolver?: DnsMeasurementResolver; protocol?: DnsProtocol; /** * The port number to send the query to. */ port?: number; ipVersion?: IpVersion; /** * Toggles tracing of the delegation path from the root servers down to the target domain name. * */ trace?: boolean; }; /** * The transport protocol to use. */ declare const MtrProtocol: { readonly ICMP: "ICMP"; readonly TCP: "TCP"; readonly UDP: "UDP"; }; /** * The transport protocol to use. */ type MtrProtocol = (typeof MtrProtocol)[keyof typeof MtrProtocol]; /** * MtrOptions */ type MeasurementMtrOptions = { /** * The number of packets to send to each hop. */ packets?: number; protocol?: MtrProtocol; /** * The destination port for the packets. Applies only for the `TCP` and `UDP` protocols. * */ port?: number; ipVersion?: IpVersion; }; /** * The HTTP method to use. */ declare const HttpRequestMethod: { readonly HEAD: "HEAD"; readonly GET: "GET"; readonly OPTIONS: "OPTIONS"; }; /** * The HTTP method to use. */ type HttpRequestMethod = (typeof HttpRequestMethod)[keyof typeof HttpRequestMethod]; /** * A DNS resolver to use for the query. Defaults to the probe system resolver. */ type HttpMeasurementResolver = string; declare const HttpProtocol: { readonly HTTP: "HTTP"; readonly HTTPS: "HTTPS"; readonly HTTP2: "HTTP2"; }; type HttpProtocol = (typeof HttpProtocol)[keyof typeof HttpProtocol]; /** * HttpOptions */ type MeasurementHttpOptions = { /** * The HTTP request properties. */ request?: { /** * An optional override for the `Host` header. The default value is based on the `target`. * */ host?: string; /** * The path portion of the URL. */ path?: string; /** * The query string portion of the URL. */ query?: string; method?: HttpRequestMethod; /** * Additional request headers. Note that the `Host` and `User-Agent` are reserved and internally overridden. * */ headers?: { [key: string]: string; }; }; resolver?: HttpMeasurementResolver; protocol?: HttpProtocol; /** * The port number to use. */ port?: number; ipVersion?: IpVersion; }; type MeasurementOptionsConditions = unknown; /** * The measurement type. */ declare const MeasurementType: { readonly PING: "ping"; readonly TRACEROUTE: "traceroute"; readonly DNS: "dns"; readonly MTR: "mtr"; readonly HTTP: "http"; }; /** * The measurement type. */ type MeasurementType = (typeof MeasurementType)[keyof typeof MeasurementType]; /** * A publicly reachable measurement target. * Typically a hostname, an IPv4 address, or IPv6 address, depending on the measurement `type`. * Support for IPv6 targets is currently considered experimental. * */ type MeasurementTarget = string; /** * A two-letter continent code. */ declare const ContinentCode: { readonly AF: "AF"; readonly AN: "AN"; readonly AS: "AS"; readonly EU: "EU"; readonly NA: "NA"; readonly OC: "OC"; readonly SA: "SA"; }; /** * A two-letter continent code. */ type ContinentCode = (typeof ContinentCode)[keyof typeof ContinentCode]; /** * A geographic region name based on UN [Standard Country or Area Codes for Statistical Use (M49)](https://unstats.un.org/unsd/methodology/m49/). * */ declare const RegionName: { readonly NORTHERN_AFRICA: "Northern Africa"; readonly EASTERN_AFRICA: "Eastern Africa"; readonly MIDDLE_AFRICA: "Middle Africa"; readonly SOUTHERN_AFRICA: "Southern Africa"; readonly WESTERN_AFRICA: "Western Africa"; readonly CARIBBEAN: "Caribbean"; readonly CENTRAL_AMERICA: "Central America"; readonly SOUTH_AMERICA: "South America"; readonly NORTHERN_AMERICA: "Northern America"; readonly CENTRAL_ASIA: "Central Asia"; readonly EASTERN_ASIA: "Eastern Asia"; readonly SOUTH_EASTERN_ASIA: "South-eastern Asia"; readonly SOUTHERN_ASIA: "Southern Asia"; readonly WESTERN_ASIA: "Western Asia"; readonly EASTERN_EUROPE: "Eastern Europe"; readonly NORTHERN_EUROPE: "Northern Europe"; readonly SOUTHERN_EUROPE: "Southern Europe"; readonly WESTERN_EUROPE: "Western Europe"; readonly AUSTRALIA_AND_NEW_ZEALAND: "Australia and New Zealand"; readonly MELANESIA: "Melanesia"; readonly MICRONESIA: "Micronesia"; readonly POLYNESIA: "Polynesia"; }; /** * A geographic region name based on UN [Standard Country or Area Codes for Statistical Use (M49)](https://unstats.un.org/unsd/methodology/m49/). * */ type RegionName = (typeof RegionName)[keyof typeof RegionName]; /** * A two-letter country code based on [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements). */ type CountryCode = string; /** * A two-letter [US state code](https://www.faa.gov/air_traffic/publications/atpubs/cnt_html/appendix_a.html). */ type StateCode = string; /** * A city name in English. */ type CityName = string; /** * An autonomous system number (ASN). */ type AsnCode = number; /** * A network name, such as "Google LLC" or "DigitalOcean, LLC". */ type NetworkName = string; /** * An array of additional values to fine-tune probe selection: * - Probes hosted in [AWS](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html#concepts-available-regions) and [Google Cloud](https://cloud.google.com/compute/docs/regions-zones#available) are automatically assigned the service region code. For example: `aws-eu-west-1` and `gcp-us-south1`. * - Probes are automatically assigned `datacenter-network` and `eyeball-network` tags to distinguish between datacenter and end-user locations. * */ type Tags = Array; type MeasurementLocationOption = { continent?: ContinentCode; region?: RegionName; country?: CountryCode; state?: StateCode; city?: CityName; asn?: AsnCode; network?: NetworkName; tags?: Tags; /** * Locations defined in a single string instead of the respective location properties. * The API performs fuzzy matching on the `country`, `city`, `state` (using `US-` prefix, e.g., `US-NY`), `continent`, `region`, `asn` (using `AS` prefix, e.g., `AS123`), `tags`, and `network` values. * Supports full names, ISO codes (where applicable), and common aliases. * Multiple conditions can be combined using the `+` character, which behaves as a logical `AND`. * * Note that in some cases, the names of cities, states, and countries, as well as the ISO codes of countries and continents, overlap. Additionally, city names are not unique across countries. * We recommend that you: * - refer to US states via their full [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2:US) codes, e.g., `US-NY`, * - refer to cities in combination with their country or US state, * - refer to continents by their name (not the two letter codes). * */ magic?: string; /** * The maximum number of probes that should run the measurement in this location. * Non-authenticated requests are limited to a maximum of 50 probes. * The result count might be lower if there aren't enough probes available in this location. * Mutually exclusive with the global `limit` property. * */ limit?: number; }; type MeasurementLocations = Array | string; /** * The maximum number of probes that should run the measurement. * The result count might be lower if there aren't enough probes available in the specified locations. * Mutually exclusive with the `limit` property that can be set for individual locations. * Non-authenticated requests are limited to a maximum of 50 probes. * */ type MeasurementLimit = number; /** * Additional optional fields depending on the measurement `type`. */ type MeasurementOptions = MeasurementPingOptions | MeasurementTracerouteOptions | MeasurementDnsOptions | MeasurementMtrOptions | MeasurementHttpOptions; type MeasurementRequest = MeasurementOptionsConditions & { type: MeasurementType; target: MeasurementTarget; /** * Indicates whether you want to get partial results while the measurement is still running: * - If `true`, partial results are returned as soon as they are available, and you can present them to the user in real time. Note that only the first 5 tests from the `results` array will update in real time. * - If `false`, the result of each test is updated only after the test finishes. * */ inProgressUpdates?: boolean; locations?: MeasurementLocations; limit?: MeasurementLimit; /** * The probe-side wall-clock timeout for each test, in seconds. If omitted, the value is calculated based on the provided measurement options and can be up to 20 seconds. * In all cases, callers should allow at least 10 additional seconds for probe-to-API communication and API measurement finalization before triggering a client-side timeout. * */ timeout?: number; measurementOptions?: MeasurementOptions; }; /** * The actual number of probes that performed the measurement tests. * Smaller or equal to `limit`, depending on probe availability. * */ type MeasurementProbesCount = number; /** * Contains information about the newly created measurement. */ type CreateMeasurementResponse = { /** * The measurement ID. * > **Tip**: You can use the ID to create a new measurement request, reusing the same probes. * */ id: string; probesCount: MeasurementProbesCount; }; /** * The current test status. Any value other than `in-progress` is final. */ type BaseTestStatus = string; type FinishedTestStatus = BaseTestStatus & 'finished'; /** * The raw output of the test. Can be presented to users but is not meant to be parsed by clients. * Please use the individual values provided in other fields for automated processing. * */ type TestRawOutput = string; type BaseFinishedTestResult = { status: FinishedTestStatus; rawOutput: TestRawOutput; }; /** * The resolved IP address of the `target`. */ type ResolvedAddress = string | null; /** * The resolved hostname of the `target`. */ type ResolvedHostname = string | null; type NullableNumber = number | null; type StatsRttMinNullable = NullableNumber & unknown; type StatsRttAvgNullable = NullableNumber & unknown; type StatsRttMaxNullable = NullableNumber & unknown; /** * The number of packets sent. */ type StatsPacketsTotal = number; /** * The number of received packets. */ type StatsPacketsRcv = number; /** * The number of dropped packets (`total` - `rcv`). */ type StatsPacketsDrop = number; /** * The percentage of dropped packets. */ type StatsPacketsLoss = number; /** * The round-trip time for this packet. */ type TimingPacketRtt = number; /** * The time-to-live value of this packet. */ type TimingPacketTtl = number; /** * IcmpPingTiming */ type IcmpPingTiming = { rtt: TimingPacketRtt; ttl: TimingPacketTtl; }; /** * TcpPingTiming */ type TcpPingTiming = { rtt: TimingPacketRtt; }; /** * FinishedPingTestResult * * Represents a `finished` ping test. */ type FinishedPingTestResult = BaseFinishedTestResult & { resolvedAddress: ResolvedAddress; resolvedHostname: ResolvedHostname; /** * Summary `rtt` and packet loss statistics. * All times are in milliseconds. * */ stats: { min: StatsRttMinNullable; avg: StatsRttAvgNullable; max: StatsRttMaxNullable; total: StatsPacketsTotal; rcv: StatsPacketsRcv; drop: StatsPacketsDrop; loss: StatsPacketsLoss; }; /** * An array containing details for each packet. * All times are in milliseconds. * */ timings: Array; }; /** * FinishedTracerouteTestResult * * Represents a `finished` traceroute test. */ type FinishedTracerouteTestResult = BaseFinishedTestResult & { resolvedAddress: ResolvedAddress; resolvedHostname: ResolvedHostname; /** * An array containing details about each hop. */ hops: Array<{ resolvedAddress: ResolvedAddress; resolvedHostname: ResolvedHostname; /** * An array containing details for each packet. * All times are in milliseconds. * */ timings: Array<{ rtt: TimingPacketRtt; }>; }>; }; /** * The DNS [response code](https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#table-dns-parameters-6). */ type DnsStatusCode = number; /** * The DNS [response code name](https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#table-dns-parameters-6). */ type DnsStatusCodeName = string; type DnsTestAnswer = { /** * The record domain name. */ name: string; /** * The record type. */ type: string; /** * The record time-to-live value in seconds. */ ttl: number; /** * The record class. */ class: string; /** * The record value. */ value: string; }; type DnsTestHopResult = { /** * The hostname or IP of the resolver that answered the query. */ resolver: string; /** * An array of the received resource records. */ answers: Array; /** * Details about the query times. * All times are in milliseconds. * */ timings: { /** * The total query time. */ total: number; }; }; /** * FinishedSimpleDnsTestResult * * Represents a `finished` DNS test with `trace` disabled. */ type FinishedSimpleDnsTestResult = BaseFinishedTestResult & { statusCode: DnsStatusCode; statusCodeName: DnsStatusCodeName; } & DnsTestHopResult; /** * FinishedTraceDnsTestResult * * Represents a `finished` DNS test with `trace` enabled. */ type FinishedTraceDnsTestResult = BaseFinishedTestResult & { /** * An array containing details about each hop. */ hops: Array; }; /** * FinishedDnsTestResult */ type FinishedDnsTestResult = FinishedSimpleDnsTestResult | FinishedTraceDnsTestResult; type StatsStDevNullable = NullableNumber & unknown; type StatsJitterMinNullable = NullableNumber & unknown; type StatsJitterAvgNullable = NullableNumber & unknown; type StatsJitterMaxNullable = NullableNumber & unknown; /** * FinishedMtrTestResult * * Represents a `finished` MTR test. */ type FinishedMtrTestResult = BaseFinishedTestResult & { resolvedAddress: ResolvedAddress; resolvedHostname: ResolvedHostname; /** * An array containing details about each hop. */ hops: Array<{ resolvedAddress: ResolvedAddress & unknown; resolvedHostname: ResolvedHostname & unknown; /** * An array containing the ASNs assigned to this hop. */ asn: Array; /** * Summary `rtt` and packet loss statistics. * All times are in milliseconds. * */ stats: { min: StatsRttMinNullable; avg: StatsRttAvgNullable; max: StatsRttMaxNullable; stDev: StatsStDevNullable; jMin: StatsJitterMinNullable; jAvg: StatsJitterAvgNullable; jMax: StatsJitterMaxNullable; total: StatsPacketsTotal; rcv: StatsPacketsRcv; drop: StatsPacketsDrop; loss: StatsPacketsLoss; }; /** * An array containing details for each packet. * All times are in milliseconds. * */ timings: Array<{ rtt: TimingPacketRtt; }>; }>; }; /** * The HTTP response status code. */ type HttpStatusCode = number; /** * The HTTP response status code name. */ type HttpStatusCodeName = string; type NullableInteger = number | null; type TimingHttpTotalNullable = NullableInteger & unknown; type TimingHttpDnsNullable = NullableInteger & unknown; type TimingHttpTcpNullable = NullableInteger & unknown; type TimingHttpTlsNullable = NullableInteger & unknown; type TimingHttpFirstByteNullable = NullableInteger & unknown; type TimingHttpDownloadNullable = NullableInteger & unknown; /** * Information about the certificate subject. */ type TlsCertificateSubject = { /** * The subject's common name. */ CN?: string; /** * The subject's alternative names. */ alt?: string; }; /** * Information about the certificate issuer. */ type TlsCertificateIssuer = { /** * The issuer's country. */ C?: string; /** * The issuer's organization. */ O?: string; /** * The issuer's common name. */ CN?: string; }; /** * The type of the used key, or `null` for unrecognized types. */ declare const TlsKeyType: { readonly RSA: "RSA"; readonly EC: "EC"; readonly NULL: "null"; }; /** * The type of the used key, or `null` for unrecognized types. */ type TlsKeyType = (typeof TlsKeyType)[keyof typeof TlsKeyType]; /** * TlsCertificate */ type TlsCertificate = { /** * The negotiated SSL/TLS protocol version. * */ protocol: string; /** * The OpenSSL name of the cipher suite. * */ cipherName: string; /** * Indicates whether a trusted authority signed the certificate. * */ authorized: boolean; /** * The reason for rejecting the certificate if `authorized` is `false`. * */ error?: string; /** * The creation date and time of the certificate. */ createdAt: string; /** * The expiration date and time of the certificate. */ expiresAt: string; subject: TlsCertificateSubject; issuer: TlsCertificateIssuer; keyType: TlsKeyType; /** * The size of the used key, or `null` for unrecognized types. */ keyBits: number | null; /** * The certificate serial number as a : separated HEX string. * */ serialNumber: string; /** * The SHA-256 digest of the DER-encoded certificate as a : separated HEX string. * */ fingerprint256: string; /** * The public key as a : separated HEX string, or `null` for unrecognized types. * */ publicKey: string | null; }; /** * FinishedHttpTestResult * * Represents a `finished` HTTP test. */ type FinishedHttpTestResult = BaseFinishedTestResult & { /** * The raw HTTP response headers. */ rawHeaders: string; /** * The raw HTTP response body or `null` if there was no body in response. * Note that only the first 10 kb are returned. * */ rawBody: string | null; /** * Indicates whether the `rawHeaders` or `rawBody` value was truncated due to being too big. * */ truncated: boolean; /** * The HTTP response headers. The value may be an array of strings for headers with multiple values, e.g., `Set-Cookie`. */ headers: { [key: string]: string | Array; }; statusCode: HttpStatusCode; statusCodeName: HttpStatusCodeName; resolvedAddress: ResolvedAddress; /** * Details about the HTTP request times. * All times are in milliseconds. * */ timings: { total: TimingHttpTotalNullable; dns: TimingHttpDnsNullable; tcp: TimingHttpTcpNullable; tls: TimingHttpTlsNullable; firstByte: TimingHttpFirstByteNullable; download: TimingHttpDownloadNullable; }; /** * Information about the TLS certificate or `null` if no TLS certificate is available. */ tls: TlsCertificate | null; }; /** * The current measurement status. Any value other than `in-progress` is final. */ declare const MeasurementStatus: { readonly IN_PROGRESS: "in-progress"; readonly FINISHED: "finished"; }; /** * The current measurement status. Any value other than `in-progress` is final. */ type MeasurementStatus = (typeof MeasurementStatus)[keyof typeof MeasurementStatus]; /** * The latitude of probe location. */ type Latitude = number; /** * The longitude of probe location. */ type Longitude = number; /** * The probe location information. */ type ProbeLocation = { continent: ContinentCode; region: RegionName; country: CountryCode; state: StateCode | null; city: CityName; asn: AsnCode; network: NetworkName; latitude: Latitude; longitude: Longitude; }; type ProbeResolver = string | 'private'; /** * An array of the default resolvers configured on the probe. */ type ProbeResolvers = Array; type InProgressTestStatus = BaseTestStatus & 'in-progress'; /** * InProgressTestResult * * Represents an `in-progress` test where most fields are not yet available. * */ type InProgressTestResult = { status: InProgressTestStatus; rawOutput: TestRawOutput; }; type FailedTestStatus = BaseTestStatus & 'failed'; /** * EXPERIMENTAL: The most likely source of the failure: * - `target` covers the target and its network path, including misconfigured DNS records and timeouts, * - `resolver` covers failures communicating with or receiving an unusable response from the DNS resolver, * - `internal` covers Globalping probe and API failures. * The exact source cannot always be determined reliably, so this field is a best-effort classification. * */ declare const FailureSource: { readonly TARGET: "target"; readonly RESOLVER: "resolver"; readonly INTERNAL: "internal"; }; /** * EXPERIMENTAL: The most likely source of the failure: * - `target` covers the target and its network path, including misconfigured DNS records and timeouts, * - `resolver` covers failures communicating with or receiving an unusable response from the DNS resolver, * - `internal` covers Globalping probe and API failures. * The exact source cannot always be determined reliably, so this field is a best-effort classification. * */ type FailureSource = (typeof FailureSource)[keyof typeof FailureSource]; /** * FailedTestResult * * Represents a `failed` test where most fields are not available. * */ type FailedTestResult = { status: FailedTestStatus; failureSource?: FailureSource; rawOutput: TestRawOutput; }; type OfflineTestStatus = BaseTestStatus & 'offline'; /** * OfflineTestResult * * Represents an `offline` test where the requested probe was not available to run the test and most fields are not available. * Only possible when you pass the `id` of a previous measurement in the `locations` field. * */ type OfflineTestResult = { status: OfflineTestStatus; rawOutput: TestRawOutput; }; type TestResult = InProgressTestResult | FailedTestResult | OfflineTestResult | FinishedPingTestResult | FinishedTracerouteTestResult | FinishedDnsTestResult | FinishedMtrTestResult | FinishedHttpTestResult; type MeasurementResultItem = { probe: ProbeLocation & { tags: Tags; resolvers: ProbeResolvers; }; result: TestResult; }; type MeasurementResponse = { /** * The measurement ID. */ id: string; type: MeasurementType; target: MeasurementTarget; status: MeasurementStatus; /** * The date and time when the measurement was created. */ createdAt: string; /** * The date and time when the measurement was last updated. */ updatedAt: string; probesCount: MeasurementProbesCount; /** * The locations you specified when creating the measurement. * If you passed in an `id` of a previous measurement, the value will be filled in from that measurement. * */ locations?: Array; limit?: MeasurementLimit & unknown; /** * The probe-side wall-clock timeout for each test, in seconds, if different from the calculated value. * */ timeout?: number; measurementOptions?: MeasurementOptions & unknown; /** * An array containing the measurement results. */ results: Array; }; type Probe = { /** * The probe version. */ version: string; location: ProbeLocation; tags: Tags; resolvers: ProbeResolvers; }; type Probes = Array; /** * Type of the rate limit. */ declare const RateLimitType: { readonly IP: "ip"; readonly USER: "user"; }; /** * Type of the rate limit. */ type RateLimitType = (typeof RateLimitType)[keyof typeof RateLimitType]; type RateLimitDetails = { type: RateLimitType; /** * The number of rate limit points available in a given time window. */ limit: number; /** * The number of rate limit points remaining in the current time window. */ remaining: number; /** * The number of seconds until the limit resets. */ reset: number; }; type Limits = { /** * Object containing rate limits information. */ rateLimit: { /** * Measurements rate limits. */ measurements: { create: RateLimitDetails & unknown; }; }; /** * Object containing credits information (only for authenticated requests). */ credits?: { /** * The number of user's remaining credits. */ remaining?: number; }; }; type CreateMeasurementErrors = { /** * If the API couldn't process the request due to malformed parameters or other client errors, it returns status `400 Bad Request` * and a body with more information about the error. Please modify your request before trying again. * */ 400: { /** * Information about the error. */ error: { /** * The type of the error. */ type: string; /** * A human-readable description of the error. */ message: string; /** * Additional information that might be present if the error is related to a specific parameter or payload field. */ params?: { [key: string]: string; }; }; links?: { /** * A link to documentation for the relevant endpoint. */ documentation?: string; }; }; /** * If the API couldn't find suitable probes for your request, it returns status `422 Unprocessable Content` and a body with more * information about the error. Please modify your request before trying again. * */ 422: { error: { type: string; message: string; }; links?: { /** * A link to documentation for the relevant endpoint. */ documentation?: string; }; }; /** * If you've exceeded the API rate limit, you'll receive status `429 Too Many Requests` and a body containing more information about the error. * */ 429: { error: { type: string; message: string; }; links?: { /** * A link to documentation for the relevant endpoint. */ documentation?: string; }; }; }; type CreateMeasurementResponses = { /** * If the API accepted the request for processing, it returns status `202 Accepted` and a body containing the ID of the newly created measurement. * You can use the URL from the `Location` header to retrieve the measurement status. * */ 202: CreateMeasurementResponse; }; type GetMeasurementErrors = { /** * If the API couldn't find the requested resource, it returns status `404 Not Found` * and a body containing more information about the error. * */ 404: { error: { type: string; message: string; }; links?: { /** * A link to documentation for the relevant endpoint. */ documentation?: string; }; }; /** * If you've exceeded the API rate limit, you'll receive status `429 Too Many Requests` and a body containing more information about the error. * */ 429: { error: { type: string; message: string; }; links?: { /** * A link to documentation for the relevant endpoint. */ documentation?: string; }; }; }; type ListProbesResponses = { /** * A successful request returns status `200 OK` and a body containing a list of all probes currently online and their metadata. * */ 200: Probes; }; type GetLimitsResponses = { /** * A successful request returns status `200 OK` and a body containing information about the current rate limits and user credits. * */ 200: Limits; }; type CommonMeasurementOptions = Omit; type FinishedTestResultTypes = { ping: FinishedPingTestResult; traceroute: FinishedTracerouteTestResult; dns: FinishedDnsTestResult; mtr: FinishedMtrTestResult; http: FinishedHttpTestResult; }; type PingMeasurementRequest = { type: 'ping'; measurementOptions?: MeasurementPingOptions; } & CommonMeasurementOptions; type TracerouteMeasurementRequest = { type: 'traceroute'; measurementOptions?: MeasurementTracerouteOptions; } & CommonMeasurementOptions; type MtrMeasurementRequest = { type: 'mtr'; measurementOptions?: MeasurementMtrOptions; } & CommonMeasurementOptions; type DnsMeasurementRequest = { type: 'dns'; measurementOptions?: MeasurementDnsOptions; } & CommonMeasurementOptions; type HttpMeasurementRequest = { type: 'http'; measurementOptions?: MeasurementHttpOptions; } & CommonMeasurementOptions; type TypedMeasurementRequest = PingMeasurementRequest | TracerouteMeasurementRequest | MtrMeasurementRequest | DnsMeasurementRequest | HttpMeasurementRequest; type TypedMeasurementResultItem = { result: InProgressTestResult | FailedTestResult | OfflineTestResult | FinishedTestResultTypes[T]; } & Omit; type TypedMeasurementResponse = { type: T; measurementOptions?: Coalesce['measurementOptions'], never>; results: Array>; } & Omit; type TypedMeasurementResponses = { 200: TypedMeasurementResponse; }; type FinishedMeasurementResponse = { status: 'finished'; } & Omit, 'status'>; type SuccessCallResult = { ok: true; data: NonNullable[ST]; request: Request; response: Response; }; type ErrorCallResult = { ok: false; data: ErrorType[ST]; request: Request; response: Response; }; type CallResult = SuccessCallResult | ErrorCallResult; type NoResponseTypes = { [k: number]: never; }; type KnownResponseTypes = { [k: number]: object; }; type Coalesce = T extends undefined ? D : T; type GlobalpingOptions = { auth?: string; userAgent?: string; throwApiErrors?: ThrowOnKnownErrors; timeout?: number; }; type AwaitMeasurementOptions = { signal?: AbortSignal; }; declare class Globalping { private readonly auth; private readonly client; private readonly userAgent; private readonly throwApiErrors; private readonly timeout; constructor({ auth, userAgent, throwApiErrors, timeout }?: GlobalpingOptions); /** * @see {@link sdk.createMeasurement} for the API docs */ createMeasurement(measurement: TypedMeasurementRequest): Promise<(ThrowApiErrors extends true ? never : CallResult) | SuccessCallResult>; /** * @see {@link sdk.getMeasurement} for the API docs */ getMeasurement(id: string): Promise<(ThrowApiErrors extends true ? never : CallResult, GetMeasurementErrors>) | SuccessCallResult>>; /** * @see {@link sdk.getMeasurement} for the API docs */ awaitMeasurement(id: string, { signal }?: AwaitMeasurementOptions): Promise<(ThrowApiErrors extends true ? never : CallResult, GetMeasurementErrors>) | { data: FinishedMeasurementResponse; ok: true; request: Request; response: Response; }>; /** * @see {@link sdk.listProbes} for the API docs */ listProbes(): Promise<(ThrowApiErrors extends true ? never : CallResult) | SuccessCallResult>; /** * @see {@link sdk.getLimits} for the API docs */ getLimits(): Promise<(ThrowApiErrors extends true ? never : CallResult) | SuccessCallResult>; private static requireRequestCompleted; private transformResult; static assertHttpStatus(status: S, result: CallResult): asserts result is CallResult; static assertMeasurementFinished(measurement: MeasurementResponse): asserts measurement is FinishedMeasurementResponse; static assertMeasurementType(type: T, measurement: MeasurementResponse): asserts measurement is TypedMeasurementResponse; static isHttpStatus(status: S, result: CallResult): result is CallResult; static isMeasurementFinished(measurement: MeasurementResponse): measurement is FinishedMeasurementResponse; static isMeasurementType(type: T, measurement: MeasurementResponse): measurement is TypedMeasurementResponse; } declare class HttpError extends Error { readonly request: Request; readonly response: Response; constructor(request: Request, response: Response); } declare class ApiError extends HttpError { readonly data: T; constructor(request: Request, response: Response, data: T); } export { ApiError, ContinentCode, DnsProtocol, DnsQueryType, FailureSource, Globalping, HttpError, HttpProtocol, HttpRequestMethod, IpVersion, MeasurementStatus, MeasurementType, MtrProtocol, PingProtocol, RateLimitType, RegionName, TlsKeyType, TracerouteProtocol, Globalping as default }; export type { AwaitMeasurementOptions, CreateMeasurementResponse, DnsMeasurementRequest, FailedTestResult, FinishedDnsTestResult, FinishedHttpTestResult, FinishedMeasurementResponse, FinishedMtrTestResult, FinishedPingTestResult, FinishedSimpleDnsTestResult, FinishedTraceDnsTestResult, FinishedTracerouteTestResult, GlobalpingOptions, HttpMeasurementRequest, InProgressTestResult, Limits, MeasurementDnsOptions, MeasurementHttpOptions, MeasurementLocationOption, MeasurementLocations, MeasurementMtrOptions, MeasurementOptions, MeasurementPingOptions, MeasurementResponse, MeasurementResultItem, MeasurementTracerouteOptions, MtrMeasurementRequest, OfflineTestResult, PingMeasurementRequest, Probe, ProbeLocation, Probes, TestResult, TracerouteMeasurementRequest, TypedMeasurementRequest, TypedMeasurementResponse, TypedMeasurementResponses, TypedMeasurementResultItem };