feat(api): add candidate assessment attempt contract

This commit is contained in:
shira committed 2026-10-06 03:28:44 +03:00
1 parent 6c86c4e559
commit 565ef8d4f5
100 files changed
+30314 -74

No files matched your search

@@ -0,0 +1,230 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import {
faker
} from '@faker-js/faker';
import {
HttpResponse,
http
} from 'msw';
import type {
RequestHandlerOptions
} from 'msw';
import {
AssessmentAttemptState,
AssessmentGradeAvailabilityStatus,
AssessmentLimitation,
AssessmentMode,
AssessmentNextAction,
AssessmentNotDeterminedReason,
AssessmentOutcome,
AssessmentStrength,
CalibrationStatus,
GradeCode,
PracticeFailureReason,
PracticeKind,
PracticeStatus,
SpecializationCode,
TaskLanguage
} from '../../schemas';
import type {
AssessmentAttempt,
AssessmentAvailability,
AssessmentItem,
AssessmentResult,
AssessmentSessions,
AssessmentUncertainty,
BasicScore,
ChoiceItemContent,
ConfigurationItemContent,
FindErrorItemContent,
NumberItemContent,
OrderItemContent,
PracticeItemContent,
PracticeVerdict,
StringItemContent
} from '../../schemas';
export const getGetMyAssessmentAvailabilityResponseMock = (overrideResponse: Partial<Extract<AssessmentAvailability, object>> = {}): AssessmentAvailability => ({specializations: Array.from({ length: faker.number.int({min: 1, max: 2}) }, (_, i) => i + 1).map(() => ({specialization: faker.helpers.arrayElement(Object.values(SpecializationCode)), confirmed_grade: faker.helpers.arrayElement([faker.helpers.arrayElement(Object.values(GradeCode)),null,]), active_attempt_id: faker.helpers.arrayElement([faker.string.uuid(), null]), grades: Array.from({ length: faker.number.int({min: 1, max: 10}) }, (_, i) => i + 1).map(() => ({grade: faker.helpers.arrayElement(Object.values(GradeCode)), status: faker.helpers.arrayElement(Object.values(AssessmentGradeAvailabilityStatus)), mode: faker.helpers.arrayElement([faker.helpers.arrayElement(Object.values(AssessmentMode)),null,]), available_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + 'Z',null,]), time_limit_seconds: faker.helpers.arrayElement([faker.number.int({min: 1}), null]), max_sessions: faker.helpers.arrayElement([faker.number.int({min: 1, max: 10}), null]), max_items: faker.helpers.arrayElement([faker.number.int({min: 1, max: 100}), null]), practice_required: faker.helpers.arrayElement([faker.datatype.boolean(), null])}))})), ...overrideResponse})
export const getCreateMyAssessmentAttemptResponseAssessmentSessionsMock = (overrideResponse: Partial<AssessmentSessions> = {}): AssessmentSessions => ({...{used: faker.number.int({min: 1, max: 10}), max: faker.number.int({min: 1, max: 10}), idle_timeout_seconds: faker.number.int({min: 60, max: 86400})}, ...overrideResponse});
export const getCreateMyAssessmentAttemptResponseChoiceItemContentMock = (overrideResponse: Partial<ChoiceItemContent> = {}): ChoiceItemContent => ({...{format: faker.helpers.arrayElement(['choice'] as const), options: Array.from({ length: faker.number.int({min: 2, max: 10}) }, (_, i) => i + 1).map(() => ({id: faker.helpers.fromRegExp("^[A-Za-z0-9_-]+$"), text: faker.string.alpha({length: {min: 1, max: 2000}})})), multiple: faker.datatype.boolean()}, ...overrideResponse});
export const getCreateMyAssessmentAttemptResponseNumberItemContentMock = (overrideResponse: Partial<NumberItemContent> = {}): NumberItemContent => ({...{format: faker.helpers.arrayElement(['number'] as const), unit: faker.helpers.arrayElement([faker.string.alpha({length: {min: 1, max: 32}}), null])}, ...overrideResponse});
export const getCreateMyAssessmentAttemptResponseStringItemContentMock = (overrideResponse: Partial<StringItemContent> = {}): StringItemContent => ({...{format: faker.helpers.arrayElement(['string'] as const), max_length: faker.number.int({min: 1, max: 500})}, ...overrideResponse});
export const getCreateMyAssessmentAttemptResponseOrderItemContentMock = (overrideResponse: Partial<OrderItemContent> = {}): OrderItemContent => ({...{format: faker.helpers.arrayElement(['order'] as const), elements: Array.from({ length: faker.number.int({min: 2, max: 20}) }, (_, i) => i + 1).map(() => ({id: faker.helpers.fromRegExp("^[A-Za-z0-9_-]+$"), text: faker.string.alpha({length: {min: 1, max: 2000}})}))}, ...overrideResponse});
export const getCreateMyAssessmentAttemptResponseFindErrorItemContentMock = (overrideResponse: Partial<FindErrorItemContent> = {}): FindErrorItemContent => ({...{format: faker.helpers.arrayElement(['find_error'] as const), syntax: faker.helpers.arrayElement([faker.helpers.fromRegExp("^[a-z0-9_+-]+$"), null]), lines: Array.from({ length: faker.number.int({min: 1, max: 500}) }, (_, i) => i + 1).map(() => ({number: faker.number.int({min: 1, max: 500}), text: faker.string.alpha({length: {min: 10, max: 1000}})})), max_selections: faker.number.int({min: 1, max: 10})}, ...overrideResponse});
export const getCreateMyAssessmentAttemptResponseConfigurationItemContentMock = (overrideResponse: Partial<ConfigurationItemContent> = {}): ConfigurationItemContent => ({...{format: faker.helpers.arrayElement(['configuration'] as const), syntax: faker.helpers.fromRegExp("^[a-z0-9_+-]+$"), initial_config: faker.string.alpha({length: {min: 10, max: 20000}}), max_length: faker.number.int({min: 1, max: 20000})}, ...overrideResponse});
export const getCreateMyAssessmentAttemptResponsePracticeItemContentMock = (overrideResponse: Partial<PracticeItemContent> = {}): PracticeItemContent => ({...{format: faker.helpers.arrayElement(['practice'] as const), languages: faker.helpers.arrayElements(Object.values(TaskLanguage)), public_examples: Array.from({ length: faker.number.int({min: 1, max: 10}) }, (_, i) => i + 1).map(() => ({input: faker.string.alpha({length: {min: 10, max: 10000}}), expected_output: faker.string.alpha({length: {min: 10, max: 10000}})})), max_source_length: faker.number.int({min: 1, max: 65536})}, ...overrideResponse});
export const getCreateMyAssessmentAttemptResponseAssessmentItemMock = (overrideResponse: Partial<AssessmentItem> = {}): AssessmentItem => ({...{id: faker.string.uuid(), sequence: faker.number.int({min: 1, max: 100}), prompt: faker.string.alpha({length: {min: 1, max: 20000}}), content: faker.helpers.arrayElement([{...getCreateMyAssessmentAttemptResponseChoiceItemContentMock()},{...getCreateMyAssessmentAttemptResponseNumberItemContentMock()},{...getCreateMyAssessmentAttemptResponseStringItemContentMock()},{...getCreateMyAssessmentAttemptResponseOrderItemContentMock()},{...getCreateMyAssessmentAttemptResponseFindErrorItemContentMock()},{...getCreateMyAssessmentAttemptResponseConfigurationItemContentMock()},{...getCreateMyAssessmentAttemptResponsePracticeItemContentMock()},])}, ...overrideResponse});
export const getCreateMyAssessmentAttemptResponsePracticeVerdictMock = (overrideResponse: Partial<PracticeVerdict> = {}): PracticeVerdict => ({...{score: faker.number.int({min: 0, max: 3}), max_score: faker.number.int({min: 3, max: 3}), groups: Array.from({ length: faker.number.int({min: 3, max: 3}) }, (_, i) => i + 1).map(() => ({group: faker.number.int({min: 1, max: 3}), passed: faker.datatype.boolean()}))}, ...overrideResponse});
export const getCreateMyAssessmentAttemptResponseMock = (overrideResponse: Partial<Extract<AssessmentAttempt, object>> = {}): AssessmentAttempt => ({id: faker.string.uuid(), version: faker.number.int({min: 1}), specialization: faker.helpers.arrayElement(Object.values(SpecializationCode)), target_grade: faker.helpers.arrayElement(Object.values(GradeCode)), task_language: faker.helpers.arrayElement([faker.helpers.arrayElement(Object.values(TaskLanguage)),null,]), mode: faker.helpers.arrayElement(Object.values(AssessmentMode)), state: faker.helpers.arrayElement(Object.values(AssessmentAttemptState)), versions: {policy_version: faker.number.int({min: 1}), bank_version: faker.helpers.fromRegExp("^[A-Za-z0-9._-]+$"), algorithm_version: faker.helpers.fromRegExp("^[A-Za-z0-9._-]+$")}, started_at: faker.date.past().toISOString().slice(0, 19) + 'Z', expires_at: faker.date.past().toISOString().slice(0, 19) + 'Z', sessions: faker.helpers.arrayElement([{...getCreateMyAssessmentAttemptResponseAssessmentSessionsMock()},null,]), finished_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + 'Z',null,]), progress: {answered_items: faker.number.int({min: 0, max: 100}), max_items: faker.number.int({min: 1, max: 100})}, current_item: faker.helpers.arrayElement([{...getCreateMyAssessmentAttemptResponseAssessmentItemMock()},null,]), practices: Array.from({ length: faker.number.int({min: 1, max: 5}) }, (_, i) => i + 1).map(() => ({kind: faker.helpers.arrayElement(Object.values(PracticeKind)), item_id: faker.string.uuid(), status: faker.helpers.arrayElement(Object.values(PracticeStatus)), submitted_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + 'Z',null,]), verdict: faker.helpers.arrayElement([{...getCreateMyAssessmentAttemptResponsePracticeVerdictMock()},null,]), failure_reason: faker.helpers.arrayElement([faker.helpers.arrayElement(Object.values(PracticeFailureReason)),null,])})), ...overrideResponse})
export const getGetMyAssessmentAttemptResponseAssessmentSessionsMock = (overrideResponse: Partial<AssessmentSessions> = {}): AssessmentSessions => ({...{used: faker.number.int({min: 1, max: 10}), max: faker.number.int({min: 1, max: 10}), idle_timeout_seconds: faker.number.int({min: 60, max: 86400})}, ...overrideResponse});
export const getGetMyAssessmentAttemptResponseChoiceItemContentMock = (overrideResponse: Partial<ChoiceItemContent> = {}): ChoiceItemContent => ({...{format: faker.helpers.arrayElement(['choice'] as const), options: Array.from({ length: faker.number.int({min: 2, max: 10}) }, (_, i) => i + 1).map(() => ({id: faker.helpers.fromRegExp("^[A-Za-z0-9_-]+$"), text: faker.string.alpha({length: {min: 1, max: 2000}})})), multiple: faker.datatype.boolean()}, ...overrideResponse});
export const getGetMyAssessmentAttemptResponseNumberItemContentMock = (overrideResponse: Partial<NumberItemContent> = {}): NumberItemContent => ({...{format: faker.helpers.arrayElement(['number'] as const), unit: faker.helpers.arrayElement([faker.string.alpha({length: {min: 1, max: 32}}), null])}, ...overrideResponse});
export const getGetMyAssessmentAttemptResponseStringItemContentMock = (overrideResponse: Partial<StringItemContent> = {}): StringItemContent => ({...{format: faker.helpers.arrayElement(['string'] as const), max_length: faker.number.int({min: 1, max: 500})}, ...overrideResponse});
export const getGetMyAssessmentAttemptResponseOrderItemContentMock = (overrideResponse: Partial<OrderItemContent> = {}): OrderItemContent => ({...{format: faker.helpers.arrayElement(['order'] as const), elements: Array.from({ length: faker.number.int({min: 2, max: 20}) }, (_, i) => i + 1).map(() => ({id: faker.helpers.fromRegExp("^[A-Za-z0-9_-]+$"), text: faker.string.alpha({length: {min: 1, max: 2000}})}))}, ...overrideResponse});
export const getGetMyAssessmentAttemptResponseFindErrorItemContentMock = (overrideResponse: Partial<FindErrorItemContent> = {}): FindErrorItemContent => ({...{format: faker.helpers.arrayElement(['find_error'] as const), syntax: faker.helpers.arrayElement([faker.helpers.fromRegExp("^[a-z0-9_+-]+$"), null]), lines: Array.from({ length: faker.number.int({min: 1, max: 500}) }, (_, i) => i + 1).map(() => ({number: faker.number.int({min: 1, max: 500}), text: faker.string.alpha({length: {min: 10, max: 1000}})})), max_selections: faker.number.int({min: 1, max: 10})}, ...overrideResponse});
export const getGetMyAssessmentAttemptResponseConfigurationItemContentMock = (overrideResponse: Partial<ConfigurationItemContent> = {}): ConfigurationItemContent => ({...{format: faker.helpers.arrayElement(['configuration'] as const), syntax: faker.helpers.fromRegExp("^[a-z0-9_+-]+$"), initial_config: faker.string.alpha({length: {min: 10, max: 20000}}), max_length: faker.number.int({min: 1, max: 20000})}, ...overrideResponse});
export const getGetMyAssessmentAttemptResponsePracticeItemContentMock = (overrideResponse: Partial<PracticeItemContent> = {}): PracticeItemContent => ({...{format: faker.helpers.arrayElement(['practice'] as const), languages: faker.helpers.arrayElements(Object.values(TaskLanguage)), public_examples: Array.from({ length: faker.number.int({min: 1, max: 10}) }, (_, i) => i + 1).map(() => ({input: faker.string.alpha({length: {min: 10, max: 10000}}), expected_output: faker.string.alpha({length: {min: 10, max: 10000}})})), max_source_length: faker.number.int({min: 1, max: 65536})}, ...overrideResponse});
export const getGetMyAssessmentAttemptResponseAssessmentItemMock = (overrideResponse: Partial<AssessmentItem> = {}): AssessmentItem => ({...{id: faker.string.uuid(), sequence: faker.number.int({min: 1, max: 100}), prompt: faker.string.alpha({length: {min: 1, max: 20000}}), content: faker.helpers.arrayElement([{...getGetMyAssessmentAttemptResponseChoiceItemContentMock()},{...getGetMyAssessmentAttemptResponseNumberItemContentMock()},{...getGetMyAssessmentAttemptResponseStringItemContentMock()},{...getGetMyAssessmentAttemptResponseOrderItemContentMock()},{...getGetMyAssessmentAttemptResponseFindErrorItemContentMock()},{...getGetMyAssessmentAttemptResponseConfigurationItemContentMock()},{...getGetMyAssessmentAttemptResponsePracticeItemContentMock()},])}, ...overrideResponse});
export const getGetMyAssessmentAttemptResponsePracticeVerdictMock = (overrideResponse: Partial<PracticeVerdict> = {}): PracticeVerdict => ({...{score: faker.number.int({min: 0, max: 3}), max_score: faker.number.int({min: 3, max: 3}), groups: Array.from({ length: faker.number.int({min: 3, max: 3}) }, (_, i) => i + 1).map(() => ({group: faker.number.int({min: 1, max: 3}), passed: faker.datatype.boolean()}))}, ...overrideResponse});
export const getGetMyAssessmentAttemptResponseMock = (overrideResponse: Partial<Extract<AssessmentAttempt, object>> = {}): AssessmentAttempt => ({id: faker.string.uuid(), version: faker.number.int({min: 1}), specialization: faker.helpers.arrayElement(Object.values(SpecializationCode)), target_grade: faker.helpers.arrayElement(Object.values(GradeCode)), task_language: faker.helpers.arrayElement([faker.helpers.arrayElement(Object.values(TaskLanguage)),null,]), mode: faker.helpers.arrayElement(Object.values(AssessmentMode)), state: faker.helpers.arrayElement(Object.values(AssessmentAttemptState)), versions: {policy_version: faker.number.int({min: 1}), bank_version: faker.helpers.fromRegExp("^[A-Za-z0-9._-]+$"), algorithm_version: faker.helpers.fromRegExp("^[A-Za-z0-9._-]+$")}, started_at: faker.date.past().toISOString().slice(0, 19) + 'Z', expires_at: faker.date.past().toISOString().slice(0, 19) + 'Z', sessions: faker.helpers.arrayElement([{...getGetMyAssessmentAttemptResponseAssessmentSessionsMock()},null,]), finished_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + 'Z',null,]), progress: {answered_items: faker.number.int({min: 0, max: 100}), max_items: faker.number.int({min: 1, max: 100})}, current_item: faker.helpers.arrayElement([{...getGetMyAssessmentAttemptResponseAssessmentItemMock()},null,]), practices: Array.from({ length: faker.number.int({min: 1, max: 5}) }, (_, i) => i + 1).map(() => ({kind: faker.helpers.arrayElement(Object.values(PracticeKind)), item_id: faker.string.uuid(), status: faker.helpers.arrayElement(Object.values(PracticeStatus)), submitted_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + 'Z',null,]), verdict: faker.helpers.arrayElement([{...getGetMyAssessmentAttemptResponsePracticeVerdictMock()},null,]), failure_reason: faker.helpers.arrayElement([faker.helpers.arrayElement(Object.values(PracticeFailureReason)),null,])})), ...overrideResponse})
export const getSubmitMyAssessmentAnswerResponseAssessmentSessionsMock = (overrideResponse: Partial<AssessmentSessions> = {}): AssessmentSessions => ({...{used: faker.number.int({min: 1, max: 10}), max: faker.number.int({min: 1, max: 10}), idle_timeout_seconds: faker.number.int({min: 60, max: 86400})}, ...overrideResponse});
export const getSubmitMyAssessmentAnswerResponseChoiceItemContentMock = (overrideResponse: Partial<ChoiceItemContent> = {}): ChoiceItemContent => ({...{format: faker.helpers.arrayElement(['choice'] as const), options: Array.from({ length: faker.number.int({min: 2, max: 10}) }, (_, i) => i + 1).map(() => ({id: faker.helpers.fromRegExp("^[A-Za-z0-9_-]+$"), text: faker.string.alpha({length: {min: 1, max: 2000}})})), multiple: faker.datatype.boolean()}, ...overrideResponse});
export const getSubmitMyAssessmentAnswerResponseNumberItemContentMock = (overrideResponse: Partial<NumberItemContent> = {}): NumberItemContent => ({...{format: faker.helpers.arrayElement(['number'] as const), unit: faker.helpers.arrayElement([faker.string.alpha({length: {min: 1, max: 32}}), null])}, ...overrideResponse});
export const getSubmitMyAssessmentAnswerResponseStringItemContentMock = (overrideResponse: Partial<StringItemContent> = {}): StringItemContent => ({...{format: faker.helpers.arrayElement(['string'] as const), max_length: faker.number.int({min: 1, max: 500})}, ...overrideResponse});
export const getSubmitMyAssessmentAnswerResponseOrderItemContentMock = (overrideResponse: Partial<OrderItemContent> = {}): OrderItemContent => ({...{format: faker.helpers.arrayElement(['order'] as const), elements: Array.from({ length: faker.number.int({min: 2, max: 20}) }, (_, i) => i + 1).map(() => ({id: faker.helpers.fromRegExp("^[A-Za-z0-9_-]+$"), text: faker.string.alpha({length: {min: 1, max: 2000}})}))}, ...overrideResponse});
export const getSubmitMyAssessmentAnswerResponseFindErrorItemContentMock = (overrideResponse: Partial<FindErrorItemContent> = {}): FindErrorItemContent => ({...{format: faker.helpers.arrayElement(['find_error'] as const), syntax: faker.helpers.arrayElement([faker.helpers.fromRegExp("^[a-z0-9_+-]+$"), null]), lines: Array.from({ length: faker.number.int({min: 1, max: 500}) }, (_, i) => i + 1).map(() => ({number: faker.number.int({min: 1, max: 500}), text: faker.string.alpha({length: {min: 10, max: 1000}})})), max_selections: faker.number.int({min: 1, max: 10})}, ...overrideResponse});
export const getSubmitMyAssessmentAnswerResponseConfigurationItemContentMock = (overrideResponse: Partial<ConfigurationItemContent> = {}): ConfigurationItemContent => ({...{format: faker.helpers.arrayElement(['configuration'] as const), syntax: faker.helpers.fromRegExp("^[a-z0-9_+-]+$"), initial_config: faker.string.alpha({length: {min: 10, max: 20000}}), max_length: faker.number.int({min: 1, max: 20000})}, ...overrideResponse});
export const getSubmitMyAssessmentAnswerResponsePracticeItemContentMock = (overrideResponse: Partial<PracticeItemContent> = {}): PracticeItemContent => ({...{format: faker.helpers.arrayElement(['practice'] as const), languages: faker.helpers.arrayElements(Object.values(TaskLanguage)), public_examples: Array.from({ length: faker.number.int({min: 1, max: 10}) }, (_, i) => i + 1).map(() => ({input: faker.string.alpha({length: {min: 10, max: 10000}}), expected_output: faker.string.alpha({length: {min: 10, max: 10000}})})), max_source_length: faker.number.int({min: 1, max: 65536})}, ...overrideResponse});
export const getSubmitMyAssessmentAnswerResponseAssessmentItemMock = (overrideResponse: Partial<AssessmentItem> = {}): AssessmentItem => ({...{id: faker.string.uuid(), sequence: faker.number.int({min: 1, max: 100}), prompt: faker.string.alpha({length: {min: 1, max: 20000}}), content: faker.helpers.arrayElement([{...getSubmitMyAssessmentAnswerResponseChoiceItemContentMock()},{...getSubmitMyAssessmentAnswerResponseNumberItemContentMock()},{...getSubmitMyAssessmentAnswerResponseStringItemContentMock()},{...getSubmitMyAssessmentAnswerResponseOrderItemContentMock()},{...getSubmitMyAssessmentAnswerResponseFindErrorItemContentMock()},{...getSubmitMyAssessmentAnswerResponseConfigurationItemContentMock()},{...getSubmitMyAssessmentAnswerResponsePracticeItemContentMock()},])}, ...overrideResponse});
export const getSubmitMyAssessmentAnswerResponsePracticeVerdictMock = (overrideResponse: Partial<PracticeVerdict> = {}): PracticeVerdict => ({...{score: faker.number.int({min: 0, max: 3}), max_score: faker.number.int({min: 3, max: 3}), groups: Array.from({ length: faker.number.int({min: 3, max: 3}) }, (_, i) => i + 1).map(() => ({group: faker.number.int({min: 1, max: 3}), passed: faker.datatype.boolean()}))}, ...overrideResponse});
export const getSubmitMyAssessmentAnswerResponseMock = (overrideResponse: Partial<Extract<AssessmentAttempt, object>> = {}): AssessmentAttempt => ({id: faker.string.uuid(), version: faker.number.int({min: 1}), specialization: faker.helpers.arrayElement(Object.values(SpecializationCode)), target_grade: faker.helpers.arrayElement(Object.values(GradeCode)), task_language: faker.helpers.arrayElement([faker.helpers.arrayElement(Object.values(TaskLanguage)),null,]), mode: faker.helpers.arrayElement(Object.values(AssessmentMode)), state: faker.helpers.arrayElement(Object.values(AssessmentAttemptState)), versions: {policy_version: faker.number.int({min: 1}), bank_version: faker.helpers.fromRegExp("^[A-Za-z0-9._-]+$"), algorithm_version: faker.helpers.fromRegExp("^[A-Za-z0-9._-]+$")}, started_at: faker.date.past().toISOString().slice(0, 19) + 'Z', expires_at: faker.date.past().toISOString().slice(0, 19) + 'Z', sessions: faker.helpers.arrayElement([{...getSubmitMyAssessmentAnswerResponseAssessmentSessionsMock()},null,]), finished_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + 'Z',null,]), progress: {answered_items: faker.number.int({min: 0, max: 100}), max_items: faker.number.int({min: 1, max: 100})}, current_item: faker.helpers.arrayElement([{...getSubmitMyAssessmentAnswerResponseAssessmentItemMock()},null,]), practices: Array.from({ length: faker.number.int({min: 1, max: 5}) }, (_, i) => i + 1).map(() => ({kind: faker.helpers.arrayElement(Object.values(PracticeKind)), item_id: faker.string.uuid(), status: faker.helpers.arrayElement(Object.values(PracticeStatus)), submitted_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + 'Z',null,]), verdict: faker.helpers.arrayElement([{...getSubmitMyAssessmentAnswerResponsePracticeVerdictMock()},null,]), failure_reason: faker.helpers.arrayElement([faker.helpers.arrayElement(Object.values(PracticeFailureReason)),null,])})), ...overrideResponse})
export const getFinalizeMyAssessmentAttemptResponseAssessmentSessionsMock = (overrideResponse: Partial<AssessmentSessions> = {}): AssessmentSessions => ({...{used: faker.number.int({min: 1, max: 10}), max: faker.number.int({min: 1, max: 10}), idle_timeout_seconds: faker.number.int({min: 60, max: 86400})}, ...overrideResponse});
export const getFinalizeMyAssessmentAttemptResponseChoiceItemContentMock = (overrideResponse: Partial<ChoiceItemContent> = {}): ChoiceItemContent => ({...{format: faker.helpers.arrayElement(['choice'] as const), options: Array.from({ length: faker.number.int({min: 2, max: 10}) }, (_, i) => i + 1).map(() => ({id: faker.helpers.fromRegExp("^[A-Za-z0-9_-]+$"), text: faker.string.alpha({length: {min: 1, max: 2000}})})), multiple: faker.datatype.boolean()}, ...overrideResponse});
export const getFinalizeMyAssessmentAttemptResponseNumberItemContentMock = (overrideResponse: Partial<NumberItemContent> = {}): NumberItemContent => ({...{format: faker.helpers.arrayElement(['number'] as const), unit: faker.helpers.arrayElement([faker.string.alpha({length: {min: 1, max: 32}}), null])}, ...overrideResponse});
export const getFinalizeMyAssessmentAttemptResponseStringItemContentMock = (overrideResponse: Partial<StringItemContent> = {}): StringItemContent => ({...{format: faker.helpers.arrayElement(['string'] as const), max_length: faker.number.int({min: 1, max: 500})}, ...overrideResponse});
export const getFinalizeMyAssessmentAttemptResponseOrderItemContentMock = (overrideResponse: Partial<OrderItemContent> = {}): OrderItemContent => ({...{format: faker.helpers.arrayElement(['order'] as const), elements: Array.from({ length: faker.number.int({min: 2, max: 20}) }, (_, i) => i + 1).map(() => ({id: faker.helpers.fromRegExp("^[A-Za-z0-9_-]+$"), text: faker.string.alpha({length: {min: 1, max: 2000}})}))}, ...overrideResponse});
export const getFinalizeMyAssessmentAttemptResponseFindErrorItemContentMock = (overrideResponse: Partial<FindErrorItemContent> = {}): FindErrorItemContent => ({...{format: faker.helpers.arrayElement(['find_error'] as const), syntax: faker.helpers.arrayElement([faker.helpers.fromRegExp("^[a-z0-9_+-]+$"), null]), lines: Array.from({ length: faker.number.int({min: 1, max: 500}) }, (_, i) => i + 1).map(() => ({number: faker.number.int({min: 1, max: 500}), text: faker.string.alpha({length: {min: 10, max: 1000}})})), max_selections: faker.number.int({min: 1, max: 10})}, ...overrideResponse});
export const getFinalizeMyAssessmentAttemptResponseConfigurationItemContentMock = (overrideResponse: Partial<ConfigurationItemContent> = {}): ConfigurationItemContent => ({...{format: faker.helpers.arrayElement(['configuration'] as const), syntax: faker.helpers.fromRegExp("^[a-z0-9_+-]+$"), initial_config: faker.string.alpha({length: {min: 10, max: 20000}}), max_length: faker.number.int({min: 1, max: 20000})}, ...overrideResponse});
export const getFinalizeMyAssessmentAttemptResponsePracticeItemContentMock = (overrideResponse: Partial<PracticeItemContent> = {}): PracticeItemContent => ({...{format: faker.helpers.arrayElement(['practice'] as const), languages: faker.helpers.arrayElements(Object.values(TaskLanguage)), public_examples: Array.from({ length: faker.number.int({min: 1, max: 10}) }, (_, i) => i + 1).map(() => ({input: faker.string.alpha({length: {min: 10, max: 10000}}), expected_output: faker.string.alpha({length: {min: 10, max: 10000}})})), max_source_length: faker.number.int({min: 1, max: 65536})}, ...overrideResponse});
export const getFinalizeMyAssessmentAttemptResponseAssessmentItemMock = (overrideResponse: Partial<AssessmentItem> = {}): AssessmentItem => ({...{id: faker.string.uuid(), sequence: faker.number.int({min: 1, max: 100}), prompt: faker.string.alpha({length: {min: 1, max: 20000}}), content: faker.helpers.arrayElement([{...getFinalizeMyAssessmentAttemptResponseChoiceItemContentMock()},{...getFinalizeMyAssessmentAttemptResponseNumberItemContentMock()},{...getFinalizeMyAssessmentAttemptResponseStringItemContentMock()},{...getFinalizeMyAssessmentAttemptResponseOrderItemContentMock()},{...getFinalizeMyAssessmentAttemptResponseFindErrorItemContentMock()},{...getFinalizeMyAssessmentAttemptResponseConfigurationItemContentMock()},{...getFinalizeMyAssessmentAttemptResponsePracticeItemContentMock()},])}, ...overrideResponse});
export const getFinalizeMyAssessmentAttemptResponsePracticeVerdictMock = (overrideResponse: Partial<PracticeVerdict> = {}): PracticeVerdict => ({...{score: faker.number.int({min: 0, max: 3}), max_score: faker.number.int({min: 3, max: 3}), groups: Array.from({ length: faker.number.int({min: 3, max: 3}) }, (_, i) => i + 1).map(() => ({group: faker.number.int({min: 1, max: 3}), passed: faker.datatype.boolean()}))}, ...overrideResponse});
export const getFinalizeMyAssessmentAttemptResponseMock = (overrideResponse: Partial<Extract<AssessmentAttempt, object>> = {}): AssessmentAttempt => ({id: faker.string.uuid(), version: faker.number.int({min: 1}), specialization: faker.helpers.arrayElement(Object.values(SpecializationCode)), target_grade: faker.helpers.arrayElement(Object.values(GradeCode)), task_language: faker.helpers.arrayElement([faker.helpers.arrayElement(Object.values(TaskLanguage)),null,]), mode: faker.helpers.arrayElement(Object.values(AssessmentMode)), state: faker.helpers.arrayElement(Object.values(AssessmentAttemptState)), versions: {policy_version: faker.number.int({min: 1}), bank_version: faker.helpers.fromRegExp("^[A-Za-z0-9._-]+$"), algorithm_version: faker.helpers.fromRegExp("^[A-Za-z0-9._-]+$")}, started_at: faker.date.past().toISOString().slice(0, 19) + 'Z', expires_at: faker.date.past().toISOString().slice(0, 19) + 'Z', sessions: faker.helpers.arrayElement([{...getFinalizeMyAssessmentAttemptResponseAssessmentSessionsMock()},null,]), finished_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + 'Z',null,]), progress: {answered_items: faker.number.int({min: 0, max: 100}), max_items: faker.number.int({min: 1, max: 100})}, current_item: faker.helpers.arrayElement([{...getFinalizeMyAssessmentAttemptResponseAssessmentItemMock()},null,]), practices: Array.from({ length: faker.number.int({min: 1, max: 5}) }, (_, i) => i + 1).map(() => ({kind: faker.helpers.arrayElement(Object.values(PracticeKind)), item_id: faker.string.uuid(), status: faker.helpers.arrayElement(Object.values(PracticeStatus)), submitted_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + 'Z',null,]), verdict: faker.helpers.arrayElement([{...getFinalizeMyAssessmentAttemptResponsePracticeVerdictMock()},null,]), failure_reason: faker.helpers.arrayElement([faker.helpers.arrayElement(Object.values(PracticeFailureReason)),null,])})), ...overrideResponse})
export const getGetMyAssessmentResultResponseAssessmentUncertaintyMock = (overrideResponse: Partial<AssessmentUncertainty> = {}): AssessmentUncertainty => ({...{theta: faker.number.float({fractionDigits: 2}), standard_error: faker.number.float({min: 0, fractionDigits: 2}), interval_95: {low: faker.number.float({fractionDigits: 2}), high: faker.number.float({fractionDigits: 2})}, p_grade: faker.number.float({min: 0, max: 1, fractionDigits: 2})}, ...overrideResponse});
export const getGetMyAssessmentResultResponseBasicScoreMock = (overrideResponse: Partial<BasicScore> = {}): BasicScore => ({...{points: faker.number.int({min: 0}), max_points: faker.number.int({min: 1}), pass_points: faker.number.int({min: 1})}, ...overrideResponse});
export const getGetMyAssessmentResultResponseMock = (overrideResponse: Partial<Extract<AssessmentResult, object>> = {}): AssessmentResult => ({attempt_id: faker.string.uuid(), specialization: faker.helpers.arrayElement(Object.values(SpecializationCode)), target_grade: faker.helpers.arrayElement(Object.values(GradeCode)), task_language: faker.helpers.arrayElement([faker.helpers.arrayElement(Object.values(TaskLanguage)),null,]), mode: faker.helpers.arrayElement(Object.values(AssessmentMode)), versions: {policy_version: faker.number.int({min: 1}), bank_version: faker.helpers.fromRegExp("^[A-Za-z0-9._-]+$"), algorithm_version: faker.helpers.fromRegExp("^[A-Za-z0-9._-]+$")}, outcome: faker.helpers.arrayElement(Object.values(AssessmentOutcome)), not_determined_reason: faker.helpers.arrayElement([faker.helpers.arrayElement(Object.values(AssessmentNotDeterminedReason)),null,]), confirmed_grade: faker.helpers.arrayElement([faker.helpers.arrayElement(Object.values(GradeCode)),null,]), previous_confirmed_grade: faker.helpers.arrayElement([faker.helpers.arrayElement(Object.values(GradeCode)),null,]), strength: faker.helpers.arrayElement([faker.helpers.arrayElement(Object.values(AssessmentStrength)),null,]), calibration_status: faker.helpers.arrayElement(Object.values(CalibrationStatus)), limitations: faker.helpers.arrayElements(Object.values(AssessmentLimitation)), uncertainty: faker.helpers.arrayElement([{...getGetMyAssessmentResultResponseAssessmentUncertaintyMock()},null,]), basic_score: faker.helpers.arrayElement([{...getGetMyAssessmentResultResponseBasicScoreMock()},null,]), practices: Array.from({ length: faker.number.int({min: 1, max: 5}) }, (_, i) => i + 1).map(() => ({kind: faker.helpers.arrayElement(Object.values(PracticeKind)), verdict: {score: faker.number.int({min: 0, max: 3}), max_score: faker.number.int({min: 3, max: 3}), groups: Array.from({ length: faker.number.int({min: 3, max: 3}) }, (_, i) => i + 1).map(() => ({group: faker.number.int({min: 1, max: 3}), passed: faker.datatype.boolean()}))}})), gaps: Array.from({ length: faker.number.int({min: 1, max: 20}) }, (_, i) => i + 1).map(() => ({domain: faker.helpers.fromRegExp("^[a-z0-9_]+$"), title: faker.string.alpha({length: {min: 1, max: 200}})})), durations: {items_seconds: faker.number.int({min: 0}), practice_seconds: faker.helpers.arrayElement([faker.number.int({min: 0}), null])}, next_steps: Array.from({ length: faker.number.int({min: 1, max: 5}) }, (_, i) => i + 1).map(() => ({action: faker.helpers.arrayElement(Object.values(AssessmentNextAction)), grade: faker.helpers.arrayElement(Object.values(GradeCode)), available_at: faker.helpers.arrayElement([faker.date.past().toISOString().slice(0, 19) + 'Z',null,])})), decided_at: faker.date.past().toISOString().slice(0, 19) + 'Z', ...overrideResponse})
export const getGetMyAssessmentAvailabilityMockHandler = (overrideResponse?: AssessmentAvailability | ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => Promise<AssessmentAvailability> | AssessmentAvailability), options?: RequestHandlerOptions) => {
return http.get('*/api/v1/me/assessment-availability', async (info: Parameters<Parameters<typeof http.get>[1]>[0]) => {
return HttpResponse.json(overrideResponse !== undefined
? (typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse)
: getGetMyAssessmentAvailabilityResponseMock(),
{ status: 200
})
}, options)
}
export const getCreateMyAssessmentAttemptMockHandler = (overrideResponse?: AssessmentAttempt | ((info: Parameters<Parameters<typeof http.post>[1]>[0]) => Promise<AssessmentAttempt> | AssessmentAttempt), options?: RequestHandlerOptions) => {
return http.post('*/api/v1/me/assessment-attempts', async (info: Parameters<Parameters<typeof http.post>[1]>[0]) => {
return HttpResponse.json(overrideResponse !== undefined
? (typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse)
: getCreateMyAssessmentAttemptResponseMock(),
{ status: 201
})
}, options)
}
export const getGetMyAssessmentAttemptMockHandler = (overrideResponse?: AssessmentAttempt | ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => Promise<AssessmentAttempt> | AssessmentAttempt), options?: RequestHandlerOptions) => {
return http.get('*/api/v1/me/assessment-attempts/:attemptId', async (info: Parameters<Parameters<typeof http.get>[1]>[0]) => {
return HttpResponse.json(overrideResponse !== undefined
? (typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse)
: getGetMyAssessmentAttemptResponseMock(),
{ status: 200
})
}, options)
}
export const getSubmitMyAssessmentAnswerMockHandler = (overrideResponse?: AssessmentAttempt | ((info: Parameters<Parameters<typeof http.post>[1]>[0]) => Promise<AssessmentAttempt> | AssessmentAttempt), options?: RequestHandlerOptions) => {
return http.post('*/api/v1/me/assessment-attempts/:attemptId/answers', async (info: Parameters<Parameters<typeof http.post>[1]>[0]) => {
return HttpResponse.json(overrideResponse !== undefined
? (typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse)
: getSubmitMyAssessmentAnswerResponseMock(),
{ status: 200
})
}, options)
}
export const getFinalizeMyAssessmentAttemptMockHandler = (overrideResponse?: AssessmentAttempt | ((info: Parameters<Parameters<typeof http.post>[1]>[0]) => Promise<AssessmentAttempt> | AssessmentAttempt), options?: RequestHandlerOptions) => {
return http.post('*/api/v1/me/assessment-attempts/:attemptId/finalize', async (info: Parameters<Parameters<typeof http.post>[1]>[0]) => {
return HttpResponse.json(overrideResponse !== undefined
? (typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse)
: getFinalizeMyAssessmentAttemptResponseMock(),
{ status: 200
})
}, options)
}
export const getGetMyAssessmentResultMockHandler = (overrideResponse?: AssessmentResult | ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => Promise<AssessmentResult> | AssessmentResult), options?: RequestHandlerOptions) => {
return http.get('*/api/v1/me/assessment-attempts/:attemptId/result', async (info: Parameters<Parameters<typeof http.get>[1]>[0]) => {
return HttpResponse.json(overrideResponse !== undefined
? (typeof overrideResponse === "function" ? await overrideResponse(info) : overrideResponse)
: getGetMyAssessmentResultResponseMock(),
{ status: 200
})
}, options)
}
export const getAssessmentMock = () => [
getGetMyAssessmentAvailabilityMockHandler(),
getCreateMyAssessmentAttemptMockHandler(),
getGetMyAssessmentAttemptMockHandler(),
getSubmitMyAssessmentAnswerMockHandler(),
getFinalizeMyAssessmentAttemptMockHandler(),
getGetMyAssessmentResultMockHandler()
]
@@ -0,0 +1,678 @@
/**
* Generated by orval 🍺
* Do not edit manually.
* Lincodex API
* OpenAPI spec version: 0.1.0
*/
import {
useMutation,
useQuery
} from '@tanstack/react-query';
import type {
DataTag,
DefinedInitialDataOptions,
DefinedUseQueryResult,
MutationFunction,
QueryClient,
QueryFunction,
QueryKey,
UndefinedInitialDataOptions,
UseMutationOptions,
UseMutationResult,
UseQueryOptions,
UseQueryResult
} from '@tanstack/react-query';
import type {
AssessmentAnswerSubmission,
AssessmentAttempt,
AssessmentAttemptCreate,
AssessmentAvailability,
AssessmentFinalization,
AssessmentResult,
CreateMyAssessmentAttemptHeaders,
FinalizeMyAssessmentAttemptHeaders,
Problem,
SubmitMyAssessmentAnswerHeaders
} from '../../schemas';
import { apiRequest } from '../../client';
import type { ErrorType } from '../../client';
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
const withQueryKey = <T extends object, K>(query: T, queryKey: K): T & { queryKey: K } => {
const result = { queryKey } as T & { queryKey: K };
for (const key of Object.keys(query)) {
// The explicit queryKey always wins, matching the previous
// `{ ...query, queryKey }` spread where it was set last.
if (key === 'queryKey') continue;
Object.defineProperty(result, key, {
enumerable: true,
configurable: true,
get: () => (query as Record<string, unknown>)[key],
});
}
return result;
};
export const getGetMyAssessmentAvailabilityUrl = () => {
return `/api/v1/me/assessment-availability`
}
/**
* Requires the session cookie of a candidate account; the candidate comes from the session. For each specialization of the questionnaire, returns the confirmed grade, the active attempt, and for every grade whether an attempt can start now, in which mode, and with which limits: the time limit, the session limit, the item limit, and whether a code practice is required. The client shows them before the start, together with the method and the signals that are collected, and resumes an active attempt by `active_attempt_id`, for example after it lost the response of CreateMyAssessmentAttempt.
*
* `insufficient_bank` is the state of a category whose bank is not published or has too few families that this candidate has not seen; the server limits attempts instead of repeating families. `cooldown` carries the date when the attempt opens, so the client can explain a blocked attempt with that date and offer support. Specializations and their retry intervals are independent. Attempts that ended as `insufficient_bank` or with the reason `sandbox_unavailable` are platform limitations and never cause a `cooldown`.
*
* A missing, unknown, expired, or revoked session answers 401 unauthenticated; an employer account answers 403 forbidden.
* @summary Read which assessment attempts the current candidate can start.
*/
export const getMyAssessmentAvailability = async ( options?: Parameters<typeof apiRequest>[1]): Promise<AssessmentAvailability> => {
return apiRequest<AssessmentAvailability>(getGetMyAssessmentAvailabilityUrl(),
{
...options,
method: 'GET'
}
);}
export const getGetMyAssessmentAvailabilityQueryKey = () => {
return [
`/api/v1/me/assessment-availability`
] as const;
}
export const getGetMyAssessmentAvailabilityQueryOptions = <TData = Awaited<ReturnType<typeof getMyAssessmentAvailability>>, TError = ErrorType<Problem>>( options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMyAssessmentAvailability>>, TError, TData>>, request?: SecondParameter<typeof apiRequest>}
) => {
const {query: queryOptions, request: requestOptions} = options ?? {};
const queryKey = queryOptions?.queryKey ?? getGetMyAssessmentAvailabilityQueryKey();
const queryFn: QueryFunction<Awaited<ReturnType<typeof getMyAssessmentAvailability>>> = ({ signal }) => getMyAssessmentAvailability({ signal, ...requestOptions });
return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getMyAssessmentAvailability>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
}
export type GetMyAssessmentAvailabilityQueryResult = NonNullable<Awaited<ReturnType<typeof getMyAssessmentAvailability>>>
export type GetMyAssessmentAvailabilityQueryError = ErrorType<Problem>
export function useGetMyAssessmentAvailability<TData = Awaited<ReturnType<typeof getMyAssessmentAvailability>>, TError = ErrorType<Problem>>(
options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMyAssessmentAvailability>>, TError, TData>> & Pick<
DefinedInitialDataOptions<
Awaited<ReturnType<typeof getMyAssessmentAvailability>>,
TError,
Awaited<ReturnType<typeof getMyAssessmentAvailability>>
> , 'initialData'
>, request?: SecondParameter<typeof apiRequest>}
, queryClient?: QueryClient
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetMyAssessmentAvailability<TData = Awaited<ReturnType<typeof getMyAssessmentAvailability>>, TError = ErrorType<Problem>>(
options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMyAssessmentAvailability>>, TError, TData>> & Pick<
UndefinedInitialDataOptions<
Awaited<ReturnType<typeof getMyAssessmentAvailability>>,
TError,
Awaited<ReturnType<typeof getMyAssessmentAvailability>>
> , 'initialData'
>, request?: SecondParameter<typeof apiRequest>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetMyAssessmentAvailability<TData = Awaited<ReturnType<typeof getMyAssessmentAvailability>>, TError = ErrorType<Problem>>(
options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMyAssessmentAvailability>>, TError, TData>>, request?: SecondParameter<typeof apiRequest>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/**
* @summary Read which assessment attempts the current candidate can start.
*/
export function useGetMyAssessmentAvailability<TData = Awaited<ReturnType<typeof getMyAssessmentAvailability>>, TError = ErrorType<Problem>>(
options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMyAssessmentAvailability>>, TError, TData>>, request?: SecondParameter<typeof apiRequest>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
const queryOptions = getGetMyAssessmentAvailabilityQueryOptions(options)
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
return withQueryKey(query, queryOptions.queryKey);
}
export const getCreateMyAssessmentAttemptUrl = () => {
return `/api/v1/me/assessment-attempts`
}
/**
* Requires the session cookie of a candidate account, the CSRF token of that session in X-CSRF-Token, an allowed Origin, and an Idempotency-Key. The body names the category, a specialization of the questionnaire and a target grade, and the task language. The server picks the mode from the published bank, `demo_basic` or `adaptive`, and fixes the policy, bank, and algorithm versions, the time and session limits, and the item variants in one transaction; the client never sends a mode, a seed, or a version. Creation starts session 1. The self-assessed grade only chooses where the test starts and adds no points. An adaptive retest starts from the previous ability estimate of the specialization, adjusted for the time passed, so a new attempt adds evidence instead of starting the measurement over.
*
* A specialization has at most one active attempt. A new attempt cannot start while one is active, during a retry or promotion interval or past the attempt limit of the policy, or when the bank is insufficient; each answers 409 state_conflict and creates nothing, not even a placeholder attempt. GetMyAssessmentAvailability tells which case applies and when a blocked attempt opens. After a failure, including the first test, a lower grade can be tested at once. An attempt that ends as `expired` or with the reason `practice_incomplete` counts toward the attempt limit and starts the same-grade retry interval; one that ends as `insufficient_bank` or with the reason `sandbox_unavailable` counts toward neither.
*
* The limits are server-side: `expires_at` and `sessions` come from the policy version, the client clock never extends them, and after them the attempt accepts no command. Within them the attempt is also bounded by the item limit of the policy.
*
* Idempotency: a retry with the same key and body within 24 hours replays the stored 201 or 409 state_conflict response and creates nothing, so a lost response never creates a second attempt. A different body with the same key answers 422 idempotency_key_reused. 400 is never stored, so a corrected retry is evaluated again.
*
* Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400), account scenario (403 forbidden for an employer), the Idempotency-Key (422, 409 idempotency_in_progress, replay), domain rules (400 with a pointer, for example `/specialization` for a specialization that is not in the questionnaire or `/task_language` for a language that the bank does not offer), then availability (409 state_conflict). The rate limit can answer 429 with Retry-After before any of them; it is not stored.
* @summary Start an assessment attempt for a category of the current candidate.
*/
export const createMyAssessmentAttempt = async (assessmentAttemptCreate: AssessmentAttemptCreate,
headers: CreateMyAssessmentAttemptHeaders, options?: Parameters<typeof apiRequest>[1]): Promise<AssessmentAttempt> => {
const getHeaders = (h?: NonNullable<RequestInit['headers']>): Record<string, string | readonly string[]> => {
if (!h) return {};
if (h instanceof Headers) return Object.fromEntries(h.entries());
if (Symbol.iterator in h) {
return Object.fromEntries(
Array.from(h as Iterable<Iterable<string>>, (entry) => Array.from(entry) as [string, string]),
);
}
const headers: Record<string, string | readonly string[]> = {};
for (const [name, value] of Object.entries<string | readonly string[] | undefined>(h)) {
if (value !== undefined) headers[name] = value;
}
return headers;
};
return apiRequest<AssessmentAttempt>(getCreateMyAssessmentAttemptUrl(),
{
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json',...headers, ...getHeaders(options?.headers) },
body: JSON.stringify(assessmentAttemptCreate)
}
);}
export const getCreateMyAssessmentAttemptMutationKey = () => ['createMyAssessmentAttempt'] as const;
export const getCreateMyAssessmentAttemptMutationOptions = <TError = ErrorType<Problem>,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createMyAssessmentAttempt>>, TError,CreateMyAssessmentAttemptMutationVariables, TContext>, request?: SecondParameter<typeof apiRequest>}
): UseMutationOptions<Awaited<ReturnType<typeof createMyAssessmentAttempt>>, TError,CreateMyAssessmentAttemptMutationVariables, TContext> => {
const mutationKey = getCreateMyAssessmentAttemptMutationKey();
const {mutation: mutationOptions, request: requestOptions} = options ?
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
options
: {...options, mutation: {...options.mutation, mutationKey}}
: {mutation: { mutationKey, }, request: undefined};
const mutationFn: MutationFunction<Awaited<ReturnType<typeof createMyAssessmentAttempt>>, CreateMyAssessmentAttemptMutationVariables> = (props) => {
const {data,headers} = props ?? {};
return createMyAssessmentAttempt(data,headers,requestOptions)
}
return { mutationFn, ...mutationOptions }}
export type CreateMyAssessmentAttemptMutationResult = NonNullable<Awaited<ReturnType<typeof createMyAssessmentAttempt>>>
export type CreateMyAssessmentAttemptMutationBody = AssessmentAttemptCreate
export type CreateMyAssessmentAttemptMutationError = ErrorType<Problem>
export type CreateMyAssessmentAttemptMutationVariables = {data: AssessmentAttemptCreate;headers: CreateMyAssessmentAttemptHeaders}
/**
* @summary Start an assessment attempt for a category of the current candidate.
*/
export const useCreateMyAssessmentAttempt = <TError = ErrorType<Problem>,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createMyAssessmentAttempt>>, TError,CreateMyAssessmentAttemptMutationVariables, TContext>, request?: SecondParameter<typeof apiRequest>}
, queryClient?: QueryClient): UseMutationResult<
Awaited<ReturnType<typeof createMyAssessmentAttempt>>,
TError,
CreateMyAssessmentAttemptMutationVariables,
TContext
> => {
return useMutation(getCreateMyAssessmentAttemptMutationOptions(options), queryClient);
}
export const getGetMyAssessmentAttemptUrl = (attemptId: string,) => {
return `/api/v1/me/assessment-attempts/${attemptId}`
}
/**
* Requires the session cookie of a candidate account. Returns the attempt with its state, fixed versions, time and session limits, progress, the item to answer now, and the practices. A reload, a retried request, or a new session returns the same item instance with the same text and option order; a lost connection never creates a new attempt. The response never says whether an earlier answer was correct and never contains answer keys, item scores, family or variant identifiers, seeds, hidden checks, or anti-cheat signals.
*
* Reading an active attempt counts as activity: after the previous session ended it starts the next session, and when that would exceed the session limit it starts none and the attempt becomes `expired`. Before it answers, the server commits any transition that is due, with a new version: past `expires_at`, `ready_to_finalize` becomes `completed`, an unsubmitted additional practice is declined and the attempt becomes `completed`, and the other active states become `expired`; a practice still `pending` is graded first. The client polls this operation while a practice is `pending`. Reading a terminal attempt changes nothing.
*
* The attempt must belong to the candidate of the session: an attempt of another candidate answers 404 not_found, the same as an unknown identifier, so identifiers cannot be probed. An employer account answers 403 forbidden; no operation gives an employer the answers or the attempt history.
* @summary Read or resume an assessment attempt of the current candidate.
*/
export const getMyAssessmentAttempt = async (attemptId: string, options?: Parameters<typeof apiRequest>[1]): Promise<AssessmentAttempt> => {
return apiRequest<AssessmentAttempt>(getGetMyAssessmentAttemptUrl(attemptId),
{
...options,
method: 'GET'
}
);}
export const getGetMyAssessmentAttemptQueryKey = (attemptId: string,) => {
return [
`/api/v1/me/assessment-attempts/${attemptId}`
] as const;
}
export const getGetMyAssessmentAttemptQueryOptions = <TData = Awaited<ReturnType<typeof getMyAssessmentAttempt>>, TError = ErrorType<Problem>>(attemptId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMyAssessmentAttempt>>, TError, TData>>, request?: SecondParameter<typeof apiRequest>}
) => {
const {query: queryOptions, request: requestOptions} = options ?? {};
const queryKey = queryOptions?.queryKey ?? getGetMyAssessmentAttemptQueryKey(attemptId);
const queryFn: QueryFunction<Awaited<ReturnType<typeof getMyAssessmentAttempt>>> = ({ signal }) => getMyAssessmentAttempt(attemptId, { signal, ...requestOptions });
return { queryKey, queryFn, enabled: attemptId !== null && attemptId !== undefined, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getMyAssessmentAttempt>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
}
export type GetMyAssessmentAttemptQueryResult = NonNullable<Awaited<ReturnType<typeof getMyAssessmentAttempt>>>
export type GetMyAssessmentAttemptQueryError = ErrorType<Problem>
export function useGetMyAssessmentAttempt<TData = Awaited<ReturnType<typeof getMyAssessmentAttempt>>, TError = ErrorType<Problem>>(
attemptId: string, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMyAssessmentAttempt>>, TError, TData>> & Pick<
DefinedInitialDataOptions<
Awaited<ReturnType<typeof getMyAssessmentAttempt>>,
TError,
Awaited<ReturnType<typeof getMyAssessmentAttempt>>
> , 'initialData'
>, request?: SecondParameter<typeof apiRequest>}
, queryClient?: QueryClient
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetMyAssessmentAttempt<TData = Awaited<ReturnType<typeof getMyAssessmentAttempt>>, TError = ErrorType<Problem>>(
attemptId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMyAssessmentAttempt>>, TError, TData>> & Pick<
UndefinedInitialDataOptions<
Awaited<ReturnType<typeof getMyAssessmentAttempt>>,
TError,
Awaited<ReturnType<typeof getMyAssessmentAttempt>>
> , 'initialData'
>, request?: SecondParameter<typeof apiRequest>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetMyAssessmentAttempt<TData = Awaited<ReturnType<typeof getMyAssessmentAttempt>>, TError = ErrorType<Problem>>(
attemptId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMyAssessmentAttempt>>, TError, TData>>, request?: SecondParameter<typeof apiRequest>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/**
* @summary Read or resume an assessment attempt of the current candidate.
*/
export function useGetMyAssessmentAttempt<TData = Awaited<ReturnType<typeof getMyAssessmentAttempt>>, TError = ErrorType<Problem>>(
attemptId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMyAssessmentAttempt>>, TError, TData>>, request?: SecondParameter<typeof apiRequest>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
const queryOptions = getGetMyAssessmentAttemptQueryOptions(attemptId,options)
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
return withQueryKey(query, queryOptions.queryKey);
}
export const getSubmitMyAssessmentAnswerUrl = (attemptId: string,) => {
return `/api/v1/me/assessment-attempts/${attemptId}/answers`
}
/**
* Requires the session cookie of a candidate account, the CSRF token of that session in X-CSRF-Token, an allowed Origin, and an Idempotency-Key. The body names the item and carries the answer in the format of that item: `choice`, `number`, `string`, `order`, `find_error`, `configuration`, or `practice`. It never carries a score, a duration, or a correctness flag; the server records the times itself and scores the answer with the key of the fixed item instance. Time never enters the ability estimate or the grade decision.
*
* The response is the attempt with the next item to answer. It never says whether the answer was correct. Items are answered in order and each answer is final.
*
* Practice: an answer with format `practice` submits the solution of the main or the additional practice. It is stored, and the sandbox runs it asynchronously against the hidden check groups; the response shows the practice `pending`, and the client polls GetMyAssessmentAttempt for the verdict. Only the score 0-3 and the pass state of each group are shown, never the checks, error output, or seeds. Every outcome caused by the solution, such as a compilation error, a crash, or a time or memory limit, is a `finished` verdict. A `failed` verdict means only that the sandbox infrastructure could not run it; it consumes nothing. After `finished` the practice accepts no other solution, so hidden group results cannot be used to tune it. Debug runs of the candidate's own tests and the public examples are unlimited apart from the sandbox rate limit and never show hidden group results; they are planned as a separate operation.
*
* Repeats and conflicts, per item:
* - A retry with the same Idempotency-Key and body within 24 hours replays the stored response.
* - Sending the answer already stored for the item again, even with a new key or an older `expected_version`, stores nothing, keeps the version, and answers 200 with the current attempt. Each answer format defines equality: sets for `option_ids` and `line_numbers`, the exact sequence for `element_ids`, numeric equality for `number`, identical text without normalization for `text` and `config`, and the same language with identical source for a practice.
* - A different answer for an item that already has one answers 409 state_conflict when `expected_version` is current; with a stale version the version check comes first and answers 412.
* - Exception for a practice whose latest verdict is `failed`: the repeat rule does not apply. A submission with the same or a different solution, with the current `expected_version`, queues it again and advances the version.
*
* Optimistic concurrency: `expected_version` must equal the current attempt version, otherwise the server answers 412 version_conflict and stores nothing; the client reads the attempt again. 412 is the repository status for a stale version, also used by SaveMyQuestionnaire; 409 state_conflict is kept for commands that the attempt state does not allow at the current version.
*
* Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400), account scenario (403 forbidden), the Idempotency-Key (422, 409 idempotency_in_progress, replay), the attempt (404 not_found for an unknown attempt or one of another candidate; the server first commits any due transition such as expiry, and the request counts as activity for the session limit), the repeat of the stored answer (200, skipped for a practice whose latest verdict is `failed`), the version (412), the state (409 state_conflict: the attempt is terminal, the item is not current, the item has a different answer, or the practice verdict is pending or finished), then the answer against the item (400 with a pointer such as `/answer/format` or `/answer/option_ids/0`). Following the Idempotency-Key convention, 404 and 409 state_conflict are stored under the key and replayed; 400, 412, 429, and 5xx are not. The rate limit can answer 429 with Retry-After before any check.
* @summary Answer the current item or submit a practice of an assessment attempt.
*/
export const submitMyAssessmentAnswer = async (attemptId: string,
assessmentAnswerSubmission: AssessmentAnswerSubmission,
headers: SubmitMyAssessmentAnswerHeaders, options?: Parameters<typeof apiRequest>[1]): Promise<AssessmentAttempt> => {
const getHeaders = (h?: NonNullable<RequestInit['headers']>): Record<string, string | readonly string[]> => {
if (!h) return {};
if (h instanceof Headers) return Object.fromEntries(h.entries());
if (Symbol.iterator in h) {
return Object.fromEntries(
Array.from(h as Iterable<Iterable<string>>, (entry) => Array.from(entry) as [string, string]),
);
}
const headers: Record<string, string | readonly string[]> = {};
for (const [name, value] of Object.entries<string | readonly string[] | undefined>(h)) {
if (value !== undefined) headers[name] = value;
}
return headers;
};
return apiRequest<AssessmentAttempt>(getSubmitMyAssessmentAnswerUrl(attemptId),
{
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json',...headers, ...getHeaders(options?.headers) },
body: JSON.stringify(assessmentAnswerSubmission)
}
);}
export const getSubmitMyAssessmentAnswerMutationKey = () => ['submitMyAssessmentAnswer'] as const;
export const getSubmitMyAssessmentAnswerMutationOptions = <TError = ErrorType<Problem>,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof submitMyAssessmentAnswer>>, TError,SubmitMyAssessmentAnswerMutationVariables, TContext>, request?: SecondParameter<typeof apiRequest>}
): UseMutationOptions<Awaited<ReturnType<typeof submitMyAssessmentAnswer>>, TError,SubmitMyAssessmentAnswerMutationVariables, TContext> => {
const mutationKey = getSubmitMyAssessmentAnswerMutationKey();
const {mutation: mutationOptions, request: requestOptions} = options ?
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
options
: {...options, mutation: {...options.mutation, mutationKey}}
: {mutation: { mutationKey, }, request: undefined};
const mutationFn: MutationFunction<Awaited<ReturnType<typeof submitMyAssessmentAnswer>>, SubmitMyAssessmentAnswerMutationVariables> = (props) => {
const {attemptId,data,headers} = props ?? {};
return submitMyAssessmentAnswer(attemptId,data,headers,requestOptions)
}
return { mutationFn, ...mutationOptions }}
export type SubmitMyAssessmentAnswerMutationResult = NonNullable<Awaited<ReturnType<typeof submitMyAssessmentAnswer>>>
export type SubmitMyAssessmentAnswerMutationBody = AssessmentAnswerSubmission
export type SubmitMyAssessmentAnswerMutationError = ErrorType<Problem>
export type SubmitMyAssessmentAnswerMutationVariables = {attemptId: string;data: AssessmentAnswerSubmission;headers: SubmitMyAssessmentAnswerHeaders}
/**
* @summary Answer the current item or submit a practice of an assessment attempt.
*/
export const useSubmitMyAssessmentAnswer = <TError = ErrorType<Problem>,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof submitMyAssessmentAnswer>>, TError,SubmitMyAssessmentAnswerMutationVariables, TContext>, request?: SecondParameter<typeof apiRequest>}
, queryClient?: QueryClient): UseMutationResult<
Awaited<ReturnType<typeof submitMyAssessmentAnswer>>,
TError,
SubmitMyAssessmentAnswerMutationVariables,
TContext
> => {
return useMutation(getSubmitMyAssessmentAnswerMutationOptions(options), queryClient);
}
export const getFinalizeMyAssessmentAttemptUrl = (attemptId: string,) => {
return `/api/v1/me/assessment-attempts/${attemptId}/finalize`
}
/**
* Requires the session cookie of a candidate account, the CSRF token of that session in X-CSRF-Token, an allowed Origin, and an Idempotency-Key. Finalize always answers with the attempt, never with the result: the decision may continue the attempt, and one response type keeps that unambiguous for every generated client. When the returned state is `completed`, the client reads the result with GetMyAssessmentResult.
*
* Allowed in `ready_to_finalize`, where every required part is done, and in `additional_practice_pending` while the additional practice is `not_started` or `failed`. The server decides from the stored answers with the policy, bank, and algorithm versions fixed at creation:
* - `demo_basic` compares the raw score with the pass mark of the recorded basic grading policy and completes the attempt. It never offers an additional practice.
* - `adaptive` applies the probability bands of the recorded policy. Confirmation or rejection completes the attempt. A probability in the band below confirmation (0.50 to below 0.80 in the demo policy) on the first finalize, while time and sessions remain, completes nothing: the server appends an `additional` practice, moves the attempt to `additional_practice_pending`, and answers 200 with it. The additional practice continues the same attempt, keeps its limits, and spends no new attempt. The next finalize, after its verdict, decides with the added evidence; a probability still below confirmation gives `not_confirmed`. An attempt offers at most one additional practice.
* - Finalize in `additional_practice_pending` declines the offer and gives `not_confirmed` with the current evidence. A retry of the first finalize with a new key cannot decline by accident: it carries the version from before the offer and answers 412.
*
* A failed attempt never lowers a confirmed grade. Repeats return the same outcome: a retry with the same Idempotency-Key replays the stored response, and a finalize of a `completed` attempt answers 200 with that attempt even with a new key or an older `expected_version`; the result is computed once. When `expires_at` passes or the session limit is reached, the server finalizes `ready_to_finalize` itself, without offering an additional practice, so a finalize after that also answers 200 with the `completed` attempt.
*
* An attempt in `in_progress` or `practice_pending`, one with a practice verdict `pending`, or one that ended as `expired` or `insufficient_bank` answers 409 state_conflict. The problem does not list what is unfinished; the attempt shows it in `state`, `progress`, `current_item`, and `practices`. A stale `expected_version` answers 412 version_conflict, the repository status for a stale version.
*
* Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400), account scenario (403 forbidden), the Idempotency-Key (422, 409 idempotency_in_progress, replay), the attempt (404 not_found, after any due transition), the repeat on a `completed` attempt (200), the version (412), then the state (409 state_conflict). 404 and 409 state_conflict are stored under the key; 400 and 412 are not.
* @summary Ask for the grade decision of an assessment attempt.
*/
export const finalizeMyAssessmentAttempt = async (attemptId: string,
assessmentFinalization: AssessmentFinalization,
headers: FinalizeMyAssessmentAttemptHeaders, options?: Parameters<typeof apiRequest>[1]): Promise<AssessmentAttempt> => {
const getHeaders = (h?: NonNullable<RequestInit['headers']>): Record<string, string | readonly string[]> => {
if (!h) return {};
if (h instanceof Headers) return Object.fromEntries(h.entries());
if (Symbol.iterator in h) {
return Object.fromEntries(
Array.from(h as Iterable<Iterable<string>>, (entry) => Array.from(entry) as [string, string]),
);
}
const headers: Record<string, string | readonly string[]> = {};
for (const [name, value] of Object.entries<string | readonly string[] | undefined>(h)) {
if (value !== undefined) headers[name] = value;
}
return headers;
};
return apiRequest<AssessmentAttempt>(getFinalizeMyAssessmentAttemptUrl(attemptId),
{
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json',...headers, ...getHeaders(options?.headers) },
body: JSON.stringify(assessmentFinalization)
}
);}
export const getFinalizeMyAssessmentAttemptMutationKey = () => ['finalizeMyAssessmentAttempt'] as const;
export const getFinalizeMyAssessmentAttemptMutationOptions = <TError = ErrorType<Problem>,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof finalizeMyAssessmentAttempt>>, TError,FinalizeMyAssessmentAttemptMutationVariables, TContext>, request?: SecondParameter<typeof apiRequest>}
): UseMutationOptions<Awaited<ReturnType<typeof finalizeMyAssessmentAttempt>>, TError,FinalizeMyAssessmentAttemptMutationVariables, TContext> => {
const mutationKey = getFinalizeMyAssessmentAttemptMutationKey();
const {mutation: mutationOptions, request: requestOptions} = options ?
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
options
: {...options, mutation: {...options.mutation, mutationKey}}
: {mutation: { mutationKey, }, request: undefined};
const mutationFn: MutationFunction<Awaited<ReturnType<typeof finalizeMyAssessmentAttempt>>, FinalizeMyAssessmentAttemptMutationVariables> = (props) => {
const {attemptId,data,headers} = props ?? {};
return finalizeMyAssessmentAttempt(attemptId,data,headers,requestOptions)
}
return { mutationFn, ...mutationOptions }}
export type FinalizeMyAssessmentAttemptMutationResult = NonNullable<Awaited<ReturnType<typeof finalizeMyAssessmentAttempt>>>
export type FinalizeMyAssessmentAttemptMutationBody = AssessmentFinalization
export type FinalizeMyAssessmentAttemptMutationError = ErrorType<Problem>
export type FinalizeMyAssessmentAttemptMutationVariables = {attemptId: string;data: AssessmentFinalization;headers: FinalizeMyAssessmentAttemptHeaders}
/**
* @summary Ask for the grade decision of an assessment attempt.
*/
export const useFinalizeMyAssessmentAttempt = <TError = ErrorType<Problem>,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof finalizeMyAssessmentAttempt>>, TError,FinalizeMyAssessmentAttemptMutationVariables, TContext>, request?: SecondParameter<typeof apiRequest>}
, queryClient?: QueryClient): UseMutationResult<
Awaited<ReturnType<typeof finalizeMyAssessmentAttempt>>,
TError,
FinalizeMyAssessmentAttemptMutationVariables,
TContext
> => {
return useMutation(getFinalizeMyAssessmentAttemptMutationOptions(options), queryClient);
}
export const getGetMyAssessmentResultUrl = (attemptId: string,) => {
return `/api/v1/me/assessment-attempts/${attemptId}/result`
}
/**
* Requires the session cookie of a candidate account. Returns the immutable result of a terminal attempt: `completed`, `expired`, or `insufficient_bank`. It records the mode, the policy, bank, and algorithm versions, the decision, the previously confirmed grade, the calibration status and limitations of the method, the uncertainty where the method computes it, the practice verdicts, the weak domains, the working time as a separate label, and the next steps that the server allows. A later policy, bank, or algorithm version never changes it.
*
* Fields that the method does not compute are null and never zero: a `demo_basic` result has null `uncertainty` and `strength`. The result never contains answers, per-item correctness, answer keys, seeds, hidden checks, or anti-cheat signals.
*
* An active attempt answers 409 state_conflict; an attempt in `additional_practice_pending` is active and has no result yet. The server first commits any due transition, so an attempt past its limits is read as terminal. An attempt of another candidate answers 404 not_found, the same as an unknown identifier. An employer account answers 403 forbidden; employers see only the current category through a separate projection, never this result or the attempt history.
* @summary Read the result of an assessment attempt of the current candidate.
*/
export const getMyAssessmentResult = async (attemptId: string, options?: Parameters<typeof apiRequest>[1]): Promise<AssessmentResult> => {
return apiRequest<AssessmentResult>(getGetMyAssessmentResultUrl(attemptId),
{
...options,
method: 'GET'
}
);}
export const getGetMyAssessmentResultQueryKey = (attemptId: string,) => {
return [
`/api/v1/me/assessment-attempts/${attemptId}/result`
] as const;
}
export const getGetMyAssessmentResultQueryOptions = <TData = Awaited<ReturnType<typeof getMyAssessmentResult>>, TError = ErrorType<Problem>>(attemptId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMyAssessmentResult>>, TError, TData>>, request?: SecondParameter<typeof apiRequest>}
) => {
const {query: queryOptions, request: requestOptions} = options ?? {};
const queryKey = queryOptions?.queryKey ?? getGetMyAssessmentResultQueryKey(attemptId);
const queryFn: QueryFunction<Awaited<ReturnType<typeof getMyAssessmentResult>>> = ({ signal }) => getMyAssessmentResult(attemptId, { signal, ...requestOptions });
return { queryKey, queryFn, enabled: attemptId !== null && attemptId !== undefined, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getMyAssessmentResult>>, TError, TData> & { queryKey: DataTag<QueryKey, TData, TError> }
}
export type GetMyAssessmentResultQueryResult = NonNullable<Awaited<ReturnType<typeof getMyAssessmentResult>>>
export type GetMyAssessmentResultQueryError = ErrorType<Problem>
export function useGetMyAssessmentResult<TData = Awaited<ReturnType<typeof getMyAssessmentResult>>, TError = ErrorType<Problem>>(
attemptId: string, options: { query:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMyAssessmentResult>>, TError, TData>> & Pick<
DefinedInitialDataOptions<
Awaited<ReturnType<typeof getMyAssessmentResult>>,
TError,
Awaited<ReturnType<typeof getMyAssessmentResult>>
> , 'initialData'
>, request?: SecondParameter<typeof apiRequest>}
, queryClient?: QueryClient
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetMyAssessmentResult<TData = Awaited<ReturnType<typeof getMyAssessmentResult>>, TError = ErrorType<Problem>>(
attemptId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMyAssessmentResult>>, TError, TData>> & Pick<
UndefinedInitialDataOptions<
Awaited<ReturnType<typeof getMyAssessmentResult>>,
TError,
Awaited<ReturnType<typeof getMyAssessmentResult>>
> , 'initialData'
>, request?: SecondParameter<typeof apiRequest>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
export function useGetMyAssessmentResult<TData = Awaited<ReturnType<typeof getMyAssessmentResult>>, TError = ErrorType<Problem>>(
attemptId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMyAssessmentResult>>, TError, TData>>, request?: SecondParameter<typeof apiRequest>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> }
/**
* @summary Read the result of an assessment attempt of the current candidate.
*/
export function useGetMyAssessmentResult<TData = Awaited<ReturnType<typeof getMyAssessmentResult>>, TError = ErrorType<Problem>>(
attemptId: string, options?: { query?:Partial<UseQueryOptions<Awaited<ReturnType<typeof getMyAssessmentResult>>, TError, TData>>, request?: SecondParameter<typeof apiRequest>}
, queryClient?: QueryClient
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
const queryOptions = getGetMyAssessmentResultQueryOptions(attemptId,options)
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
return withQueryKey(query, queryOptions.queryKey);
}
@@ -1,3 +1,4 @@
export { getAssessmentMock } from './assessment/assessment.msw'
export { getCandidateMock } from './candidate/candidate.msw'
export { getCatalogMock } from './catalog/catalog.msw'
export { getHealthMock } from './health/health.msw'
@@ -1,3 +1,4 @@
export * from './assessment/assessment';
export * from './candidate/candidate';
export * from './catalog/catalog';
export * from './health/health';