cloudflare
Version:
The official TypeScript library for the Cloudflare API
114 lines • 4.28 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Hostnames = exports.BaseHostnames = void 0;
const tslib_1 = require("../../../internal/tslib.js");
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
const resource_1 = require("../../../core/resource.js");
const IPFSUniversalPathsAPI = tslib_1.__importStar(require("./ipfs-universal-paths/ipfs-universal-paths.js"));
const ipfs_universal_paths_1 = require("./ipfs-universal-paths/ipfs-universal-paths.js");
const pagination_1 = require("../../../core/pagination.js");
const path_1 = require("../../../internal/utils/path.js");
var BaseHostnames = /* @__PURE__ */ (() => {
class BaseHostnames extends resource_1.APIResource {
/**
* Create Web3 Hostname
*
* @example
* ```ts
* const hostname = await client.web3.hostnames.create({
* zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
* name: 'gateway.example.com',
* target: 'ipfs',
* });
* ```
*/
create(params, options) {
const { zone_id, ...body } = params;
return this._client.post((0, path_1.path) `/zones/${zone_id}/web3/hostnames`, { body, ...options })._thenUnwrap((obj) => obj.result);
}
/**
* List Web3 Hostnames
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const hostname of client.web3.hostnames.list({
* zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
* })) {
* // ...
* }
* ```
*/
list(params, options) {
const { zone_id } = params;
return this._client.getAPIList((0, path_1.path) `/zones/${zone_id}/web3/hostnames`, (pagination_1.SinglePage), options);
}
/**
* Delete Web3 Hostname
*
* @example
* ```ts
* const hostname = await client.web3.hostnames.delete(
* '023e105f4ecef8ad9ca31a8372d0c353',
* { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
delete(identifier, params, options) {
const { zone_id } = params;
return this._client.delete((0, path_1.path) `/zones/${zone_id}/web3/hostnames/${identifier}`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Edit Web3 Hostname
*
* @example
* ```ts
* const hostname = await client.web3.hostnames.edit(
* '023e105f4ecef8ad9ca31a8372d0c353',
* { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
edit(identifier, params, options) {
const { zone_id, ...body } = params;
return this._client.patch((0, path_1.path) `/zones/${zone_id}/web3/hostnames/${identifier}`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Web3 Hostname Details
*
* @example
* ```ts
* const hostname = await client.web3.hostnames.get(
* '023e105f4ecef8ad9ca31a8372d0c353',
* { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
get(identifier, params, options) {
const { zone_id } = params;
return this._client.get((0, path_1.path) `/zones/${zone_id}/web3/hostnames/${identifier}`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseHostnames._key = Object.freeze([
'web3',
'hostnames',
]);
return BaseHostnames;
})();
exports.BaseHostnames = BaseHostnames;
var Hostnames = /* @__PURE__ */ (() => {
class Hostnames extends BaseHostnames {
constructor() {
super(...arguments);
this.ipfsUniversalPaths = new IPFSUniversalPathsAPI.IPFSUniversalPaths(this._client);
}
}
Hostnames.IPFSUniversalPaths = ipfs_universal_paths_1.IPFSUniversalPaths;
Hostnames.BaseIPFSUniversalPaths = ipfs_universal_paths_1.BaseIPFSUniversalPaths;
return Hostnames;
})();
exports.Hostnames = Hostnames;
//# sourceMappingURL=hostnames.js.map