import { Logger } from 'winston'; import { IPermitConfig } from '../config'; import { ProjectCreate, ProjectRead, ProjectUpdate } from '../openapi'; import { BasePermitApi, IPagination } from './base'; export { ProjectCreate, ProjectRead, ProjectUpdate } from '../openapi'; export interface IProjectsApi { /** * Retrieves a list of projects. * * @param pagination The pagination options, @see {@link IPagination} * @returns A promise that resolves to an array of projects. * @throws {@link PermitApiError} If the API returns an error HTTP status code. * @throws {@link PermitContextError} If the configured {@link ApiContext} does not match the required endpoint context. */ list(pagination?: IPagination): Promise; /** * Retrieves a project by its key. * * @param projectKey The key of the project. * @returns A promise that resolves to the project. * @throws {@link PermitApiError} If the API returns an error HTTP status code. * @throws {@link PermitContextError} If the configured {@link ApiContext} does not match the required endpoint context. */ get(projectKey: string): Promise; /** * Retrieves a project by its key. * Alias for the {@link get} method. * * @param projectKey The key of the project. * @returns A promise that resolves to the project. * @throws {@link PermitApiError} If the API returns an error HTTP status code. * @throws {@link PermitContextError} If the configured {@link ApiContext} does not match the required endpoint context. */ getByKey(projectKey: string): Promise; /** * Retrieves a project by its ID. * Alias for the {@link get} method. * * @param projectId The ID of the project. * @returns A promise that resolves to the project. * @throws {@link PermitApiError} If the API returns an error HTTP status code. * @throws {@link PermitContextError} If the configured {@link ApiContext} does not match the required endpoint context. */ getById(projectId: string): Promise; /** * Creates a new project. * * @param projectData The data for the new project. * @returns A promise that resolves to the created project. * @throws {@link PermitApiError} If the API returns an error HTTP status code. * @throws {@link PermitContextError} If the configured {@link ApiContext} does not match the required endpoint context. */ create(projectData: ProjectCreate): Promise; /** * Updates a project. * * @param projectKey The key of the project. * @param projectData The updated data for the project. * @returns A promise that resolves to the updated project. * @throws {@link PermitApiError} If the API returns an error HTTP status code. * @throws {@link PermitContextError} If the configured {@link ApiContext} does not match the required endpoint context. */ update(projectKey: string, projectData: ProjectUpdate): Promise; /** * Deletes a project. * * @param projectKey The key of the project to delete. * @returns A promise that resolves when the project is deleted. * @throws {@link PermitApiError} If the API returns an error HTTP status code. * @throws {@link PermitContextError} If the configured {@link ApiContext} does not match the required endpoint context. */ delete(projectKey: string): Promise; } /** * The ProjectsApi class provides methods for interacting with Permit Projects. */ export declare class ProjectsApi extends BasePermitApi implements IProjectsApi { private projects; /** * Creates an instance of the ProjectsApi. * @param config - The configuration object for the Permit SDK. * @param logger - The logger instance for logging. */ constructor(config: IPermitConfig, logger: Logger); /** * Retrieves a list of projects. * * @param pagination The pagination options, @see {@link IPagination} * @returns A promise that resolves to an array of projects. * @throws {@link PermitApiError} If the API returns an error HTTP status code. * @throws {@link PermitContextError} If the configured {@link ApiContext} does not match the required endpoint context. */ list(pagination?: IPagination): Promise; /** * Retrieves a project by its key. * * @param projectKey The key of the project. * @returns A promise that resolves to the project. * @throws {@link PermitApiError} If the API returns an error HTTP status code. * @throws {@link PermitContextError} If the configured {@link ApiContext} does not match the required endpoint context. */ get(projectKey: string): Promise; /** * Retrieves a project by its key. * Alias for the {@link get} method. * * @param projectKey The key of the project. * @returns A promise that resolves to the project. * @throws {@link PermitApiError} If the API returns an error HTTP status code. * @throws {@link PermitContextError} If the configured {@link ApiContext} does not match the required endpoint context. */ getByKey(projectKey: string): Promise; /** * Retrieves a project by its ID. * Alias for the {@link get} method. * * @param projectId The ID of the project. * @returns A promise that resolves to the project. * @throws {@link PermitApiError} If the API returns an error HTTP status code. * @throws {@link PermitContextError} If the configured {@link ApiContext} does not match the required endpoint context. */ getById(projectId: string): Promise; /** * Creates a new project. * * @param projectData The data for the new project. * @returns A promise that resolves to the created project. * @throws {@link PermitApiError} If the API returns an error HTTP status code. * @throws {@link PermitContextError} If the configured {@link ApiContext} does not match the required endpoint context. */ create(projectData: ProjectCreate): Promise; /** * Updates a project. * * @param projectKey The key of the project. * @param projectData The updated data for the project. * @returns A promise that resolves to the updated project. * @throws {@link PermitApiError} If the API returns an error HTTP status code. * @throws {@link PermitContextError} If the configured {@link ApiContext} does not match the required endpoint context. */ update(projectKey: string, projectData: ProjectUpdate): Promise; /** * Deletes a project. * * @param projectKey The key of the project to delete. * @returns A promise that resolves when the project is deleted. * @throws {@link PermitApiError} If the API returns an error HTTP status code. * @throws {@link PermitContextError} If the configured {@link ApiContext} does not match the required endpoint context. */ delete(projectKey: string): Promise; }