import type { RawAxiosRequestHeaders } from 'axios'; import type { CollectionProp, GetOrganizationParams, GetSpaceParams, QueryParams } from '../../common-types'; import type { OptionalDefaults } from '../wrappers/wrap'; import type { CreateRoleProps, RoleProps } from '../../entities/role'; export type RolePlainClientAPI = { /** Fetches a Role * * @param params Space ID and Role ID * @returns the Role * @throws if the request fails, or the Role is not found * @example * ```javascript * const role = await client.role.get({ * spaceId: '', * roleId: '', * }); * ``` */ get(params: OptionalDefaults): Promise; /** Fetches all Roles for the given Space * * @param params Space ID and optional query parameters * @returns All the Roles for the given Space * @throws if the request fails, or the Space is not found * @example * ```javascript * const results = await client.role.getMany({ * spaceId: '', * query: { * limit: 100, * } * }); * ``` */ getMany(params: OptionalDefaults): Promise>; /** Fetches all Roles for the given Organization * * @param params Organization ID and optional query parameters * @returns All the Roles for the given Organization * @throws if the request fails, or the Organization is not found * @example * ```javascript * const results = await client.role.getManyForOrganization({ * organizationId: '', * query: { * limit: 100, * } * }); * ``` */ getManyForOrganization(params: OptionalDefaults): Promise>; /** Creates a Role * * @param params Space ID and the Role to create * @returns the created Role * @throws if the request fails, the Space is not found, or the payload is malformed * @example * ```javascript * const role = await client.role.create( * { * spaceId: '', * }, * { * name: 'My role', * description: 'My role description', * permissions: { * ContentModel: [ * 'read' * ], * ContentDelivery: 'all', * Environments: 'all', * EnvironmentAliases: 'all', * Settings: 'all' * }, * policies: [ * { * effect: 'allow', * actions: [ * 'read', * 'create', * 'update', * 'delete', * 'publish', * 'unpublish', * 'archive', * 'unarchive' * ], * constraint: { * and: [ * [ * 'equals', * { * doc: 'sys.type' * }, * 'Entry' * ] * ] * } * } * ] * }); * ``` */ create(params: OptionalDefaults, data: CreateRoleProps, headers?: RawAxiosRequestHeaders): Promise; /** Creates a Role with a given ID * * @param params Space ID, Role ID, and the Role to create * @returns the created Role * @throws if the request fails, the Space is not found, or the payload is malformed * @example * ```javascript * const role = await client.role.create( * { * spaceId: '', * roleId: '', * }, * { * name: 'My role', * description: 'My role description', * permissions: { * ContentModel: [ * 'read' * ], * ContentDelivery: 'all', * Environments: 'all', * EnvironmentAliases: 'all', * Settings: 'all' * }, * policies: [ * { * effect: 'allow', * actions: [ * 'read', * 'create', * 'update', * 'delete', * 'publish', * 'unpublish', * 'archive', * 'unarchive' * ], * constraint: { * and: [ * [ * 'equals', * { * doc: 'sys.type' * }, * 'Entry' * ] * ] * } * } * ] * }); * ``` */ createWithId(params: OptionalDefaults, data: CreateRoleProps, headers?: RawAxiosRequestHeaders): Promise; /** Updates a Role * * @param params Space ID and Role ID * @param rawData the Role update * @returns the updated Role * @throws if the request fails, the Role is not found, or the payload is malformed * @example * ```javascript * let role = await client.role.get({ * spaceId: '', * roleId: '', * }); * * role = await client.role.update( * { * spaceId: '', * roleId: '', * }, * { * ...role, * name: 'My updated role name', * } * ); * ``` */ update(params: OptionalDefaults, rawData: RoleProps, headers?: RawAxiosRequestHeaders): Promise; /** Deletes a Role * * @param params Space ID and Role ID * @throws if the request fails, or the Role is not found * @example * ```javascript * await client.role.delete({ * spaceId: '', * roleId: '', * }); * ``` */ delete(params: OptionalDefaults): Promise; };