cloudflare-client
Version:
Universal HTTP client for Cloudflare API
23 lines (22 loc) • 639 B
JavaScript
/* SPDX-FileCopyrightText: 2022-present Kriasoft */
/* SPDX-License-Identifier: MIT */
import { baseUrl, createFetch, HttpMethod } from "./fetch.js";
// #endregion
/**
* The currently logged in / authenticated User
* @see https://api.cloudflare.com/#user-properties
*/
export function user(credentials) {
const url = `${baseUrl}/user`;
return {
/**
* The currently logged in/authenticated user
* @see https://api.cloudflare.com/#user-properties
*/
get: createFetch(() => ({
method: HttpMethod.GET,
url,
credentials,
})).response(),
};
}