import { z } from 'zod';
import { APIResponseSchema } from "../api.js";
import { APIKeyResponseError } from "./util.js";
export const APIKeyCreateResponseSchema = z.object({
    id: z.string().describe('the API key id'),
    value: z.string().describe('the API key value'),
});
export const APIKeyCreateFullResponseSchema = APIResponseSchema(APIKeyCreateResponseSchema);
export const APIKeyCreateRequestSchema = z.object({
    name: z.string().describe('Name of the API key'),
    expiresAt: z.string().describe('Expiration timestamp for the API key'),
    projectId: z.string().nullable().optional().describe('Optional project scope for the key'),
    orgId: z.string().nullable().optional().describe('Optional organization scope for the key'),
});
/**
 * Create a new API key
 *
 * @param client
 * @param request the API key creation request
 * @returns
 */
export async function apikeyCreate(client, request) {
    const resp = await client.post('/cli/apikey', request, APIKeyCreateFullResponseSchema, APIKeyCreateRequestSchema);
    if (resp.success) {
        return resp.data;
    }
    throw new APIKeyResponseError({ message: resp.message });
}
//# sourceMappingURL=create.js.map