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 free_credits_exports = {};
__export(free_credits_exports, {
  buildFreeCreditsApiClientMethods: () => buildFreeCreditsApiClientMethods
});
module.exports = __toCommonJS(free_credits_exports);
function buildFreeCreditsApiClientMethods(input) {
  const { request, handleApiError } = input;
  return {
    async fetchPublicFreeCredits() {
      const response = await request({
        method: "GET",
        path: "/free-credits/public"
      });
      if (response.status !== 200) {
        handleApiError(response, "fetch_public_free_credits");
      }
      return response.body;
    },
    async fetchFreeCredits() {
      const response = await request({
        method: "GET",
        path: "/free-credits"
      });
      if (response.status !== 200) {
        handleApiError(response, "fetch_free_credits");
      }
      return response.body;
    },
    async claimFreeCreditReward(rewardId) {
      const response = await request({
        method: "POST",
        path: `/free-credits/rewards/${encodeURIComponent(String(rewardId))}/claim`
      });
      if (response.status !== 200) {
        handleApiError(response, "claim_free_credit_reward");
      }
      return response.body;
    },
    async fetchInvitePreview(inviteCode) {
      const response = await request({
        method: "GET",
        path: `/invite/${encodeURIComponent(inviteCode)}/preview`
      });
      if (response.status !== 200) {
        handleApiError(response, "fetch_invite_preview");
      }
      return response.body;
    },
    async fetchMyInviteCode() {
      const response = await request({
        method: "GET",
        path: "/me/invite-code"
      });
      if (response.status !== 200) {
        handleApiError(response, "fetch_my_invite_code");
      }
      return response.body;
    },
    async submitMyInviteCode(inviteCode) {
      const response = await request({
        method: "POST",
        path: "/me/invite-code",
        body: { inviteCode }
      });
      if (response.status !== 200) {
        handleApiError(response, "submit_my_invite_code");
      }
      return response.body;
    }
  };
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  buildFreeCreditsApiClientMethods
});
