// This file is auto-generated by @hey-api/openapi-ts

import type { Client, ClientMeta, Options as Options2, RequestResult, TDataShape } from './client';
import { client } from './client.gen';
import type { CreateTokenAllAdminsData, CreateTokenAllAdminsErrors, CreateTokenAllAdminsResponses, CreateTokenCliData, CreateTokenCliErrors, CreateTokenCliResponses, CreateTokenData, CreateTokenErrors, CreateTokenResponses, LoginAllAdminsData, LoginAllAdminsErrors } from './types.gen';

export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown> = Options2<TData, ThrowOnError, TResponse> & {
    /**
     * You can provide a client instance returned by `createClient()` instead of
     * individual options. This might be also useful if you want to implement a
     * custom client.
     */
    client?: Client;
    /**
     * You can pass arbitrary values through the `meta` object. This can be
     * used to access values that aren't defined as part of the SDK function.
     */
    meta?: keyof ClientMeta extends never ? Record<string, unknown> : ClientMeta;
};

/**
 * Create Token All Admins
 *
 * Create a token with no credentials only if ``simple_auth_manager_all_admins`` is True.
 */
export const createTokenAllAdmins = <ThrowOnError extends boolean = false>(options?: Options<CreateTokenAllAdminsData, ThrowOnError>): RequestResult<CreateTokenAllAdminsResponses, CreateTokenAllAdminsErrors, ThrowOnError> => (options?.client ?? client).get<CreateTokenAllAdminsResponses, CreateTokenAllAdminsErrors, ThrowOnError>({
    responseType: 'json',
    url: '/auth/token',
    ...options
});

/**
 * Create Token
 *
 * Authenticate the user.
 */
export const createToken = <ThrowOnError extends boolean = false>(options: Options<CreateTokenData, ThrowOnError>): RequestResult<CreateTokenResponses, CreateTokenErrors, ThrowOnError> => (options.client ?? client).post<CreateTokenResponses, CreateTokenErrors, ThrowOnError>({
    responseType: 'json',
    url: '/auth/token',
    ...options,
    headers: {
        'Content-Type': 'application/json',
        ...options.headers
    }
});

/**
 * Login All Admins
 *
 * Login the user with no credentials.
 */
export const loginAllAdmins = <ThrowOnError extends boolean = false>(options?: Options<LoginAllAdminsData, ThrowOnError>): RequestResult<unknown, LoginAllAdminsErrors, ThrowOnError> => (options?.client ?? client).get<unknown, LoginAllAdminsErrors, ThrowOnError>({ url: '/auth/token/login', ...options });

/**
 * Create Token Cli
 *
 * Authenticate the user for the CLI.
 */
export const createTokenCli = <ThrowOnError extends boolean = false>(options: Options<CreateTokenCliData, ThrowOnError>): RequestResult<CreateTokenCliResponses, CreateTokenCliErrors, ThrowOnError> => (options.client ?? client).post<CreateTokenCliResponses, CreateTokenCliErrors, ThrowOnError>({
    responseType: 'json',
    url: '/auth/token/cli',
    ...options,
    headers: {
        'Content-Type': 'application/json',
        ...options.headers
    }
});
