// This file is auto-generated by @hey-api/openapi-ts
import { client as _heyApiClient } from './client.gen.js';
/**
 * Create a measurement
 * Creates a new measurement with parameters set in the request body.
 * The measurement runs asynchronously and you can retrieve its current state at the URL returned in the `Location` header.
 *
 * ### Client guidelines
 *
 * - If the application is running in interactive mode, set the `inProgressUpdates` option to `true` to have the API
 * return partial results as soon as they are available. This allows the user to see the measurement progress in real time.
 * - If the application is interactive by default but also implements a "CI" mode for scripting, do not set the flag in the CI mode.
 * - To perform multiple measurements using exactly the same probes, create a single measurement first, then pass its `id` in the `locations` field for the other measurements.
 * - When you receive a `429` response, inform the user about their current rate limit status based on the response headers. Depending on the exact situation and on what your application supports, you may also suggest:
 * - Signing in or using an access token.
 * - Learning more about how to get additional credits at https://globalping.io/credits.
 * - Repeating the measurement with fewer probes.
 *
 */
export const createMeasurement = (options) => {
    var _a;
    return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : _heyApiClient).post({
        security: [
            {
                scheme: 'bearer',
                type: 'http',
            },
            {
                scheme: 'bearer',
                type: 'http',
            },
        ],
        url: '/v1/measurements',
        ...options,
        headers: {
            'Content-Type': 'application/json',
            ...options === null || options === void 0 ? void 0 : options.headers,
        },
    });
};
/**
 * Get a measurement by ID
 * Returns the status and results of an existing measurement.
 * Measurements are typically available for up to 7 days after creation.
 *
 * > **Tip**: A link to this endpoint is returned in the `Location` response header when creating the measurement.
 *
 * ### Client guidelines
 *
 * As it can take a few seconds for a measurement to complete, you should use the following process for retrieving the results:
 * 1. Request the measurement to retrieve its status.
 * 2. If the status is `in-progress`, wait 500 milliseconds and start again at step 1. Note that it's important to wait 500 ms *after* receiving the response rather than using an "every 500ms" interval as for large measurements, the request itself may take a few hundred milliseconds to complete.
 * 3. If the status is anything **other** than `in-progress`, stop. The measurement is no longer running, and its results are final.
 *
 * > **Important**: Do not query the results of a single measurement more often than every 500 milliseconds. Sending more than two
 * requests per second may trigger a rate limit and prevent you from accessing the results for a few seconds.
 *
 */
export const getMeasurement = (options) => {
    var _a;
    return ((_a = options.client) !== null && _a !== void 0 ? _a : _heyApiClient).get({
        url: '/v1/measurements/{id}',
        ...options,
    });
};
/**
 * List probes currently online
 * Returns a list of all probes currently online and their metadata, such as location and assigned tags.
 *
 * > **Note**: Probes don't expose unique IDs that would allow you to explicitly select them.
 * Instead, specify the requested location or an ID of an existing measurement when creating new measurements.
 *
 */
export const listProbes = (options) => {
    var _a;
    return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : _heyApiClient).get({
        url: '/v1/probes',
        ...options,
    });
};
/**
 * Get current rate limits
 * Returns rate limits for the current user (if authenticated) or IP address (if not authenticated).
 *
 */
export const getLimits = (options) => {
    var _a;
    return ((_a = options === null || options === void 0 ? void 0 : options.client) !== null && _a !== void 0 ? _a : _heyApiClient).get({
        security: [
            {
                scheme: 'bearer',
                type: 'http',
            },
            {
                scheme: 'bearer',
                type: 'http',
            },
        ],
        url: '/v1/limits',
        ...options,
    });
};
//# sourceMappingURL=sdk.gen.js.map