/* generated using openapi-typescript-codegen -- do not edit */ /* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ import type { ReportCreate } from '../models/ReportCreate'; import type { ReportDetail } from '../models/ReportDetail'; import type { ReportList } from '../models/ReportList'; import type { ReportRequest } from '../models/ReportRequest'; import type { CancelablePromise } from '../core/CancelablePromise'; import { OpenAPI } from '../core/OpenAPI'; import { request as __request } from '../core/request'; export class ReportsService { /** * List available reports * Return the reports available on the platform along with the latest status for each report previously requested by the caller. When ``mentor_id`` is supplied, access validation is scoped to that mentor. * @returns ReportList * @throws ApiError */ public static reportsPlatformsRetrieve({ key, mentorId, }: { key: string, /** * Mentor primary key. When provided, access validation is scoped to that mentor. */ mentorId?: number, }): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/reports/platforms/{key}/', path: { 'key': key, }, query: { 'mentor_id': mentorId, }, }); } /** * Returns details of a specific report type including its status if previously requested. * * Required RBAC Permissions: * 1. CanViewAnalytics (kill switch): * - Action: "Ibl.Analytics/CanViewAnalytics/action" * - Resource: /platforms/{platform_pk}/ * * 2. Reports access to at least one user or usergroup: * - Action: "Ibl.Analytics/Reports/read" * - Resource: /platforms/{platform_pk}/users/{user_pk}/ OR * /platforms/{platform_pk}/usergroups/{group_pk}/ * - Note: User must have access to at least one user or usergroup resource * with Reports/read permission. Unrestricted access to all users * (/platforms/{platform_pk}/users/) also satisfies this requirement. * @returns ReportDetail * @throws ApiError */ public static reportsPlatformsRetrieve2({ key, reportName, mentorUniqueId, }: { key: string, reportName: string, /** * Mentor unique ID for mentor-specific reports (e.g., ai-mentor-chat-history). When provided, ownership is validated - mentor owners can access without explicit RBAC permissions. */ mentorUniqueId?: string, }): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/reports/platforms/{key}/{report_name}', path: { 'key': key, 'report_name': reportName, }, query: { 'mentor_unique_id': mentorUniqueId, }, }); } /** * Download report * Download a completed report as CSV or JSON. Use the columns parameter to control column order. * @returns any No response body * @throws ApiError */ public static reportsPlatformsDownloadRetrieve({ key, taskId, bom, charset, columns, format = 'csv', }: { key: string, taskId: string, /** * CSV only. When true, prepend a UTF-8 byte-order mark so Excel on Windows detects UTF-8 on double-click. Applies to UTF-8 output only. Omit to use the platform default. */ bom?: boolean, /** * CSV only. Character encoding for the download (e.g. utf-8, latin-1, cp1252). Defaults to the platform setting (UTF-8). UTF-8 is lossless; other codecs replace unrepresentable characters with XML entities. */ charset?: string, /** * Comma-separated column names to control output order. Must be a subset of the report's allowed_result_fields. Omit to use the report's default order. */ columns?: string, /** * Download format */ format?: 'csv' | 'json', }): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/api/reports/platforms/{key}/{task_id}/download', path: { 'key': key, 'task_id': taskId, }, query: { 'bom': bom, 'charset': charset, 'columns': columns, 'format': format, }, }); } /** * Triggers a new report generation. * * If the report has been previously requested, it returns the status of the report. * Reports expire after a configured duration. * * The request body should include: * - report_name: Name of the report to generate * - learner_id: (optional) ID of the learner to filter by * - course_id: (optional) ID of the course to filter by * - force: (optional) Force generation of a new report even if one exists * - filters: (optional) Additional filters for the report * - departments: (optional) Department IDs to filter by * - mentor: (optional) Mentor unique_id for mentor-specific reports (e.g., ai-mentor-chat-history) * - usergroup_ids: (optional) List of usergroup IDs to filter report data * * Required RBAC Permissions: * 1. CanViewAnalytics (kill switch): * - Action: "Ibl.Analytics/CanViewAnalytics/action" * - Resource: /platforms/{platform_pk}/ * * 2. Reports access to at least one user or usergroup: * - Action: "Ibl.Analytics/Reports/read" * - Resource: /platforms/{platform_pk}/users/{user_pk}/ OR * /platforms/{platform_pk}/usergroups/{group_pk}/ * - Note: User must have access to at least one user or usergroup resource * with Reports/read permission. Unrestricted access to all users * (/platforms/{platform_pk}/users/) also satisfies this requirement. * * 3. For mentor-specific reports (e.g., ai-mentor-chat-history): * - Action: "Ibl.Analytics/Reports/read" * - Resource: /platforms/{platform_pk}/mentors/{mentor_id}/ * - Note: User must have access to at least one mentor via RBAC OR own at least * one mentor (created_by == username). If a specific mentor_unique_id is * provided, user must have access to that specific mentor. * - Raises PermissionDenied if user has no access to any mentors. * @returns ReportCreate * @throws ApiError */ public static reportsPlatformsNewCreate({ key, requestBody, }: { key: string, requestBody?: ReportRequest, }): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/reports/platforms/{key}/new', path: { 'key': key, }, body: requestBody, mediaType: 'application/json', }); } }