import { BaseApi } from "../base-api"; import type { ApiRecords, ApiRecordsV2, PagePagination } from "../types"; import type { AccessRule, AccessRuleMapping, AccessRuleMetadata, AccessRuleV2, CreateAccessRuleV2Request, OwnedAccessRule, SharedAccessRule, UpdateAccessRuleV2Request } from "./types"; /** * Represents the parameters used to retrieve access rules. * This interface extends a generic record allowing for a range of value types including arrays. * It's primarily used to filter access rules. * * @interface GetAccessRulesParameters * @extends {Record} * * @property {boolean} [owned_only] - Optional filter to retrieve only the access rules owned by the user. * Setting this to true will fetch only the access rules that are owned. * * @property {boolean} [shared_only] - Optional filter to retrieve only the access rules shared with the user. * Setting this to true will fetch only the access rules that are shared. * * @property {string | string[]} [tag] - Optional filter to retrieve access rules tagged with a specific tag or tags. * Provide a single tag or an array of tags to fetch access rules associated with them. * * @property {number | number[]} [company_id] - Optional filter to retrieve access rules associated with a specific company or companies. * Provide a company ID or an array of IDs to fetch access rules related to those companies. * * @property {number | number[]} [dataset_id] - Optional filter to retrieve access rules associated with a specific dataset or datasets. * Provide a dataset ID or an array of IDs to fetch access rules related to those datasets. */ interface GetAccessRulesParameters extends Record { owned_only?: boolean; shared_only?: boolean; tag?: string | string[]; company_id?: number | number[]; dataset_id?: number | number[]; } /** * @module AccessRulesApi * @description This module provides methods for working with access rules. * @extends BaseApi */ declare class AccessRulesApi extends BaseApi { /** * Retrieves all the access rules. * * @returns {Promise>} A promise that resolves to an object containing access rules. * @example * @deprecated This method is deprecated. Use getAccessableAccessRules() instead. * const api = new AccessRulesApi(); * api.getAccessRules().then(rules => { * console.log(rules); * }); */ getAccessRules(datasetId?: number): Promise>; /** * Deletes an access rule by ID. * * @param {number} id - The ID of the access rule to be deleted. * @returns {Promise} A promise that resolves once the deletion is successful. */ deleteAccessRule(id: number): Promise; /** * Creates a new access rule. * * @param {Omit} rule - The access rule data. * @returns {Promise} A promise that resolves to the created access rule. */ createAccessRule(rule: Omit): Promise; /** * Updates an existing access rule by ID. * * @param {number} id - The ID of the access rule to be updated. * @param {Partial>} rule - The updated access rule data. * @returns {Promise} A promise that resolves to the updated access rule. */ updateAccessRule(id: number, rule: Partial>): Promise; /** * Retrieves a specific access rule by its ID. * * @public * @async * @param {number} id - The unique identifier of the access rule to retrieve. * @returns {Promise} A promise that resolves to an AccessRuleV2 object. * @description This method fetches a single access rule based on the provided ID. It returns a promise * that resolves to the detailed information of the access rule. */ getAccessRule(id: number): Promise; /** * Retrieves a specific access rule by the company slug and access rule name. * * @public * @async * @param {string} companySlug - The slug of the company that owns the access rule. * @param {string} accessRuleName - The name of the access rule to retrieve. * @returns {Promise} A promise that resolves to an AccessRuleV2 object. * @description This method fetches a single access rule based on the company slug and the access rule's name. * It's particularly useful when access rule IDs are not known or used. */ getAccessRuleByName(companySlug: string, accessRuleName: string): Promise; /** * Retrieves a list of access rules that a user has access to, based on the provided parameters. * * @public * @async * @param {GetAccessRulesParameters} parameters - Parameters to filter and paginate the list of access rules. * @returns {Promise>} A promise that resolves to a collection of AccessRuleV2 objects. * @description This method fetches access rules based on the specified filters and pagination options provided in the parameters. * It returns a promise that resolves to a list of access rules that match the criteria. */ getAccessableAccessRules(parameters: GetAccessRulesParameters & PagePagination): Promise>; /** * Creates a new access rule (version 2). * * @public * @async * @param {CreateAccessRuleV2Request} request - The request data for creating a new access rule. * @returns {Promise} A promise that resolves to the newly created AccessRuleV2 object. * @description This method allows for creating a new access rule in version 2, using the specified request data. * It returns a promise that resolves to the created access rule details. */ createAccessRuleV2(request: CreateAccessRuleV2Request): Promise; /** * Updates an existing access rule by ID (version 2). * * @public * @async * @param {number} accessRuleId - The unique identifier of the access rule to update. * @param {UpdateAccessRuleV2Request} request - The request data containing updates for the access rule. * @returns {Promise} A promise that resolves to the updated AccessRuleV2 object. * @description This method updates an existing access rule in version 2 based on the provided access rule ID * and request data. It returns a promise that resolves to the updated access rule details. */ updateAccessRuleV2(accessRuleId: number, request: UpdateAccessRuleV2Request): Promise; } export { type AccessRule, type AccessRuleMapping, type AccessRuleMetadata, AccessRulesApi, type AccessRuleV2, type CreateAccessRuleV2Request, type GetAccessRulesParameters, type OwnedAccessRule, type SharedAccessRule, type UpdateAccessRuleV2Request, };