import { Logger } from 'winston'; import { IPermitConfig } from '../config'; import { ResourceActionCreate, ResourceActionRead, ResourceActionUpdate } from '../openapi'; import { BasePermitApi, IPagination } from './base'; export { ResourceActionCreate, ResourceActionRead, ResourceActionUpdate } from '../openapi'; export interface IListActions extends IPagination { resourceKey: string; } /** * Interface representing the Resource Actions API. */ export interface IResourceActionsApi { /** * Retrieves a list of all actions that are defined for a given resource. * @param params - pagination and filtering params, @see {@link IListActions} * @returns A promise that resolves to an array of ResourceActionRead objects representing the actions. * @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(params: IListActions): Promise; /** * Retrieves an action based on the resource key and the action key. * * @param resourceKey - The resource key. * @param actionKey - The action key. * @returns A promise that resolves to a ResourceActionRead object representing the action. * @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(resourceKey: string, actionKey: string): Promise; /** * Retrieves an action based on the resource key and the action key. * Alias for the {@link get} method. * * @param resourceKey - The resource key. * @param actionKey - The action key. * @returns A promise that resolves to a ResourceActionRead object representing the action. * @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(resourceKey: string, actionKey: string): Promise; /** * Retrieves an action based on the resource ID and the action ID. * Alias for the {@link get} method. * * @param resourceId - The resource ID. * @param actionId - The action ID. * @returns A promise that resolves to a ResourceActionRead object representing the action. * @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(resourceId: string, actionId: string): Promise; /** * Creates a new action. * * @param resourceKey - The resource key. * @param actionData - The action data. * @returns A promise that resolves to a ResourceActionRead object representing the created action. * @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(resourceKey: string, actionData: ResourceActionCreate): Promise; /** * Updates an existing environment. * * @param resourceKey - The resource key. * @param actionKey - The key of the action to modify. * @param actionData - The data for updating the action. * @returns A promise that resolves to a ResourceActionRead object representing the updated action. * @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(resourceKey: string, actionKey: string, actionData: ResourceActionUpdate): Promise; /** * Deletes a action based on the resource key and action key. * @param resourceKey - The resource key. * @param actionKey - The action key. * @returns A promise that resolves when the action is successfully 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(resourceKey: string, actionKey: string): Promise; } /** * API client for interacting with the Resource Actions API. */ export declare class ResourceActionsApi extends BasePermitApi implements IResourceActionsApi { private actionsApi; /** * Creates an instance of the ResourceActionsApi. * @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 all actions that are defined for a given resource. * @param params - pagination and filtering params, @see {@link IListActions} * @returns A promise that resolves to an array of ResourceActionRead objects representing the actions. * @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(params: IListActions): Promise; /** * Retrieves an action based on the resource key and the action key. * * @param resourceKey - The resource key. * @param actionKey - The action key. * @returns A promise that resolves to a ResourceActionRead object representing the action. * @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(resourceKey: string, actionKey: string): Promise; /** * Retrieves an action based on the resource key and the action key. * Alias for the {@link get} method. * * @param resourceKey - The resource key. * @param actionKey - The action key. * @returns A promise that resolves to a ResourceActionRead object representing the action. * @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(resourceKey: string, actionKey: string): Promise; /** * Retrieves an action based on the resource ID and the action ID. * Alias for the {@link get} method. * * @param resourceId - The resource ID. * @param actionId - The action ID. * @returns A promise that resolves to a ResourceActionRead object representing the action. * @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(resourceId: string, actionId: string): Promise; /** * Creates a new action. * * @param resourceKey - The resource key. * @param actionData - The action data. * @returns A promise that resolves to a ResourceActionRead object representing the created action. * @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(resourceKey: string, actionData: ResourceActionCreate): Promise; /** * Updates an existing action. * * @param resourceKey - The resource key. * @param actionKey - The key of the action to modify. * @param actionData - The data for updating the action. * @returns A promise that resolves to a ResourceActionRead object representing the updated action. * @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(resourceKey: string, actionKey: string, actionData: ResourceActionUpdate): Promise; /** * Deletes a action based on the resource key and action key. * @param resourceKey - The resource key. * @param actionKey - The action key. * @returns A promise that resolves when the action is successfully 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(resourceKey: string, actionKey: string): Promise; }