cloudflare
Version:
The official TypeScript library for the Cloudflare API
42 lines • 1.57 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from 'cloudflare/resource';
export class Tests extends APIResource {
/**
* Starts a test for a specific webpage, in a specific region.
*/
create(url, params, options) {
const { zone_id, ...body } = params;
return this._client.post(`/zones/${zone_id}/speed_api/pages/${url}/tests`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Test history (list of tests) for a specific webpage.
*/
list(url, params, options) {
const { zone_id, ...query } = params;
return this._client.get(`/zones/${zone_id}/speed_api/pages/${url}/tests`, { query, ...options });
}
/**
* Deletes all tests for a specific webpage from a specific region. Deleted tests
* are still counted as part of the quota.
*/
delete(url, params, options) {
const { zone_id, region } = params;
return this._client.delete(`/zones/${zone_id}/speed_api/pages/${url}/tests`, {
query: { region },
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Retrieves the result of a specific test.
*/
get(url, testId, params, options) {
const { zone_id } = params;
return this._client.get(`/zones/${zone_id}/speed_api/pages/${url}/tests/${testId}`, options)._thenUnwrap((obj) => obj.result);
}
}
(function (Tests) {
})(Tests || (Tests = {}));
//# sourceMappingURL=tests.mjs.map