cloudflare
Version:
The official TypeScript library for the Cloudflare API
53 lines • 2.15 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from 'cloudflare/resource';
import * as AvailabilitiesAPI from 'cloudflare/resources/speed/availabilities';
import * as PagesAPI from 'cloudflare/resources/speed/pages';
import * as ScheduleAPI from 'cloudflare/resources/speed/schedule';
import * as TestsAPI from 'cloudflare/resources/speed/tests';
export class Speed extends APIResource {
constructor() {
super(...arguments);
this.tests = new TestsAPI.Tests(this._client);
this.schedule = new ScheduleAPI.ScheduleResource(this._client);
this.availabilities = new AvailabilitiesAPI.Availabilities(this._client);
this.pages = new PagesAPI.Pages(this._client);
}
/**
* Deletes a scheduled test for a page.
*/
delete(url, params, options) {
const { zone_id, region } = params;
return this._client.delete(`/zones/${zone_id}/speed_api/schedule/${url}`, {
query: { region },
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Retrieves the test schedule for a page in a specific region.
*/
scheduleGet(url, params, options) {
const { zone_id, ...query } = params;
return this._client.get(`/zones/${zone_id}/speed_api/schedule/${url}`, {
query,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Lists the core web vital metrics trend over time for a specific page.
*/
trendsList(url, params, options) {
const { zone_id, ...query } = params;
return this._client.get(`/zones/${zone_id}/speed_api/pages/${url}/trend`, {
query,
...options,
})._thenUnwrap((obj) => obj.result);
}
}
(function (Speed) {
Speed.Tests = TestsAPI.Tests;
Speed.ScheduleResource = ScheduleAPI.ScheduleResource;
Speed.Availabilities = AvailabilitiesAPI.Availabilities;
Speed.Pages = PagesAPI.Pages;
Speed.PageListResponsesSinglePage = PagesAPI.PageListResponsesSinglePage;
})(Speed || (Speed = {}));
//# sourceMappingURL=speed.mjs.map