import { Logger } from 'winston'; import { IPermitConfig } from '../config'; import { ResourceAttributeCreate, ResourceAttributeRead, ResourceAttributeUpdate } from '../openapi'; import { BasePermitApi, IPagination } from './base'; export { ResourceAttributeCreate, ResourceAttributeRead, ResourceAttributeUpdate, } from '../openapi'; export interface IListAttributes extends IPagination { resourceKey: string; } /** * Interface representing the Resource Attributes API. */ export interface IResourceAttributesApi { /** * Retrieves a list of all attributes that are defined for a given resource. * @param params - pagination and filtering params, @see {@link IListAttributes} * @returns A promise that resolves to an array of ResourceAttributeRead objects representing the attributes. * @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: IListAttributes): Promise; /** * Retrieves an attribute based on the resource key and the attribute key. * * @param resourceKey - The resource key. * @param attributeKey - The attribute key. * @returns A promise that resolves to a ResourceAttributeRead object representing the attribute. * @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, attributeKey: string): Promise; /** * Retrieves an attribute based on the resource key and the attribute key. * Alias for the {@link get} method. * * @param resourceKey - The resource key. * @param attributeKey - The attribute key. * @returns A promise that resolves to a ResourceAttributeRead object representing the attribute. * @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, attributeKey: string): Promise; /** * Retrieves an attribute based on the resource ID and the attribute ID. * Alias for the {@link get} method. * * @param resourceId - The resource ID. * @param attributeId - The attribute ID. * @returns A promise that resolves to a ResourceAttributeRead object representing the attribute. * @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, attributeId: string): Promise; /** * Creates a new attribute. * * @param resourceKey - The resource key. * @param attributeData - The attribute data. * @returns A promise that resolves to a ResourceAttributeRead object representing the created attribute. * @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, attributeData: ResourceAttributeCreate): Promise; /** * Updates an existing environment. * * @param resourceKey - The resource key. * @param attributeKey - The key of the attribute to modify. * @param attributeData - The data for updating the attribute. * @returns A promise that resolves to a ResourceAttributeRead object representing the updated attribute. * @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, attributeKey: string, attributeData: ResourceAttributeUpdate): Promise; /** * Deletes a attribute based on the resource key and attribute key. * @param resourceKey - The resource key. * @param attributeKey - The attribute key. * @returns A promise that resolves when the attribute 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, attributeKey: string): Promise; } /** * API client for interacting with the Resource Attributes API. */ export declare class ResourceAttributesApi extends BasePermitApi implements IResourceAttributesApi { private attributesApi; /** * Creates an instance of the ResourceAttributesApi. * @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 attributes that are defined for a given resource. * @param params - pagination and filtering params, @see {@link IListAttributes} * @returns A promise that resolves to an array of ResourceAttributeRead objects representing the attributes. * @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: IListAttributes): Promise; /** * Retrieves an attribute based on the resource key and the attribute key. * * @param resourceKey - The resource key. * @param attributeKey - The attribute key. * @returns A promise that resolves to a ResourceAttributeRead object representing the attribute. * @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, attributeKey: string): Promise; /** * Retrieves an attribute based on the resource key and the attribute key. * Alias for the {@link get} method. * * @param resourceKey - The resource key. * @param attributeKey - The attribute key. * @returns A promise that resolves to a ResourceAttributeRead object representing the attribute. * @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, attributeKey: string): Promise; /** * Retrieves an attribute based on the resource ID and the attribute ID. * Alias for the {@link get} method. * * @param resourceId - The resource ID. * @param attributeId - The attribute ID. * @returns A promise that resolves to a ResourceAttributeRead object representing the attribute. * @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, attributeId: string): Promise; /** * Creates a new attribute. * * @param resourceKey - The resource key. * @param attributeData - The attribute data. * @returns A promise that resolves to a ResourceAttributeRead object representing the created attribute. * @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, attributeData: ResourceAttributeCreate): Promise; /** * Updates an existing attribute. * * @param resourceKey - The resource key. * @param attributeKey - The key of the attribute to modify. * @param attributeData - The data for updating the attribute. * @returns A promise that resolves to a ResourceAttributeRead object representing the updated attribute. * @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, attributeKey: string, attributeData: ResourceAttributeUpdate): Promise; /** * Deletes a attribute based on the resource key and attribute key. * @param resourceKey - The resource key. * @param attributeKey - The attribute key. * @returns A promise that resolves when the attribute 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, attributeKey: string): Promise; }