642 lines
45 KiB
Go
642 lines
45 KiB
Go
// Code generated by ogen, DO NOT EDIT.
|
|
|
|
package api
|
|
|
|
import (
|
|
"context"
|
|
)
|
|
|
|
// Handler handles operations described by OpenAPI v3 specification.
|
|
type Handler interface {
|
|
// ConfirmEmail implements ConfirmEmail operation.
|
|
//
|
|
// Public operation without a session. The verification link has the form
|
|
// `<frontend origin>/verify-email#token=<token>`: the token travels in the URL fragment, so it never
|
|
// reaches a server log or a Referer header. The page first removes the fragment with
|
|
// `history.replaceState`, then waits for an explicit user action, such as a Confirm button, before it
|
|
// posts the token here. A link scanner that only fetches the page therefore does not consume the
|
|
// token.
|
|
//
|
|
// The server looks up the token by its hash and, in one transaction, checks that it is unused, not
|
|
// expired, and bound to the current registration version, marks it used, and marks the email verified.
|
|
// Only one of several parallel requests with the same token succeeds. An expired token answers
|
|
// verification_token_expired; an unknown, used, replaced, or superseded token answers
|
|
// verification_token_invalid; neither changes anything. For both, the client offers a new link and
|
|
// sign-in, because the address may already be verified.
|
|
//
|
|
// A repeated confirmation with an already used token is not an idempotent 200: exactly one request may
|
|
// succeed for a token, so the outcome of parallel requests stays unambiguous, and the next step after
|
|
// either outcome is sign-in anyway.
|
|
//
|
|
// Success does not start a session: the link may be opened on another device or by a mail scanner, and
|
|
// a session must come only from the password. The response returns the scenario and the saved
|
|
// onboarding step so the client can continue after sign-in. The operation is rate-limited and requires
|
|
// an allowed Origin.
|
|
//
|
|
// POST /api/v1/identity/email-verifications
|
|
ConfirmEmail(ctx context.Context, req *EmailVerificationRequest) (ConfirmEmailRes, error)
|
|
// CreateMyAssessmentAttempt implements CreateMyAssessmentAttempt operation.
|
|
//
|
|
// 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.
|
|
//
|
|
// POST /api/v1/me/assessment-attempts
|
|
CreateMyAssessmentAttempt(ctx context.Context, req *AssessmentAttemptCreate, params CreateMyAssessmentAttemptParams) (CreateMyAssessmentAttemptRes, error)
|
|
// CreateOrganizationNeed implements CreateOrganizationNeed operation.
|
|
//
|
|
// Requires the session cookie of an employer account with an active membership in `org_id`, the CSRF
|
|
// token of that session in X-CSRF-Token, an allowed Origin, and an Idempotency-Key. The organization
|
|
// comes from the path and the server-side membership; the body has no organization, membership, or
|
|
// role field. In the MVP only the owner of the organization may create a need; the other roles of PRD
|
|
// FR07 are planned.
|
|
//
|
|
// A need does not require a vacancy: `vacancy_id` is optional and nullable. When it is given, it must
|
|
// name a vacancy of the same organization; until vacancies exist in the contract, any vacancy
|
|
// identifier answers 400 with the pointer `/vacancy_id`, the same for an unknown vacancy and one of
|
|
// another organization.
|
|
//
|
|
// Only `title` is required. A field is sent as a decision `{value, status}` and a list item as
|
|
// `{name or text, status}`; on creation the status must be `confirmed`, and the value becomes a
|
|
// confirmed manual value. When `source_text` is given, the server extracts suggestions for the absent
|
|
// fields with deterministic rules and a dictionary before it answers, so creation works while the ML
|
|
// service is disabled; every suggestion has the status `extracted`, the origin extracted_from_text, a
|
|
// quote where the extractor found one, and the extractor version, and it waits for a member to confirm
|
|
// it. A field that the text does not state stays `unknown` with null value and source; the server
|
|
// never guesses a grade, a format, or a salary. ML suggestions with quotes are planned as an
|
|
// asynchronous addition that creates a new version and never overwrites a confirmed value.
|
|
//
|
|
// The need is saved even when critical fields are missing: the response is 201 with version 1, and
|
|
// `readiness.missing_fields` names each critical field without a confirmed value with a specific
|
|
// question. `recommendations` is computed by the server from the confirmed requirements only; the
|
|
// request cannot set a recommendation, its score, or its components. Creating a need never contacts a
|
|
// candidate or sends an invitation.
|
|
//
|
|
// Salary limit: setting a salary range counts against a limit shared by the whole organization, every
|
|
// member and every need, on creation as on a change: at most three range settings a day (PRD FR13,
|
|
// planned in TASK-211). Over the limit the server answers 429 with Retry-After and creates nothing.
|
|
// After five settings within seven days the money component of the recommendations is `withheld` for
|
|
// seven days. The limit keeps an organization from probing hidden candidate minimums with new needs
|
|
// instead of edits; repeated range changes also feed the private risk signals of TASK-319.
|
|
//
|
|
// Idempotency: a retry with the same key and body within 24 hours replays the stored 201 and creates
|
|
// nothing, so a lost response never creates a second need. 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 a candidate), membership (404 not_found) and role (403
|
|
// forbidden), the Idempotency-Key (422, 409 idempotency_in_progress, replay), domain rules (400 with a
|
|
// pointer: `/salary/value/salary_to` for a range whose lower bound is not below the upper one or whose
|
|
// width is outside 10-40%, `/required_skills/1/name` for a repeated skill, `/grade/status` or
|
|
// `/required_skills/0/status` for `extracted`, which a new need cannot have, or `/vacancy_id`), then
|
|
// the salary limit (429). The schema already rejects unknown fields such as `rec_score`, `members`, or
|
|
// `candidate_minimum`, a field sent as a bare value instead of `{value, status}`, a salary bound that
|
|
// is not a positive multiple of 1000, and an unknown currency, period, or tax basis. The general rate
|
|
// limit can answer 429 with Retry-After before any check. 429 is never stored.
|
|
//
|
|
// POST /api/v1/organizations/{org_id}/needs
|
|
CreateOrganizationNeed(ctx context.Context, req *NeedCreate, params CreateOrganizationNeedParams) (CreateOrganizationNeedRes, error)
|
|
// FinalizeMyAssessmentAttempt implements FinalizeMyAssessmentAttempt operation.
|
|
//
|
|
// 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.
|
|
//
|
|
// POST /api/v1/me/assessment-attempts/{attempt_id}/finalize
|
|
FinalizeMyAssessmentAttempt(ctx context.Context, req *AssessmentFinalization, params FinalizeMyAssessmentAttemptParams) (FinalizeMyAssessmentAttemptRes, error)
|
|
// GetConsentText implements GetConsentText operation.
|
|
//
|
|
// Public operation without a session. Returns the current text of a consent that is given before an
|
|
// account exists; only `c1` is available. The registration page shows this text and sends its
|
|
// `text_version` with RegisterAccount, and the server hashes the same stored text when it records the
|
|
// acceptance. If the text changes while the page is open, RegisterAccount answers 400
|
|
// validation_failed with the pointer `/consent_c1/text_version`, and the page reads the text again. An
|
|
// unknown purpose fails parameter validation with 400.
|
|
//
|
|
// GET /api/v1/identity/consent-texts/{purpose}
|
|
GetConsentText(ctx context.Context, params GetConsentTextParams) (GetConsentTextRes, error)
|
|
// GetCurrentAccount implements GetCurrentAccount operation.
|
|
//
|
|
// Requires the session cookie. The account comes from the session, never from a request parameter. The
|
|
// client uses `scenario` and `onboarding_step` to return the user to the unfinished onboarding step. A
|
|
// missing, unknown, expired, or revoked session answers 401 unauthenticated. An unverified account
|
|
// never has a session, because login answers 403 email_not_verified for it, so this operation also
|
|
// answers 401 for such an account.
|
|
//
|
|
// GET /api/v1/identity/me
|
|
GetCurrentAccount(ctx context.Context) (GetCurrentAccountRes, error)
|
|
// GetCurrentSession implements GetCurrentSession operation.
|
|
//
|
|
// Requires the session cookie. Returns the account and the CSRF token of the current session, so the
|
|
// client can restore the token after a page reload or after 403 csrf_check_failed. A missing, unknown,
|
|
// expired, or revoked session answers 401 unauthenticated. Cross-origin pages cannot read the token,
|
|
// because the API sends no Access-Control-Allow-Origin header.
|
|
//
|
|
// GET /api/v1/identity/sessions/current
|
|
GetCurrentSession(ctx context.Context) (GetCurrentSessionRes, error)
|
|
// GetHealthz implements GetHealthz operation.
|
|
//
|
|
// Check whether the API process is responding.
|
|
//
|
|
// GET /api/v1/healthz
|
|
GetHealthz(ctx context.Context) (*HealthResponse, error)
|
|
// GetMyAssessmentAttempt implements GetMyAssessmentAttempt operation.
|
|
//
|
|
// 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.
|
|
//
|
|
// GET /api/v1/me/assessment-attempts/{attempt_id}
|
|
GetMyAssessmentAttempt(ctx context.Context, params GetMyAssessmentAttemptParams) (GetMyAssessmentAttemptRes, error)
|
|
// GetMyAssessmentAvailability implements GetMyAssessmentAvailability operation.
|
|
//
|
|
// 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.
|
|
//
|
|
// GET /api/v1/me/assessment-availability
|
|
GetMyAssessmentAvailability(ctx context.Context) (GetMyAssessmentAvailabilityRes, error)
|
|
// GetMyAssessmentResult implements GetMyAssessmentResult operation.
|
|
//
|
|
// 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.
|
|
//
|
|
// GET /api/v1/me/assessment-attempts/{attempt_id}/result
|
|
GetMyAssessmentResult(ctx context.Context, params GetMyAssessmentResultParams) (GetMyAssessmentResultRes, error)
|
|
// GetMyQuestionnaire implements GetMyQuestionnaire operation.
|
|
//
|
|
// Requires the session cookie of a candidate account. The candidate comes from the session, never from
|
|
// a request parameter. A candidate who has not saved the questionnaire yet gets 200 with version 0 and
|
|
// no specializations rather than 404, so the client reads the version for the first save in the same
|
|
// way as for later ones and a missing questionnaire is not an error state.
|
|
//
|
|
// The response never contains a confirmed grade or a category; those come only from assessment
|
|
// results. A missing, unknown, expired, or revoked session answers 401 unauthenticated; an employer
|
|
// account answers 403 forbidden.
|
|
//
|
|
// GET /api/v1/me/questionnaire
|
|
GetMyQuestionnaire(ctx context.Context) (GetMyQuestionnaireRes, error)
|
|
// GetOrganizationNeed implements GetOrganizationNeed operation.
|
|
//
|
|
// Requires the session cookie of an employer account with an active membership in `org_id`. The
|
|
// organization and the role come from the server-side membership, never from the request. In the MVP
|
|
// only the owner of the organization reads needs; the other roles of PRD FR07 are planned.
|
|
//
|
|
// Returns the current version of the need: `version`, the requirements with the confirmation state and
|
|
// provenance of each field (`status`, and `source` with the origin, the quote, the version whose text
|
|
// the quote belongs to, and the extractor version), the readiness with `missing_fields`, and the
|
|
// category recommendations of the server. A field with status `unknown` has null value and source; an
|
|
// `extracted` value is a suggestion that waits for confirmation and never feeds search or
|
|
// recommendations.
|
|
//
|
|
// Versions: every committed change creates a new immutable `version`, and this operation always
|
|
// returns the latest one. `requirements_version` is the version in which the confirmed requirements
|
|
// were last changed; a change of the title, the vacancy link, the text, or suggestions only keeps it.
|
|
// Search runs, selection snapshots, and invitations refer to a need by its identifier and
|
|
// `requirements_version`, so they keep the requirements they used, and only a new
|
|
// `requirements_version` calls for a new selection snapshot. Reading and comparing earlier versions
|
|
// (PRD FR10) are planned as separate operations that return the same NeedRequirementSet for a given
|
|
// version; they add no field here.
|
|
//
|
|
// Access: a missing, unknown, expired, or revoked session answers 401 unauthenticated; a candidate
|
|
// account answers 403 forbidden; an account without an active membership in the organization, an
|
|
// unknown organization, an unknown need, and a need of another organization all answer 404 not_found,
|
|
// so identifiers cannot be probed; a member whose role does not allow reading the need answers 403
|
|
// forbidden. An `org_id` or `need_id` that is not a UUID answers 400 validation_failed with the path
|
|
// pointer.
|
|
//
|
|
// GET /api/v1/organizations/{org_id}/needs/{need_id}
|
|
GetOrganizationNeed(ctx context.Context, params GetOrganizationNeedParams) (GetOrganizationNeedRes, error)
|
|
// GetSpecializationCatalog implements GetSpecializationCatalog operation.
|
|
//
|
|
// Public operation without a session. Returns the directions with their specializations, the
|
|
// assessment availability of each specialization, and the grade scale. The candidate picks
|
|
// specializations and self-assessed grades from this catalog for the questionnaire, and the client
|
|
// joins the codes stored in the questionnaire with the titles here.
|
|
//
|
|
// The catalog is public because it is the same for every caller and contains no personal data: the
|
|
// product shows it before registration, and a public read lets intermediaries and the browser cache
|
|
// it. It reveals nothing beyond what the landing pages already show.
|
|
//
|
|
// A category is a specialization together with a confirmed grade. Task languages and the stack are
|
|
// attributes of a chosen specialization and never appear as categories. `test_availability` is derived
|
|
// from the published task banks at the time of the request, so it changes when a bank is published,
|
|
// without a contract change: the MVP opens an assessment only for a category with a published bank,
|
|
// and every other specialization is marked `in_development`. Presence in the catalog never means that
|
|
// its test is ready.
|
|
//
|
|
// GET /api/v1/specializations
|
|
GetSpecializationCatalog(ctx context.Context) (*SpecializationCatalog, error)
|
|
// ListOrganizationNeeds implements ListOrganizationNeeds operation.
|
|
//
|
|
// Requires the session cookie of an employer account with an active membership in `org_id`. The
|
|
// organization and the role come from the membership that the server holds for the session account,
|
|
// never from the request. In the MVP only the owner of the organization works with needs; the other
|
|
// roles of the PRD FR07 matrix (recruiter, hiring manager and technical expert for assigned needs) are
|
|
// planned and change no field of this contract. The list holds only the needs that the role may read.
|
|
//
|
|
// Returns a page of need summaries, newest first by creation time with the identifier as the
|
|
// tie-breaker, with cursor pagination. A summary has the current version, the target specialization
|
|
// and grade with their confirmation state, and the readiness; GetOrganizationNeed returns the
|
|
// requirements and the recommendations.
|
|
//
|
|
// Access: a missing, unknown, expired, or revoked session answers 401 unauthenticated; a candidate
|
|
// account answers 403 forbidden; an account without an active membership in the organization and an
|
|
// unknown organization both answer 404 not_found, so organizations cannot be enumerated; a member
|
|
// whose role does not allow reading needs answers 403 forbidden. A malformed `org_id`, `limit`, or
|
|
// `cursor` answers 400 validation_failed.
|
|
//
|
|
// GET /api/v1/organizations/{org_id}/needs
|
|
ListOrganizationNeeds(ctx context.Context, params ListOrganizationNeedsParams) (ListOrganizationNeedsRes, error)
|
|
// Login implements Login operation.
|
|
//
|
|
// Public operation that starts a server session. The server verifies the password with Argon2id; for
|
|
// an unknown email it verifies against a fixed dummy hash, so the response time does not reveal
|
|
// whether the account exists. An unknown email and a wrong password both answer 401
|
|
// invalid_credentials.
|
|
//
|
|
// Correct credentials for an unverified email answer 403 email_not_verified and create no session.
|
|
// This reveals the verification state only to someone who already knows the password, which proves
|
|
// more than the state itself; the client offers to resend the link.
|
|
//
|
|
// On success the server revokes the session that the request carried, if any, creates a new random
|
|
// session in PostgreSQL with a new identifier and a new CSRF token, sets the HttpOnly session cookie,
|
|
// and returns the account and the CSRF token. The new session follows the idle and absolute timeouts
|
|
// of the sessionCookie scheme. The client keeps the token in memory and sends it in X-CSRF-Token with
|
|
// every mutating request that requires a session.
|
|
//
|
|
// Login is rate-limited per client and per email and answers 429 with Retry-After. Like every unsafe
|
|
// request, it requires an allowed Origin, which protects against login CSRF, and answers 403
|
|
// csrf_check_failed otherwise.
|
|
//
|
|
// POST /api/v1/identity/sessions
|
|
Login(ctx context.Context, req *LoginRequest) (LoginRes, error)
|
|
// Logout implements Logout operation.
|
|
//
|
|
// Requires the session cookie and the CSRF token of that session in X-CSRF-Token, and an allowed
|
|
// Origin. The server revokes the session in PostgreSQL, so the cookie value stops working even if a
|
|
// copy remains, and clears the cookie. A missing, expired, or revoked session answers 401
|
|
// unauthenticated and also clears the cookie, so a stale cookie does not stay in the browser; a
|
|
// missing or wrong CSRF token or a disallowed Origin answers 403 csrf_check_failed and keeps the
|
|
// session and the cookie. The client clears its private query cache after the response.
|
|
//
|
|
// DELETE /api/v1/identity/sessions/current
|
|
Logout(ctx context.Context) (LogoutRes, error)
|
|
// RegisterAccount implements RegisterAccount operation.
|
|
//
|
|
// Public operation without a session. The client reads the current C1 text with GetConsentText and
|
|
// sends the email, the password, the chosen scenario, and consent C1 with the version of the text the
|
|
// user accepted.
|
|
//
|
|
// The answer is the same 202 whether the email is new, registered but not verified, or verified, so
|
|
// registration does not enumerate accounts:
|
|
//
|
|
// - New email: the server creates an unverified account with the scenario and the first onboarding
|
|
// step, records C1 with its text version and text hash, stores only the hash of a one-time
|
|
// verification token, and queues the verification message, all in one transaction.
|
|
// - Registered but not verified: the server treats the request as a new registration of that address.
|
|
// In one transaction it replaces the password hash, the scenario, the onboarding step, and the C1
|
|
// record, advances the registration version, invalidates every earlier verification token, and
|
|
// queues a message with a new token. A pre-registration with someone else's password therefore
|
|
// never survives the address owner's own registration.
|
|
// - Verified: nothing changes. The server may queue a rate-limited "you already have an account"
|
|
// notice to the address.
|
|
//
|
|
// Every verification token is bound to the registration version it was issued for, so a token issued
|
|
// before a re-registration can never confirm the newer credentials. An account that stays unverified
|
|
// is deleted with its consent record and tokens 7 days after its last registration (planned value from
|
|
// configuration). Verification tokens live 24 hours (planned value from configuration).
|
|
//
|
|
// The response does not depend on the branch in content or timing. Before it looks up the email, the
|
|
// server validates the whole body, including the password bounds after normalization, the password
|
|
// blocklist, and the C1 version, and it computes the Argon2id hash on every branch; a 400 therefore
|
|
// never depends on whether the email exists. Mail is delivered asynchronously from the outbox.
|
|
//
|
|
// The operation requires Idempotency-Key. For this anonymous operation the key is scoped by the
|
|
// operation, the key, and an HMAC of the normalized email, and the request fingerprint is an
|
|
// HMAC-SHA-256 with a server secret over the canonical JSON body. The server never stores the body,
|
|
// the password, or a plain hash of either; the secret keeps the fingerprint from serving as an offline
|
|
// password check. A retry with the same key, email, and body replays the stored 202 without a second
|
|
// message; the same key and email with a different body answers 422 idempotency_key_reused.
|
|
//
|
|
// It is rate-limited per client and per email and answers 429 with Retry-After when the limit is
|
|
// reached. Like every unsafe request, it requires an allowed Origin and answers 403 csrf_check_failed
|
|
// otherwise.
|
|
//
|
|
// POST /api/v1/identity/registrations
|
|
RegisterAccount(ctx context.Context, req *RegistrationRequest, params RegisterAccountParams) (RegisterAccountRes, error)
|
|
// ResendEmailVerification implements ResendEmailVerification operation.
|
|
//
|
|
// Public operation without a session. The answer is the same 202 for an unknown email, a verified
|
|
// email, and an unverified one, so it does not enumerate accounts. Only for an unverified account does
|
|
// the server issue a new one-time token bound to the current registration version, invalidate every
|
|
// earlier token of that account, and queue the message. Resend never changes the password, the
|
|
// scenario, or the consent record; a user who did not start the pending registration registers again
|
|
// instead, which replaces it.
|
|
//
|
|
// It is rate-limited per client and per email and answers 429 with Retry-After when the limit is
|
|
// reached. A retry is safe without Idempotency-Key: at worst it replaces the token again within the
|
|
// rate limit. Like every unsafe request, it requires an allowed Origin and answers 403
|
|
// csrf_check_failed otherwise.
|
|
//
|
|
// POST /api/v1/identity/email-verification-requests
|
|
ResendEmailVerification(ctx context.Context, req *EmailVerificationResendRequest) (ResendEmailVerificationRes, error)
|
|
// SaveMyQuestionnaire implements SaveMyQuestionnaire operation.
|
|
//
|
|
// Requires the session cookie of a candidate account, the CSRF token of that session in X-CSRF-Token,
|
|
// and an allowed Origin. The body is the complete new state: one or two specializations, each with a
|
|
// self-assessed grade, task languages, stack tags, and stated experience or null, and the working
|
|
// context. It replaces the stored questionnaire as a whole.
|
|
//
|
|
// Self-assessment is a claim. It influences where the assessment starts and which grade the assessment
|
|
// step offers first, but it adds no points and never writes a confirmed grade or a category: a
|
|
// self-assessed `senior`, or the word "Senior" in a stack tag, never assigns the Senior category. A
|
|
// real profile stays invisible to employers until an assessment confirms a category. Choosing a
|
|
// specialization whose test is `in_development` is allowed; no assessment starts for it until its bank
|
|
// is published. Removing a specialization from the questionnaire does not change assessment results.
|
|
//
|
|
// Optimistic concurrency uses `expected_version` in the body: the client sends the `version` it read,
|
|
// 0 for the first save. If it is not the current version, the server answers 412 version_conflict and
|
|
// changes nothing; the client reads the questionnaire again. The version travels in the body rather
|
|
// than in If-Match because the generated client cannot read the ETag response header yet. The status
|
|
// and code are the same as for a failed If-Match, since the client action is the same.
|
|
//
|
|
// The operation needs no Idempotency-Key: it replaces the whole state and is idempotent. A body whose
|
|
// specializations and working context equal the stored ones changes nothing, keeps the version, and
|
|
// answers 200 with the current questionnaire even when `expected_version` is older, so a retry after a
|
|
// lost response of a successful save succeeds instead of failing with 412.
|
|
//
|
|
// Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400),
|
|
// account scenario (403 forbidden for an employer), domain rules (400), then the version (412). The
|
|
// schema rejects more than two specializations, an unknown grade, specialization, or task language,
|
|
// and unknown fields. The server also rejects a repeated specialization and a task language that the
|
|
// specialization's published bank does not offer, with 400 validation_failed and pointers to the
|
|
// items, for example `/specializations/1/specialization` or `/specializations/0/task_languages/0`.
|
|
//
|
|
// A successful save on the onboarding step candidate_questionnaire advances the account to
|
|
// candidate_assessment (planned).
|
|
//
|
|
// PUT /api/v1/me/questionnaire
|
|
SaveMyQuestionnaire(ctx context.Context, req *CandidateQuestionnaireUpdate) (SaveMyQuestionnaireRes, error)
|
|
// SubmitMyAssessmentAnswer implements SubmitMyAssessmentAnswer operation.
|
|
//
|
|
// 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.
|
|
//
|
|
// POST /api/v1/me/assessment-attempts/{attempt_id}/answers
|
|
SubmitMyAssessmentAnswer(ctx context.Context, req *AssessmentAnswerSubmission, params SubmitMyAssessmentAnswerParams) (SubmitMyAssessmentAnswerRes, error)
|
|
// UpdateOrganizationNeed implements UpdateOrganizationNeed operation.
|
|
//
|
|
// Requires the session cookie of an employer account with an active membership in `org_id`, the CSRF
|
|
// token of that session in X-CSRF-Token, and an allowed Origin. The organization and the role come
|
|
// from the server-side membership; the body has no organization, membership, or role field. In the MVP
|
|
// only the owner of the organization changes needs; the technical expert, who may refine the
|
|
// requirements of assigned needs under PRD FR07, is planned.
|
|
//
|
|
// Merge rules: the body is `application/json` with explicit field replacement, not JSON Merge Patch.
|
|
// Each field present replaces that field as a whole and an absent field stays unchanged; a field
|
|
// decision and each list are replaced entirely and never merged. This keeps every field one optional
|
|
// value in the generated server and client, without nested partial updates.
|
|
//
|
|
// Each requirement field is sent as a decision `{value, status}` and each list item as
|
|
// `{name or text, status}`, so confirmation is always explicit:
|
|
//
|
|
// - Confirm a suggestion: send its stored value with `confirmed`. It keeps its origin and quote.
|
|
// - Keep a suggestion open: send its stored value with `extracted`, or leave the field out.
|
|
// `extracted` with any other value, or for a field or item without a stored suggestion, answers 400
|
|
// with the pointer of that `status`, for example `/grade/status` or `/required_skills/2/status`. A
|
|
// client that sends back an unchanged form therefore never confirms a suggestion by accident.
|
|
// - Change: send another value with `confirmed`. It becomes a confirmed manual value, and its quote
|
|
// is dropped.
|
|
// - Delete: send null for a nullable field, which makes it `unknown` (or unlinks `vacancy_id`), or
|
|
// leave the item out of a skill or task list, which deletes it. An empty skill or task list deletes
|
|
// every item; a list sent as null answers 400. A deleted requirement really changes the
|
|
// requirements that search uses, not only an explanation, and a deleted suggestion is not proposed
|
|
// again by a later extraction.
|
|
// - Text: a different `source_text` extracts again. New suggestions replace only the `extracted`
|
|
// values and items of the fields not named in the body; confirmed values are never overwritten, and
|
|
// a suggested skill whose name is already in either skill list is skipped. Null removes the text
|
|
// and keeps every value.
|
|
//
|
|
// Versions: every committed change creates version `expected_version + 1` as an immutable snapshot and
|
|
// answers 200 with it. `requirements_version` becomes the new version only when a confirmed
|
|
// requirement was confirmed, changed, or removed. `expected_version` is the `version` the client read;
|
|
// when it is not current, the server answers 412 version_conflict and changes nothing, and the client
|
|
// reads the need again and reapplies its unsaved edits. The version travels in the body rather than in
|
|
// If-Match because the generated client cannot read the ETag response header yet, as for the
|
|
// questionnaire. Concurrent changes therefore never overwrite each other silently.
|
|
//
|
|
// The operation needs no Idempotency-Key: a body that changes nothing when applied to the current
|
|
// version, such as a retry of a change that already succeeded, keeps the version and answers 200 with
|
|
// the current need even when `expected_version` is older. An incomplete need is a valid result;
|
|
// `readiness.missing_fields` tells what remains.
|
|
//
|
|
// Salary limit: the recommendations aggregate candidates' minimums against the upper bound, so setting
|
|
// or changing a confirmed salary range counts against a limit shared by the whole organization, every
|
|
// member and every need, together with ranges set on creation: at most three a day (PRD FR13, planned
|
|
// in TASK-211). Over the limit the server answers 429 with Retry-After and changes nothing. After five
|
|
// settings within seven days the money component is `withheld` for seven days. Repeated range changes
|
|
// also feed the private risk signals of TASK-319.
|
|
//
|
|
// Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400),
|
|
// account scenario (403 forbidden for a candidate), membership (404 not_found) and role (403
|
|
// forbidden), the need (404 not_found), a body that changes nothing (200), the version (412), domain
|
|
// rules (400 with a pointer such as `/salary/value/salary_to` for a range whose lower bound is not
|
|
// below the upper one or whose width is outside 10-40%, `/desired_skills/0/name` for a skill that is
|
|
// also in the required list, `/grade/status` or `/required_skills/2/status` for `extracted` with a
|
|
// value that is not the stored suggestion, or `/vacancy_id`), then the salary change limit (429). The
|
|
// schema rejects a missing or non-positive `expected_version`, unknown fields such as `rec_score`,
|
|
// `members`, `candidate_minimum`, or `version`, a field sent as a bare value instead of
|
|
// `{value, status}`, a list sent as null, a salary bound that is not a positive multiple of 1000, and
|
|
// an unknown currency, period, or tax basis.
|
|
//
|
|
// PATCH /api/v1/organizations/{org_id}/needs/{need_id}
|
|
UpdateOrganizationNeed(ctx context.Context, req *NeedUpdate, params UpdateOrganizationNeedParams) (UpdateOrganizationNeedRes, error)
|
|
// NewError creates *ProblemStatusCode from error returned by handler.
|
|
//
|
|
// Used for common default response.
|
|
NewError(ctx context.Context, err error) *ProblemStatusCode
|
|
}
|
|
|
|
// Server implements http server based on OpenAPI v3 specification and
|
|
// calls Handler to handle requests.
|
|
type Server struct {
|
|
h Handler
|
|
sec SecurityHandler
|
|
baseServer
|
|
}
|
|
|
|
// NewServer creates new Server.
|
|
func NewServer(h Handler, sec SecurityHandler, opts ...ServerOption) (*Server, error) {
|
|
s, err := newServerConfig(opts...).baseServer()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &Server{
|
|
h: h,
|
|
sec: sec,
|
|
baseServer: s,
|
|
}, nil
|
|
}
|