import { Logger } from 'winston'; import { IPermitConfig } from '../config'; import { ResourceInstanceCreate, ResourceInstanceRead, ResourceInstanceUpdate } from '../openapi'; import { BasePermitApi, IPagination } from './base'; export { ResourceInstanceCreate, ResourceInstanceRead, ResourceInstanceUpdate } from '../openapi'; export interface IListResourceInstanceUsers extends IPagination { instanceKey: string; } export interface IResourceInstancesApi { /** * Retrieves a list of resource instances. * * @param pagination The pagination options, @see {@link IPagination} * @returns A promise that resolves to an array of resource instances. * @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 instance by its key. * * @param instanceKey The key of the resource instance. * @returns A promise that resolves to the resource instance. * @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(instanceKey: string): Promise; /** * Retrieves a instance by its key. * Alias for the {@link get} method. * * @param instanceKey The key of the resource instance. * @returns A promise that resolves to the resource instance. * @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(instanceKey: string): Promise; /** * Retrieves a resource instance by its ID. * Alias for the {@link get} method. * * @param instanceId The ID of the resource instance. * @returns A promise that resolves to the resource instance. * @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(instanceId: string): Promise; /** * Creates a new instance. * * @param instanceData The data for the new resource instance. * @returns A promise that resolves to the created resource instance. * @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(instanceData: ResourceInstanceCreate): Promise; /** * Updates a instance. * * @param instanceKey The key of the resource instance. * @param instanceData The updated data for the resource instance. * @returns A promise that resolves to the updated resource instance. * @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(instanceKey: string, instanceData: ResourceInstanceUpdate): Promise; /** * Deletes a instance. * * @param instanceKey The key of the resource instance to delete. * @returns A promise that resolves when the resource instance 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(instanceKey: string): Promise; } /** * The ResourceInstancesApi class provides methods for interacting with Permit ResourceInstances. */ export declare class ResourceInstancesApi extends BasePermitApi implements IResourceInstancesApi { private instances; /** * Creates an instance of the ResourceInstancesApi. * @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 resource instances. * * @param pagination The pagination options, @see {@link IPagination} * @returns A promise that resolves to an array of resource instances. * @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 instance by its key. * * @param instanceKey The key of the resource instance. * @returns A promise that resolves to the resource instance. * @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(instanceKey: string): Promise; /** * Retrieves a instance by its key. * Alias for the {@link get} method. * * @param instanceKey The key of the resource instance. * @returns A promise that resolves to the resource instance. * @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(instanceKey: string): Promise; /** * Retrieves a instance by its ID. * Alias for the {@link get} method. * * @param instanceId The ID of the resource instance. * @returns A promise that resolves to the resource instance. * @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(instanceId: string): Promise; /** * Creates a new instance. * * @param instanceData The data for the new instance. * @returns A promise that resolves to the created instance. * @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(instanceData: ResourceInstanceCreate): Promise; /** * Updates a instance. * * @param instanceKey The key of the resource instance. * @param instanceData The updated data for the resource instance. * @returns A promise that resolves to the updated instance. * @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(instanceKey: string, instanceData: ResourceInstanceUpdate): Promise; /** * Deletes a instance. * * @param instanceKey The key of the resource instance to delete. * @returns A promise that resolves when the resource instance 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(instanceKey: string): Promise; }