var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var me_exports = {};
__export(me_exports, {
  buildMeApiClientMethods: () => buildMeApiClientMethods
});
module.exports = __toCommonJS(me_exports);
function buildMeApiClientMethods(input) {
  const { request, handleApiError } = input;
  return {
    async fetchMyApps(options = {}) {
      const params = new URLSearchParams();
      if (typeof options.limit === "number" && Number.isFinite(options.limit)) {
        params.set("limit", String(options.limit));
      }
      if (typeof options.offset === "number" && Number.isFinite(options.offset)) {
        params.set("offset", String(options.offset));
      }
      if (typeof options.type === "string" && options.type.trim().length > 0) {
        params.set("type", options.type.trim());
      }
      const query = params.toString();
      const response = await request({
        method: "GET",
        path: "/me/apps" + (query ? `?${query}` : "")
      });
      if (response.status !== 200) {
        handleApiError(response, "fetch_my_apps");
      }
      return response.body;
    },
    async fetchBootstrap() {
      const response = await request({
        method: "GET",
        path: "/me/bootstrap"
      });
      if (response.status !== 200) {
        handleApiError(response, "fetch_bootstrap");
      }
      return response.body;
    },
    async fetchTemplateScaffold(namespace, slug) {
      const response = await request({
        method: "GET",
        path: `/me/templates/${encodeURIComponent(namespace)}/${encodeURIComponent(slug)}`
      });
      if (response.status !== 200) {
        handleApiError(response, "fetch_template_scaffold");
      }
      return response.body;
    }
  };
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  buildMeApiClientMethods
});
