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 auth_exports = {};
__export(auth_exports, {
  buildAuthApiClientMethods: () => buildAuthApiClientMethods
});
module.exports = __toCommonJS(auth_exports);
function buildAuthApiClientMethods(input) {
  const { request, handleApiError } = input;
  return {
    async login(loginRequest) {
      const response = await request({
        method: "POST",
        path: "/auth/login",
        body: loginRequest
      });
      if (response.status !== 200) {
        handleApiError(response, "login");
      }
      return response.body;
    },
    async loginWithApiKey(loginRequest) {
      const response = await request({
        method: "POST",
        path: "/auth/api-key/login",
        body: loginRequest
      });
      if (response.status !== 200) {
        handleApiError(response, "login_with_api_key");
      }
      return response.body;
    },
    async startCliLogin() {
      const response = await request({
        method: "POST",
        path: "/auth/cli/start"
      });
      if (response.status !== 200) {
        handleApiError(response, "start_cli_login");
      }
      return response.body;
    },
    async pollCliLogin(pollRequest) {
      const response = await request({
        method: "POST",
        path: "/auth/cli/poll",
        body: pollRequest
      });
      if (response.status !== 200 && response.status !== 202) {
        handleApiError(response, "poll_cli_login");
      }
      return response.body;
    },
    async fetchCliLoginStatus(requestId) {
      const response = await request({
        method: "GET",
        path: `/auth/cli/status/${encodeURIComponent(requestId)}`
      });
      if (response.status !== 200 && response.status !== 410) {
        handleApiError(response, "fetch_cli_login_status");
      }
      return response.body;
    },
    async approveCliLogin(approveRequest) {
      const response = await request({
        method: "POST",
        path: "/auth/cli/approve",
        body: approveRequest
      });
      if (response.status !== 200) {
        handleApiError(response, "approve_cli_login");
      }
      return response.body;
    },
    async startCliWebLaunch(startRequest) {
      const response = await request({
        method: "POST",
        path: "/auth/cli/web-launch",
        body: startRequest
      });
      if (response.status !== 200) {
        handleApiError(response, "start_cli_web_launch");
      }
      return response.body;
    },
    async register(registerRequest) {
      const response = await request({
        method: "POST",
        path: "/auth/register",
        body: registerRequest
      });
      if (response.status !== 201) {
        handleApiError(response, "register");
      }
      return response.body;
    },
    async fetchStarterProfileAssets() {
      const response = await request({
        method: "GET",
        path: "/auth/starter-profile-assets"
      });
      if (response.status !== 200) {
        handleApiError(response, "fetch_starter_profile_assets");
      }
      return response.body;
    },
    async logout() {
      const response = await request({
        method: "POST",
        path: "/auth/logout"
      });
      if (response.status !== 200) {
        handleApiError(response, "logout");
      }
      return response.body;
    },
    async unlinkX() {
      const response = await request({
        method: "POST",
        path: "/auth/x/unlink"
      });
      if (response.status !== 200) {
        handleApiError(response, "unlink_x");
      }
      return response.body;
    },
    async unlinkGoogle() {
      const response = await request({
        method: "POST",
        path: "/auth/google/unlink"
      });
      if (response.status !== 200) {
        handleApiError(response, "unlink_google");
      }
      return response.body;
    },
    async createAppleOAuthLinkStart(startRequest) {
      const response = await request({
        method: "POST",
        path: "/auth/oauth/apple-link-start",
        body: startRequest
      });
      if (response.status !== 200) {
        handleApiError(response, "create_apple_oauth_link_start");
      }
      return response.body;
    },
    async createAppleNativeChallenge() {
      const response = await request({
        method: "POST",
        path: "/auth/apple/native/challenge"
      });
      if (response.status !== 200) {
        handleApiError(response, "create_apple_native_challenge");
      }
      return response.body;
    },
    async exchangeAppleOAuthHandoff(exchangeRequest) {
      const response = await request({
        method: "POST",
        path: "/auth/oauth/apple-handoff-exchange",
        body: exchangeRequest
      });
      if (response.status !== 200) {
        handleApiError(response, "exchange_apple_oauth_handoff");
      }
      return response.body;
    },
    async signInWithApple(signInRequest) {
      const response = await request({
        method: "POST",
        path: "/auth/apple/sign-in",
        body: signInRequest
      });
      if (response.status !== 200) {
        handleApiError(response, "sign_in_with_apple");
      }
      return response.body;
    },
    async linkApple(linkRequest) {
      const response = await request({
        method: "POST",
        path: "/auth/apple/link",
        body: linkRequest
      });
      if (response.status !== 200) {
        handleApiError(response, "link_apple");
      }
      return response.body;
    },
    async signInWithGoogleApple(signInRequest) {
      const response = await request({
        method: "POST",
        path: "/auth/google/apple/sign-in",
        body: signInRequest
      });
      if (response.status !== 200) {
        handleApiError(response, "sign_in_with_google_apple");
      }
      return response.body;
    },
    async linkGoogleApple(linkRequest) {
      const response = await request({
        method: "POST",
        path: "/auth/google/apple/link",
        body: linkRequest
      });
      if (response.status !== 200) {
        handleApiError(response, "link_google_apple");
      }
      return response.body;
    },
    async unlinkApple() {
      const response = await request({
        method: "POST",
        path: "/auth/apple/unlink"
      });
      if (response.status !== 200) {
        handleApiError(response, "unlink_apple");
      }
      return response.body;
    },
    async fetchGooglePendingSignup(token) {
      const response = await request({
        method: "GET",
        path: `/auth/google/pending/${encodeURIComponent(token)}`
      });
      if (response.status !== 200) {
        handleApiError(response, "fetch_google_pending_signup");
      }
      return response.body;
    },
    async checkUsernameAvailable(username) {
      const response = await request({
        method: "GET",
        path: `/auth/username-available/${encodeURIComponent(username)}`
      });
      if (response.status !== 200) {
        handleApiError(response, "check_username_available");
      }
      return response.body;
    },
    async completeGoogleSignup(signupRequest) {
      const response = await request({
        method: "POST",
        path: "/auth/google/complete-signup",
        body: signupRequest
      });
      if (response.status !== 201) {
        handleApiError(response, "complete_google_signup");
      }
      return response.body;
    },
    async fetchXPendingSignup(token) {
      const response = await request({
        method: "GET",
        path: `/auth/x/pending/${encodeURIComponent(token)}`
      });
      if (response.status !== 200) {
        handleApiError(response, "fetch_x_pending_signup");
      }
      return response.body;
    },
    async fetchApplePendingSignup(token) {
      const response = await request({
        method: "GET",
        path: `/auth/apple/pending/${encodeURIComponent(token)}`
      });
      if (response.status !== 200) {
        handleApiError(response, "fetch_apple_pending_signup");
      }
      return response.body;
    },
    async completeXSignup(signupRequest) {
      const response = await request({
        method: "POST",
        path: "/auth/x/complete-signup",
        body: signupRequest
      });
      if (response.status !== 201) {
        handleApiError(response, "complete_x_signup");
      }
      return response.body;
    },
    async completeAppleSignup(signupRequest) {
      const response = await request({
        method: "POST",
        path: "/auth/apple/complete-signup",
        body: signupRequest
      });
      if (response.status !== 201) {
        handleApiError(response, "complete_apple_signup");
      }
      return response.body;
    },
    async exchangeGoogleOneTapCredential(oneTapRequest) {
      const response = await request({
        method: "POST",
        path: "/auth/google/one-tap",
        body: oneTapRequest
      });
      if (response.status !== 200) {
        handleApiError(response, "exchange_google_one_tap_credential");
      }
      return response.body;
    },
    async fetchCliApiKeyStatus() {
      const response = await request({
        method: "GET",
        path: "/me/api-key"
      });
      if (response.status !== 200) {
        handleApiError(response, "fetch_cli_api_key_status");
      }
      return response.body;
    },
    async createCliApiKey() {
      const response = await request({
        method: "POST",
        path: "/me/api-key"
      });
      if (response.status !== 200) {
        handleApiError(response, "create_cli_api_key");
      }
      return response.body;
    }
  };
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  buildAuthApiClientMethods
});
