"use strict";
// File generated from our OpenAPI spec by Stainless.
Object.defineProperty(exports, "__esModule", { value: true });
exports.Routes = void 0;
const resource_1 = require("cloudflare/resource");
class Routes extends resource_1.APIResource {
    /**
     * Creates a route that maps a URL pattern to a Worker.
     */
    create(params, options) {
        const { zone_id, ...body } = params;
        return this._client.post(`/zones/${zone_id}/workers/routes`, { body, ...options })._thenUnwrap((obj) => obj.result);
    }
    /**
     * Updates the URL pattern or Worker associated with a route.
     */
    update(routeId, params, options) {
        const { zone_id, ...body } = params;
        return this._client.put(`/zones/${zone_id}/workers/routes/${routeId}`, {
            body,
            ...options,
        })._thenUnwrap((obj) => obj.result);
    }
    /**
     * Returns routes for a zone.
     */
    list(params, options) {
        const { zone_id } = params;
        return this._client.get(`/zones/${zone_id}/workers/routes`, options)._thenUnwrap((obj) => obj.result);
    }
    /**
     * Deletes a route.
     */
    delete(routeId, params, options) {
        const { zone_id } = params;
        return this._client.delete(`/zones/${zone_id}/workers/routes/${routeId}`, options)._thenUnwrap((obj) => obj.result);
    }
    /**
     * Returns information about a route, including URL pattern and Worker.
     */
    get(routeId, params, options) {
        const { zone_id } = params;
        return this._client.get(`/zones/${zone_id}/workers/routes/${routeId}`, options)._thenUnwrap((obj) => obj.result);
    }
}
exports.Routes = Routes;
(function (Routes) {
})(Routes = exports.Routes || (exports.Routes = {}));
//# sourceMappingURL=routes.js.map