import type { BaseLogger } from 'pino'; import type { LTISession } from '../interfaces/ltiSession.js'; import type { LTIStorage } from '../interfaces/ltiStorage.js'; import type { CreateLineItem, UpdateLineItem } from '../schemas/lti13/ags/lineItem.schema.js'; import type { ScoreSubmission } from '../schemas/lti13/ags/scoreSubmission.schema.js'; import type { TokenService } from './token.service.js'; export interface AGSLineItemTargetOptions { /** Optional line item URL to read instead of the launch session's default line item. */ lineItemUrl?: string; } export interface AGSGetScoresOptions extends AGSLineItemTargetOptions { /** Optional AGS user_id filter for fetching a single user's result. */ userId?: string; /** Optional maximum number of results to request. */ limit?: number; } export interface AGSListLineItemsOptions { /** Optional AGS resource_id filter. */ resourceId?: string; /** Optional AGS resource_link_id filter. */ resourceLinkId?: string; /** Optional AGS tag filter. */ tag?: string; /** Optional maximum number of line items to request. */ limit?: number; } /** * Assignment and Grade Services (AGS) implementation for LTI 1.3. * Provides methods to submit grades and scores back to the platform. * * @see https://www.imsglobal.org/spec/lti-ags/v2p0 */ export declare class AGSService { private tokenService; private storage; private logger; /** * Creates a new AGSService instance. * * @param tokenService - Token service for obtaining OAuth2 bearer tokens * @param storage - Storage adapter for retrieving launch configurations * @param logger - Logger instance for debug and error logging */ constructor(tokenService: TokenService, storage: LTIStorage, logger: BaseLogger); /** * Submits a grade score to the platform using LTI Assignment and Grade Services. * * @param session - Active LTI session containing AGS endpoint configuration * @param score - Score submission data including grade value and metadata * @returns Promise resolving to the HTTP response from the platform * @throws {Error} When AGS is not available for the session or submission fails * * @example * ```typescript * await agsService.submitScore(session, { * scoreGiven: 85, * scoreMaximum: 100, * comment: 'Great work!', * activityProgress: 'Completed', * gradingProgress: 'FullyGraded' * }); * ``` */ submitScore(session: LTISession, score: ScoreSubmission): Promise; /** * Retrieves all scores for a specific line item from the platform using Assignment and Grade Services. * * @param session - Active LTI session containing AGS line item endpoint configuration * @param options - Optional line item target override and AGS result filters * @returns Promise resolving to the HTTP response containing scores data for the line item * @throws {Error} When AGS line item service is not available for the session or request fails * * @example * ```typescript * const response = await agsService.getScores(session); * const scores = await response.json(); * console.log('All scores for this line item:', scores); * ``` */ getScores(session: LTISession, options?: AGSGetScoresOptions): Promise; /** * Retrieves line items (gradebook columns) from the platform using Assignment and Grade Services. * * @param session - Active LTI session containing AGS line items endpoint configuration * @param options - Optional AGS line item list filters * @returns Promise resolving to the HTTP response containing line items data * @throws {Error} When AGS line items service is not available for the session or request fails * * @example * ```typescript * const response = await agsService.listLineItems(session); * const lineItems = await response.json(); * console.log('Available gradebook columns:', lineItems); * ``` */ listLineItems(session: LTISession, options?: AGSListLineItemsOptions): Promise; /** * Retrieves a specific line item (gradebook column) from the platform using Assignment and Grade Services. * * @param session - Active LTI session containing AGS line item endpoint configuration * @param options - Optional line item target override * @returns Promise resolving to the HTTP response containing the line item data * @throws {Error} When AGS line item service is not available for the session or request fails * * @example * ```typescript * const response = await agsService.getLineItem(session); * const lineItem = await response.json(); * console.log('Line item details:', lineItem); * ``` */ getLineItem(session: LTISession, options?: AGSLineItemTargetOptions): Promise; /** * Creates a new line item (gradebook column) on the platform using Assignment and Grade Services. * * @param session - Active LTI session containing AGS line items endpoint configuration * @param createLineItem - Line item data including label, scoreMaximum, and optional metadata * @returns Promise resolving to the HTTP response containing the created line item with generated ID * @throws {Error} When AGS line item creation service is not available for the session or creation fails * * @example * ```typescript * const response = await agsService.createLineItem(session, { * label: 'Quiz 1', * scoreMaximum: 100, * tag: 'quiz', * resourceId: 'quiz-001' * }); * const newLineItem = await response.json(); * console.log('Created line item:', newLineItem.id); * ``` */ createLineItem(session: LTISession, createLineItem: CreateLineItem): Promise; /** * Updates an existing line item (gradebook column) on the platform using Assignment and Grade Services. * * @param session - Active LTI session containing AGS line item endpoint configuration * @param updateLineItem - Updated line item data including all required fields * @returns Promise resolving to the HTTP response containing the updated line item * @throws {Error} When AGS line item service is not available for the session or update fails * * @example * ```typescript * const response = await agsService.updateLineItem(session, { * label: 'Quiz 1 (Updated)', * scoreMaximum: 100, * tag: 'quiz' * }); * const updatedLineItem = await response.json(); * ``` */ updateLineItem(session: LTISession, updateLineItem: UpdateLineItem): Promise; /** * Deletes a line item (gradebook column) from the platform using Assignment and Grade Services. * * @param session - Active LTI session containing AGS line item endpoint configuration * @returns Promise resolving to the HTTP response (typically 204 No Content on success) * @throws {Error} When AGS line item service is not available for the session or deletion fails * * @example * ```typescript * const response = await agsService.deleteLineItem(session); * console.log('Line item deleted successfully'); * ``` */ deleteLineItem(session: LTISession): Promise; private getAGSToken; private buildLineItemsUrl; private buildResultsUrl; private validateAGSResponse; } //# sourceMappingURL=ags.service.d.ts.map