feat(api): add support case and manual assessment request contract
This commit is contained in:
1 parent
2db585fbff
commit
ad4bb94426
65 files changed
+14629
-23
No files matched your search
@@ -17,7 +17,9 @@ import (
|
||||
)
|
||||
|
||||
var regexMap = map[string]ogenregex.Regexp{
|
||||
"\\S": ogenregex.MustCompile("\\S"),
|
||||
"^(/([^~/]|~[01])*)*$": ogenregex.MustCompile("^(/([^~/]|~[01])*)*$"),
|
||||
"^SC-[0-9]{4}-[0-9]{6,10}$": ogenregex.MustCompile("^SC-[0-9]{4}-[0-9]{6,10}$"),
|
||||
"^[A-Za-z0-9._-]+$": ogenregex.MustCompile("^[A-Za-z0-9._-]+$"),
|
||||
"^[A-Za-z0-9._:-]+$": ogenregex.MustCompile("^[A-Za-z0-9._:-]+$"),
|
||||
"^[A-Za-z0-9_-]+$": ogenregex.MustCompile("^[A-Za-z0-9_-]+$"),
|
||||
|
||||
@@ -474,6 +474,324 @@ func (s *Server) handleCreateMyAssessmentAttemptRequest(args [0]string, argsEsca
|
||||
}
|
||||
}
|
||||
|
||||
// handleCreateMySupportCaseRequest handles CreateMySupportCase operation.
|
||||
//
|
||||
// Requires the session cookie, the CSRF token of that session in X-CSRF-Token, an allowed Origin, and
|
||||
// an Idempotency-Key. The author is the account of the session; the body has no user, account, or
|
||||
// organization field. A case is reachable from any screen, including a screen that denies access to an
|
||||
// assessment: being refused an action never removes the path to a case about it.
|
||||
//
|
||||
// The client sends only what the user states: `type`, a non-blank `description`, and the fields of the
|
||||
// type. It never sets the status, the decision, the outcome, the priority, the response target, the
|
||||
// rubric, the assignee, or the moderator: every variant has `additionalProperties: false`, so such
|
||||
// fields answer 400. Attachments are not part of the MVP; they are planned as an optional field and
|
||||
// change no existing one.
|
||||
//
|
||||
// Types, accounts, and allowed references:
|
||||
//
|
||||
// Type | Accounts | Object reference | Other fields
|
||||
// --------------------+---------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------
|
||||
// `support` | candidate, employer | optional; `assessment_attempt` of the caller, an `organization` that the caller can see, an `invitation` addressed to the caller, or another `support_case` of the caller | optional `assessment_target`
|
||||
// `complaint` | candidate | required; an `organization` that the caller can see or an `invitation` addressed to the caller | required `complaint_reason`; `offer_content` and `salary_terms_violation` require an invitation
|
||||
// `grade_appeal` | candidate | required; `assessment_attempt` of the caller in a terminal state, so it has a result, or a `support_case` of the caller of type `manual_assessment` that is `resolved` with the outcome `assessed`, for a category that an expert assigned without an attempt | none
|
||||
// `anticheat_appeal` | candidate | required; `assessment_attempt` of the caller with an anti-cheat review decision | none
|
||||
// `manual_assessment` | candidate | optional; a prior `assessment_attempt` of the caller in the same specialization | required `assessment_target`
|
||||
//
|
||||
// An organization is visible to a candidate when it sent the candidate an invitation or when the
|
||||
// organization contract (TASK-077) shows the candidate its profile, and to an employer account when
|
||||
// the account has an active membership in it. Invitations are not in the contract yet, so until they
|
||||
// are, every `invitation` reference answers 404 not_found; anti-cheat review decisions are not either,
|
||||
// so until TASK-173 every anti-cheat appeal answers 409 state_conflict. The schema rejects an object
|
||||
// type that the case type does not accept, for example an organization in a grade appeal.
|
||||
//
|
||||
// Ownership of the reference: the server checks the object against the session account on every
|
||||
// create. An unknown object and an object of someone else, such as another candidate's attempt,
|
||||
// another account's case, or an invitation addressed to another person, both answer 404 not_found, so
|
||||
// a reference never reveals whether a foreign object exists. An own case that a grade appeal cannot
|
||||
// dispute, because it is not a manual assessment, is not resolved yet, or was resolved with another
|
||||
// outcome, answers 409 state_conflict. An identifier that is not a UUID fails validation with the
|
||||
// whole-body pointer, because the decoder does not record the path inside the selected variant. The
|
||||
// case stores only the type and the identifier of the object.
|
||||
//
|
||||
// Limits: an attempt and a resolved manual assessment each accept at most one grade appeal, and an
|
||||
// attempt at most one anti-cheat appeal, in any status; a disagreement with the decision goes into a
|
||||
// support case that references the appeal as `support_case`. A specialization accepts one open manual
|
||||
// assessment, and an object accepts one open complaint; open means not `resolved` or `closed`. A
|
||||
// second one answers 409 state_conflict. A grade appeal of an attempt that is still active also
|
||||
// answers 409. Every create that passed authentication, validation, and the account scenario counts
|
||||
// against a per-account limit from the product policy, including replays, 404, and 409, so the limit
|
||||
// also bounds probing of references; over the limit the server answers 429 with Retry-After and
|
||||
// creates nothing.
|
||||
//
|
||||
// Description check: the schema pattern `\S` uses the ECMAScript white space set in both generated
|
||||
// validators (ogen converts it for Go), so a description of spaces such as U+00A0 or U+3000 already
|
||||
// fails validation with the pointer `/description`. ECMAScript white space omits U+0085 (NEL), which
|
||||
// Go `unicode.IsSpace` includes, so the server also applies a domain check: a description whose every
|
||||
// character is `unicode.IsSpace` or U+FEFF answers 400 validation_failed with the pointer
|
||||
// `/description`. This check comes with the implementation; generated Zod accepts a description of
|
||||
// NEL, and the server stays authoritative.
|
||||
//
|
||||
// The new case gets a number and the status `submitted`. A grade appeal, an anti-cheat appeal, and a
|
||||
// manual assessment are moved to `waiting_expert` by a `system` event in the same transaction, so the
|
||||
// 201 already shows that status with both events; a support case and a complaint stay `submitted`.
|
||||
// Each case gets a response target from the product policy version and the configured business
|
||||
// calendar: 5 business days for a manual assessment and 10 for an appeal (PRD FR18 and C3), and a
|
||||
// policy value for support and complaints. The target is an operational goal, not a deadline set by
|
||||
// law. A manual assessment fixes the published rubric version of the category, or null when the
|
||||
// category has none yet; the expert assesses with the same rubric as the automated assessment, and the
|
||||
// request assigns no category by itself. Creating a case never grants, revokes, or changes a consent,
|
||||
// a grade, or an attempt.
|
||||
//
|
||||
// Replies: the case itself is the channel. Support replies and decisions appear in the public
|
||||
// `history` and `decision`. The server may also notify the verified email address of the account that
|
||||
// the case changed, with the case number and a link, never with the description, the reply, or
|
||||
// assessment details. No request field names another address or contact, so the operation cannot send
|
||||
// mail to an address that the user typed.
|
||||
//
|
||||
// Idempotency: a retry with the same key and body within 24 hours replays the stored 201 with the same
|
||||
// number and creates nothing, so a lost response never opens a second case. The replay is the snapshot
|
||||
// stored at creation, following the repository convention; the client reads the current status and
|
||||
// history with GetMySupportCase. 404 and 409 state_conflict are stored and replayed as well. A
|
||||
// different body with the same key answers 422 idempotency_key_reused. 400, 403, and 429 are never
|
||||
// stored.
|
||||
//
|
||||
// Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400),
|
||||
// account scenario (403 forbidden for an employer account with a type other than `support`), the
|
||||
// per-account case limit (429), the Idempotency-Key (422, 409 idempotency_in_progress, replay), domain
|
||||
// rules (400 with the pointer `/description` for a text of only Unicode spaces or `/object/type` for a
|
||||
// complaint reason that requires an invitation), the object reference (404 not_found), then the state
|
||||
// of the object and the limits (409 state_conflict). The general rate limit can answer 429 with
|
||||
// Retry-After before any check.
|
||||
//
|
||||
// POST /api/v1/me/support-cases
|
||||
func (s *Server) handleCreateMySupportCaseRequest(args [0]string, argsEscaped bool, w http.ResponseWriter, r *http.Request) {
|
||||
statusWriter := &codeRecorder{ResponseWriter: w}
|
||||
w = statusWriter
|
||||
otelAttrs := []attribute.KeyValue{
|
||||
otelogen.OperationID("CreateMySupportCase"),
|
||||
semconv.HTTPRequestMethodKey.String("POST"),
|
||||
semconv.HTTPRouteKey.String("/api/v1/me/support-cases"),
|
||||
}
|
||||
// Add attributes from config.
|
||||
otelAttrs = append(otelAttrs, s.cfg.Attributes...)
|
||||
|
||||
// Start a span for this request.
|
||||
ctx, span := s.cfg.Tracer.Start(r.Context(), CreateMySupportCaseOperation,
|
||||
trace.WithAttributes(otelAttrs...),
|
||||
serverSpanKind,
|
||||
)
|
||||
defer span.End()
|
||||
|
||||
// Add Labeler to context.
|
||||
labeler := &Labeler{attrs: otelAttrs}
|
||||
ctx = contextWithLabeler(ctx, labeler)
|
||||
|
||||
// Run stopwatch.
|
||||
startTime := time.Now()
|
||||
defer func() {
|
||||
elapsedDuration := time.Since(startTime)
|
||||
|
||||
attrSet := labeler.AttributeSet()
|
||||
attrs := attrSet.ToSlice()
|
||||
code := statusWriter.status
|
||||
if code != 0 {
|
||||
codeAttr := semconv.HTTPResponseStatusCode(code)
|
||||
attrs = append(attrs, codeAttr)
|
||||
span.SetAttributes(attrs...)
|
||||
}
|
||||
attrOpt := metric.WithAttributes(attrs...)
|
||||
|
||||
// Increment request counter.
|
||||
s.requests.Add(ctx, 1, attrOpt)
|
||||
|
||||
// Use floating point division here for higher precision (instead of Millisecond method).
|
||||
s.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), attrOpt)
|
||||
}()
|
||||
|
||||
var (
|
||||
recordError = func(stage string, err error) {
|
||||
span.RecordError(err)
|
||||
|
||||
// https://opentelemetry.io/docs/specs/semconv/http/http-spans/#status
|
||||
// Span Status MUST be left unset if HTTP status code was in the 1xx, 2xx or 3xx ranges,
|
||||
// unless there was another error (e.g., network error receiving the response body; or 3xx codes with
|
||||
// max redirects exceeded), in which case status MUST be set to Error.
|
||||
code := statusWriter.status
|
||||
if code < 100 || code >= 500 {
|
||||
span.SetStatus(codes.Error, stage)
|
||||
}
|
||||
|
||||
attrSet := labeler.AttributeSet()
|
||||
attrs := attrSet.ToSlice()
|
||||
if code != 0 {
|
||||
attrs = append(attrs, semconv.HTTPResponseStatusCode(code))
|
||||
}
|
||||
|
||||
s.errors.Add(ctx, 1, metric.WithAttributes(attrs...))
|
||||
}
|
||||
err error
|
||||
opErrContext = ogenerrors.OperationContext{
|
||||
Name: CreateMySupportCaseOperation,
|
||||
ID: "CreateMySupportCase",
|
||||
}
|
||||
)
|
||||
{
|
||||
type bitset = [1]uint8
|
||||
var satisfied bitset
|
||||
{
|
||||
sctx, ok, err := s.securitySessionCookie(ctx, CreateMySupportCaseOperation, r)
|
||||
if err != nil {
|
||||
err = &ogenerrors.SecurityError{
|
||||
OperationContext: opErrContext,
|
||||
Security: "SessionCookie",
|
||||
Err: err,
|
||||
}
|
||||
if encodeErr := encodeErrorResponse(s.h.NewError(ctx, err), w, span); encodeErr != nil {
|
||||
defer recordError("Security:SessionCookie", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
if ok {
|
||||
satisfied[0] |= 1 << 0
|
||||
ctx = sctx
|
||||
}
|
||||
}
|
||||
{
|
||||
sctx, ok, err := s.securitySessionCsrf(ctx, CreateMySupportCaseOperation, r)
|
||||
if err != nil {
|
||||
err = &ogenerrors.SecurityError{
|
||||
OperationContext: opErrContext,
|
||||
Security: "SessionCsrf",
|
||||
Err: err,
|
||||
}
|
||||
if encodeErr := encodeErrorResponse(s.h.NewError(ctx, err), w, span); encodeErr != nil {
|
||||
defer recordError("Security:SessionCsrf", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
if ok {
|
||||
satisfied[0] |= 1 << 1
|
||||
ctx = sctx
|
||||
}
|
||||
}
|
||||
|
||||
if ok := func() bool {
|
||||
nextRequirement:
|
||||
for _, requirement := range []bitset{
|
||||
{0b00000011},
|
||||
} {
|
||||
for i, mask := range requirement {
|
||||
if satisfied[i]&mask != mask {
|
||||
continue nextRequirement
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}(); !ok {
|
||||
err = &ogenerrors.SecurityError{
|
||||
OperationContext: opErrContext,
|
||||
Err: ogenerrors.ErrSecurityRequirementIsNotSatisfied,
|
||||
}
|
||||
if encodeErr := encodeErrorResponse(s.h.NewError(ctx, err), w, span); encodeErr != nil {
|
||||
defer recordError("Security", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
params, err := decodeCreateMySupportCaseParams(args, argsEscaped, r)
|
||||
if err != nil {
|
||||
err = &ogenerrors.DecodeParamsError{
|
||||
OperationContext: opErrContext,
|
||||
Err: err,
|
||||
}
|
||||
defer recordError("DecodeParams", err)
|
||||
s.cfg.ErrorHandler(ctx, w, r, err)
|
||||
return
|
||||
}
|
||||
|
||||
var rawBody []byte
|
||||
request, rawBody, close, err := s.decodeCreateMySupportCaseRequest(r)
|
||||
if err != nil {
|
||||
err = &ogenerrors.DecodeRequestError{
|
||||
OperationContext: opErrContext,
|
||||
Err: err,
|
||||
}
|
||||
defer recordError("DecodeRequest", err)
|
||||
s.cfg.ErrorHandler(ctx, w, r, err)
|
||||
return
|
||||
}
|
||||
defer func() {
|
||||
if err := close(); err != nil {
|
||||
recordError("CloseRequest", err)
|
||||
}
|
||||
}()
|
||||
|
||||
var response CreateMySupportCaseRes
|
||||
if m := s.cfg.Middleware; m != nil {
|
||||
mreq := middleware.Request{
|
||||
Context: ctx,
|
||||
OperationName: CreateMySupportCaseOperation,
|
||||
OperationSummary: "Open a support case, a complaint, an appeal, or a manual assessment request.",
|
||||
OperationID: "CreateMySupportCase",
|
||||
Body: request,
|
||||
RawBody: rawBody,
|
||||
Params: middleware.Parameters{
|
||||
{
|
||||
Name: "Idempotency-Key",
|
||||
In: "header",
|
||||
}: params.IdempotencyKey,
|
||||
},
|
||||
Raw: r,
|
||||
}
|
||||
|
||||
type (
|
||||
Request = SupportCaseCreate
|
||||
Params = CreateMySupportCaseParams
|
||||
Response = CreateMySupportCaseRes
|
||||
)
|
||||
response, err = middleware.HookMiddleware[
|
||||
Request,
|
||||
Params,
|
||||
Response,
|
||||
](
|
||||
m,
|
||||
mreq,
|
||||
unpackCreateMySupportCaseParams,
|
||||
func(ctx context.Context, request Request, params Params) (response Response, err error) {
|
||||
response, err = s.h.CreateMySupportCase(ctx, request, params)
|
||||
return response, err
|
||||
},
|
||||
)
|
||||
} else {
|
||||
response, err = s.h.CreateMySupportCase(ctx, request, params)
|
||||
}
|
||||
if err != nil {
|
||||
if errRes, ok := errors.Into[*ProblemStatusCode](err); ok {
|
||||
if err := encodeErrorResponse(errRes, w, span); err != nil {
|
||||
defer recordError("Internal", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
if errors.Is(err, ht.ErrNotImplemented) {
|
||||
s.cfg.ErrorHandler(ctx, w, r, err)
|
||||
return
|
||||
}
|
||||
if err := encodeErrorResponse(s.h.NewError(ctx, err), w, span); err != nil {
|
||||
defer recordError("Internal", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if err := encodeCreateMySupportCaseResponse(response, w, span); err != nil {
|
||||
defer recordError("EncodeResponse", err)
|
||||
if !errors.Is(err, ht.ErrInternalServerErrorResponse) {
|
||||
s.cfg.ErrorHandler(ctx, w, r, err)
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// handleCreateOrganizationNeedRequest handles CreateOrganizationNeed operation.
|
||||
//
|
||||
// Requires the session cookie of an employer account with an active membership in `org_id`, the CSRF
|
||||
@@ -2530,6 +2848,222 @@ func (s *Server) handleGetMyQuestionnaireRequest(args [0]string, argsEscaped boo
|
||||
}
|
||||
}
|
||||
|
||||
// handleGetMySupportCaseRequest handles GetMySupportCase operation.
|
||||
//
|
||||
// Requires the session cookie of a candidate or an employer account. Returns the case with its number,
|
||||
// type, object reference, status, response target, decision, and public history. The owner reads the
|
||||
// case whatever happened to the object since then: a revoked access, a closed invitation, or a refused
|
||||
// test never hides the case from its author.
|
||||
//
|
||||
// The case never contains the identity of a moderator, an expert, or a support agent, internal notes,
|
||||
// evidence, assessment answers, anti-cheat or risk signals, or contact data of another person.
|
||||
// `decision` is null until the case is `resolved`.
|
||||
//
|
||||
// The history lists every public event and is never truncated: the server keeps a case within 200
|
||||
// events by rejecting a staff event that would leave no room for the terminal one.
|
||||
//
|
||||
// The case must belong to the account of the session: a case of another account, including another
|
||||
// member of the same organization, answers 404 not_found, the same as an unknown identifier, so
|
||||
// identifiers cannot be probed. TASK-314 says forbidden for a foreign case URL; the contract answers
|
||||
// 404 instead, so the client shows the same "not found" state for a foreign and an unknown case. A
|
||||
// malformed `case_id` answers 400 validation_failed with the path pointer.
|
||||
//
|
||||
// GET /api/v1/me/support-cases/{case_id}
|
||||
func (s *Server) handleGetMySupportCaseRequest(args [1]string, argsEscaped bool, w http.ResponseWriter, r *http.Request) {
|
||||
statusWriter := &codeRecorder{ResponseWriter: w}
|
||||
w = statusWriter
|
||||
otelAttrs := []attribute.KeyValue{
|
||||
otelogen.OperationID("GetMySupportCase"),
|
||||
semconv.HTTPRequestMethodKey.String("GET"),
|
||||
semconv.HTTPRouteKey.String("/api/v1/me/support-cases/{case_id}"),
|
||||
}
|
||||
// Add attributes from config.
|
||||
otelAttrs = append(otelAttrs, s.cfg.Attributes...)
|
||||
|
||||
// Start a span for this request.
|
||||
ctx, span := s.cfg.Tracer.Start(r.Context(), GetMySupportCaseOperation,
|
||||
trace.WithAttributes(otelAttrs...),
|
||||
serverSpanKind,
|
||||
)
|
||||
defer span.End()
|
||||
|
||||
// Add Labeler to context.
|
||||
labeler := &Labeler{attrs: otelAttrs}
|
||||
ctx = contextWithLabeler(ctx, labeler)
|
||||
|
||||
// Run stopwatch.
|
||||
startTime := time.Now()
|
||||
defer func() {
|
||||
elapsedDuration := time.Since(startTime)
|
||||
|
||||
attrSet := labeler.AttributeSet()
|
||||
attrs := attrSet.ToSlice()
|
||||
code := statusWriter.status
|
||||
if code != 0 {
|
||||
codeAttr := semconv.HTTPResponseStatusCode(code)
|
||||
attrs = append(attrs, codeAttr)
|
||||
span.SetAttributes(attrs...)
|
||||
}
|
||||
attrOpt := metric.WithAttributes(attrs...)
|
||||
|
||||
// Increment request counter.
|
||||
s.requests.Add(ctx, 1, attrOpt)
|
||||
|
||||
// Use floating point division here for higher precision (instead of Millisecond method).
|
||||
s.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), attrOpt)
|
||||
}()
|
||||
|
||||
var (
|
||||
recordError = func(stage string, err error) {
|
||||
span.RecordError(err)
|
||||
|
||||
// https://opentelemetry.io/docs/specs/semconv/http/http-spans/#status
|
||||
// Span Status MUST be left unset if HTTP status code was in the 1xx, 2xx or 3xx ranges,
|
||||
// unless there was another error (e.g., network error receiving the response body; or 3xx codes with
|
||||
// max redirects exceeded), in which case status MUST be set to Error.
|
||||
code := statusWriter.status
|
||||
if code < 100 || code >= 500 {
|
||||
span.SetStatus(codes.Error, stage)
|
||||
}
|
||||
|
||||
attrSet := labeler.AttributeSet()
|
||||
attrs := attrSet.ToSlice()
|
||||
if code != 0 {
|
||||
attrs = append(attrs, semconv.HTTPResponseStatusCode(code))
|
||||
}
|
||||
|
||||
s.errors.Add(ctx, 1, metric.WithAttributes(attrs...))
|
||||
}
|
||||
err error
|
||||
opErrContext = ogenerrors.OperationContext{
|
||||
Name: GetMySupportCaseOperation,
|
||||
ID: "GetMySupportCase",
|
||||
}
|
||||
)
|
||||
{
|
||||
type bitset = [1]uint8
|
||||
var satisfied bitset
|
||||
{
|
||||
sctx, ok, err := s.securitySessionCookie(ctx, GetMySupportCaseOperation, r)
|
||||
if err != nil {
|
||||
err = &ogenerrors.SecurityError{
|
||||
OperationContext: opErrContext,
|
||||
Security: "SessionCookie",
|
||||
Err: err,
|
||||
}
|
||||
if encodeErr := encodeErrorResponse(s.h.NewError(ctx, err), w, span); encodeErr != nil {
|
||||
defer recordError("Security:SessionCookie", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
if ok {
|
||||
satisfied[0] |= 1 << 0
|
||||
ctx = sctx
|
||||
}
|
||||
}
|
||||
|
||||
if ok := func() bool {
|
||||
nextRequirement:
|
||||
for _, requirement := range []bitset{
|
||||
{0b00000001},
|
||||
} {
|
||||
for i, mask := range requirement {
|
||||
if satisfied[i]&mask != mask {
|
||||
continue nextRequirement
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}(); !ok {
|
||||
err = &ogenerrors.SecurityError{
|
||||
OperationContext: opErrContext,
|
||||
Err: ogenerrors.ErrSecurityRequirementIsNotSatisfied,
|
||||
}
|
||||
if encodeErr := encodeErrorResponse(s.h.NewError(ctx, err), w, span); encodeErr != nil {
|
||||
defer recordError("Security", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
params, err := decodeGetMySupportCaseParams(args, argsEscaped, r)
|
||||
if err != nil {
|
||||
err = &ogenerrors.DecodeParamsError{
|
||||
OperationContext: opErrContext,
|
||||
Err: err,
|
||||
}
|
||||
defer recordError("DecodeParams", err)
|
||||
s.cfg.ErrorHandler(ctx, w, r, err)
|
||||
return
|
||||
}
|
||||
|
||||
var rawBody []byte
|
||||
|
||||
var response GetMySupportCaseRes
|
||||
if m := s.cfg.Middleware; m != nil {
|
||||
mreq := middleware.Request{
|
||||
Context: ctx,
|
||||
OperationName: GetMySupportCaseOperation,
|
||||
OperationSummary: "Read a support case of the current account.",
|
||||
OperationID: "GetMySupportCase",
|
||||
Body: nil,
|
||||
RawBody: rawBody,
|
||||
Params: middleware.Parameters{
|
||||
{
|
||||
Name: "case_id",
|
||||
In: "path",
|
||||
}: params.CaseID,
|
||||
},
|
||||
Raw: r,
|
||||
}
|
||||
|
||||
type (
|
||||
Request = struct{}
|
||||
Params = GetMySupportCaseParams
|
||||
Response = GetMySupportCaseRes
|
||||
)
|
||||
response, err = middleware.HookMiddleware[
|
||||
Request,
|
||||
Params,
|
||||
Response,
|
||||
](
|
||||
m,
|
||||
mreq,
|
||||
unpackGetMySupportCaseParams,
|
||||
func(ctx context.Context, request Request, params Params) (response Response, err error) {
|
||||
response, err = s.h.GetMySupportCase(ctx, params)
|
||||
return response, err
|
||||
},
|
||||
)
|
||||
} else {
|
||||
response, err = s.h.GetMySupportCase(ctx, params)
|
||||
}
|
||||
if err != nil {
|
||||
if errRes, ok := errors.Into[*ProblemStatusCode](err); ok {
|
||||
if err := encodeErrorResponse(errRes, w, span); err != nil {
|
||||
defer recordError("Internal", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
if errors.Is(err, ht.ErrNotImplemented) {
|
||||
s.cfg.ErrorHandler(ctx, w, r, err)
|
||||
return
|
||||
}
|
||||
if err := encodeErrorResponse(s.h.NewError(ctx, err), w, span); err != nil {
|
||||
defer recordError("Internal", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if err := encodeGetMySupportCaseResponse(response, w, span); err != nil {
|
||||
defer recordError("EncodeResponse", err)
|
||||
if !errors.Is(err, ht.ErrInternalServerErrorResponse) {
|
||||
s.cfg.ErrorHandler(ctx, w, r, err)
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// handleGetOrganizationNeedRequest handles GetOrganizationNeed operation.
|
||||
//
|
||||
// Requires the session cookie of an employer account with an active membership in `org_id`. The
|
||||
@@ -2908,6 +3442,219 @@ func (s *Server) handleGetSpecializationCatalogRequest(args [0]string, argsEscap
|
||||
}
|
||||
}
|
||||
|
||||
// handleListMySupportCasesRequest handles ListMySupportCases operation.
|
||||
//
|
||||
// Requires the session cookie of a candidate or an employer account. Returns a page of the cases that
|
||||
// this account created, newest first by creation time with the identifier as the tie-breaker, with
|
||||
// cursor pagination. Each item is a summary with the number, type, status, object reference, category,
|
||||
// response target, and decision outcome; it has no description and no history, which GetMySupportCase
|
||||
// returns with the full case. Cases of other accounts are never listed, including cases of other
|
||||
// members of the same organization.
|
||||
//
|
||||
// Access: a missing, unknown, expired, or revoked session answers 401 unauthenticated. A malformed
|
||||
// `limit` or `cursor` answers 400 validation_failed. Filters by status and type are planned and add
|
||||
// optional parameters.
|
||||
//
|
||||
// GET /api/v1/me/support-cases
|
||||
func (s *Server) handleListMySupportCasesRequest(args [0]string, argsEscaped bool, w http.ResponseWriter, r *http.Request) {
|
||||
statusWriter := &codeRecorder{ResponseWriter: w}
|
||||
w = statusWriter
|
||||
otelAttrs := []attribute.KeyValue{
|
||||
otelogen.OperationID("ListMySupportCases"),
|
||||
semconv.HTTPRequestMethodKey.String("GET"),
|
||||
semconv.HTTPRouteKey.String("/api/v1/me/support-cases"),
|
||||
}
|
||||
// Add attributes from config.
|
||||
otelAttrs = append(otelAttrs, s.cfg.Attributes...)
|
||||
|
||||
// Start a span for this request.
|
||||
ctx, span := s.cfg.Tracer.Start(r.Context(), ListMySupportCasesOperation,
|
||||
trace.WithAttributes(otelAttrs...),
|
||||
serverSpanKind,
|
||||
)
|
||||
defer span.End()
|
||||
|
||||
// Add Labeler to context.
|
||||
labeler := &Labeler{attrs: otelAttrs}
|
||||
ctx = contextWithLabeler(ctx, labeler)
|
||||
|
||||
// Run stopwatch.
|
||||
startTime := time.Now()
|
||||
defer func() {
|
||||
elapsedDuration := time.Since(startTime)
|
||||
|
||||
attrSet := labeler.AttributeSet()
|
||||
attrs := attrSet.ToSlice()
|
||||
code := statusWriter.status
|
||||
if code != 0 {
|
||||
codeAttr := semconv.HTTPResponseStatusCode(code)
|
||||
attrs = append(attrs, codeAttr)
|
||||
span.SetAttributes(attrs...)
|
||||
}
|
||||
attrOpt := metric.WithAttributes(attrs...)
|
||||
|
||||
// Increment request counter.
|
||||
s.requests.Add(ctx, 1, attrOpt)
|
||||
|
||||
// Use floating point division here for higher precision (instead of Millisecond method).
|
||||
s.duration.Record(ctx, float64(elapsedDuration)/float64(time.Millisecond), attrOpt)
|
||||
}()
|
||||
|
||||
var (
|
||||
recordError = func(stage string, err error) {
|
||||
span.RecordError(err)
|
||||
|
||||
// https://opentelemetry.io/docs/specs/semconv/http/http-spans/#status
|
||||
// Span Status MUST be left unset if HTTP status code was in the 1xx, 2xx or 3xx ranges,
|
||||
// unless there was another error (e.g., network error receiving the response body; or 3xx codes with
|
||||
// max redirects exceeded), in which case status MUST be set to Error.
|
||||
code := statusWriter.status
|
||||
if code < 100 || code >= 500 {
|
||||
span.SetStatus(codes.Error, stage)
|
||||
}
|
||||
|
||||
attrSet := labeler.AttributeSet()
|
||||
attrs := attrSet.ToSlice()
|
||||
if code != 0 {
|
||||
attrs = append(attrs, semconv.HTTPResponseStatusCode(code))
|
||||
}
|
||||
|
||||
s.errors.Add(ctx, 1, metric.WithAttributes(attrs...))
|
||||
}
|
||||
err error
|
||||
opErrContext = ogenerrors.OperationContext{
|
||||
Name: ListMySupportCasesOperation,
|
||||
ID: "ListMySupportCases",
|
||||
}
|
||||
)
|
||||
{
|
||||
type bitset = [1]uint8
|
||||
var satisfied bitset
|
||||
{
|
||||
sctx, ok, err := s.securitySessionCookie(ctx, ListMySupportCasesOperation, r)
|
||||
if err != nil {
|
||||
err = &ogenerrors.SecurityError{
|
||||
OperationContext: opErrContext,
|
||||
Security: "SessionCookie",
|
||||
Err: err,
|
||||
}
|
||||
if encodeErr := encodeErrorResponse(s.h.NewError(ctx, err), w, span); encodeErr != nil {
|
||||
defer recordError("Security:SessionCookie", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
if ok {
|
||||
satisfied[0] |= 1 << 0
|
||||
ctx = sctx
|
||||
}
|
||||
}
|
||||
|
||||
if ok := func() bool {
|
||||
nextRequirement:
|
||||
for _, requirement := range []bitset{
|
||||
{0b00000001},
|
||||
} {
|
||||
for i, mask := range requirement {
|
||||
if satisfied[i]&mask != mask {
|
||||
continue nextRequirement
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}(); !ok {
|
||||
err = &ogenerrors.SecurityError{
|
||||
OperationContext: opErrContext,
|
||||
Err: ogenerrors.ErrSecurityRequirementIsNotSatisfied,
|
||||
}
|
||||
if encodeErr := encodeErrorResponse(s.h.NewError(ctx, err), w, span); encodeErr != nil {
|
||||
defer recordError("Security", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
params, err := decodeListMySupportCasesParams(args, argsEscaped, r)
|
||||
if err != nil {
|
||||
err = &ogenerrors.DecodeParamsError{
|
||||
OperationContext: opErrContext,
|
||||
Err: err,
|
||||
}
|
||||
defer recordError("DecodeParams", err)
|
||||
s.cfg.ErrorHandler(ctx, w, r, err)
|
||||
return
|
||||
}
|
||||
|
||||
var rawBody []byte
|
||||
|
||||
var response ListMySupportCasesRes
|
||||
if m := s.cfg.Middleware; m != nil {
|
||||
mreq := middleware.Request{
|
||||
Context: ctx,
|
||||
OperationName: ListMySupportCasesOperation,
|
||||
OperationSummary: "List the support cases of the current account.",
|
||||
OperationID: "ListMySupportCases",
|
||||
Body: nil,
|
||||
RawBody: rawBody,
|
||||
Params: middleware.Parameters{
|
||||
{
|
||||
Name: "limit",
|
||||
In: "query",
|
||||
}: params.Limit,
|
||||
{
|
||||
Name: "cursor",
|
||||
In: "query",
|
||||
}: params.Cursor,
|
||||
},
|
||||
Raw: r,
|
||||
}
|
||||
|
||||
type (
|
||||
Request = struct{}
|
||||
Params = ListMySupportCasesParams
|
||||
Response = ListMySupportCasesRes
|
||||
)
|
||||
response, err = middleware.HookMiddleware[
|
||||
Request,
|
||||
Params,
|
||||
Response,
|
||||
](
|
||||
m,
|
||||
mreq,
|
||||
unpackListMySupportCasesParams,
|
||||
func(ctx context.Context, request Request, params Params) (response Response, err error) {
|
||||
response, err = s.h.ListMySupportCases(ctx, params)
|
||||
return response, err
|
||||
},
|
||||
)
|
||||
} else {
|
||||
response, err = s.h.ListMySupportCases(ctx, params)
|
||||
}
|
||||
if err != nil {
|
||||
if errRes, ok := errors.Into[*ProblemStatusCode](err); ok {
|
||||
if err := encodeErrorResponse(errRes, w, span); err != nil {
|
||||
defer recordError("Internal", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
if errors.Is(err, ht.ErrNotImplemented) {
|
||||
s.cfg.ErrorHandler(ctx, w, r, err)
|
||||
return
|
||||
}
|
||||
if err := encodeErrorResponse(s.h.NewError(ctx, err), w, span); err != nil {
|
||||
defer recordError("Internal", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if err := encodeListMySupportCasesResponse(response, w, span); err != nil {
|
||||
defer recordError("EncodeResponse", err)
|
||||
if !errors.Is(err, ht.ErrInternalServerErrorResponse) {
|
||||
s.cfg.ErrorHandler(ctx, w, r, err)
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// handleListOrganizationNeedsRequest handles ListOrganizationNeeds operation.
|
||||
//
|
||||
// Requires the session cookie of an employer account with an active membership in `org_id`. The
|
||||
|
||||
@@ -9,6 +9,10 @@ type CreateMyAssessmentAttemptRes interface {
|
||||
createMyAssessmentAttemptRes()
|
||||
}
|
||||
|
||||
type CreateMySupportCaseRes interface {
|
||||
createMySupportCaseRes()
|
||||
}
|
||||
|
||||
type CreateOrganizationNeedRes interface {
|
||||
createOrganizationNeedRes()
|
||||
}
|
||||
@@ -45,10 +49,18 @@ type GetMyQuestionnaireRes interface {
|
||||
getMyQuestionnaireRes()
|
||||
}
|
||||
|
||||
type GetMySupportCaseRes interface {
|
||||
getMySupportCaseRes()
|
||||
}
|
||||
|
||||
type GetOrganizationNeedRes interface {
|
||||
getOrganizationNeedRes()
|
||||
}
|
||||
|
||||
type ListMySupportCasesRes interface {
|
||||
listMySupportCasesRes()
|
||||
}
|
||||
|
||||
type ListOrganizationNeedsRes interface {
|
||||
listOrganizationNeedsRes()
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -8,6 +8,7 @@ type OperationName = string
|
||||
const (
|
||||
ConfirmEmailOperation OperationName = "ConfirmEmail"
|
||||
CreateMyAssessmentAttemptOperation OperationName = "CreateMyAssessmentAttempt"
|
||||
CreateMySupportCaseOperation OperationName = "CreateMySupportCase"
|
||||
CreateOrganizationNeedOperation OperationName = "CreateOrganizationNeed"
|
||||
FinalizeMyAssessmentAttemptOperation OperationName = "FinalizeMyAssessmentAttempt"
|
||||
GetConsentTextOperation OperationName = "GetConsentText"
|
||||
@@ -18,8 +19,10 @@ const (
|
||||
GetMyAssessmentAvailabilityOperation OperationName = "GetMyAssessmentAvailability"
|
||||
GetMyAssessmentResultOperation OperationName = "GetMyAssessmentResult"
|
||||
GetMyQuestionnaireOperation OperationName = "GetMyQuestionnaire"
|
||||
GetMySupportCaseOperation OperationName = "GetMySupportCase"
|
||||
GetOrganizationNeedOperation OperationName = "GetOrganizationNeed"
|
||||
GetSpecializationCatalogOperation OperationName = "GetSpecializationCatalog"
|
||||
ListMySupportCasesOperation OperationName = "ListMySupportCases"
|
||||
ListOrganizationNeedsOperation OperationName = "ListOrganizationNeeds"
|
||||
LoginOperation OperationName = "Login"
|
||||
LogoutOperation OperationName = "Logout"
|
||||
|
||||
@@ -109,6 +109,100 @@ func decodeCreateMyAssessmentAttemptParams(args [0]string, argsEscaped bool, r *
|
||||
return params, nil
|
||||
}
|
||||
|
||||
// CreateMySupportCaseParams is parameters of CreateMySupportCase operation.
|
||||
type CreateMySupportCaseParams struct {
|
||||
// Client-generated key that makes a retried mutating command safe; a UUID v4 is recommended. The value
|
||||
// is sent without quotes. The server scopes the key by caller and operation and fingerprints the
|
||||
// request by method, path, and body.
|
||||
//
|
||||
// Stored for 24 hours after the first request and replayed with the same status, headers, and body:
|
||||
// the final 2xx outcome and final deterministic 4xx business outcomes of the command, such as 404
|
||||
// not_found or 409 state_conflict. A replay does not repeat the side effect.
|
||||
//
|
||||
// Not stored, so a retry with the same key is evaluated again: 400 validation_failed, 413, and 415 for
|
||||
// the request itself, 401 and 403, 409 idempotency_in_progress, 412 version_conflict and 428
|
||||
// precondition_required (nothing changed; read the resource again and retry), 422
|
||||
// idempotency_key_reused, 429, and every 5xx.
|
||||
//
|
||||
// Order of checks: authentication (401), request validation (400, 413, 415), authorization (403), then
|
||||
// the key. A stored or running request with a different fingerprint returns 422 idempotency_key_reused
|
||||
// before any other key check; a running request with the same fingerprint returns 409
|
||||
// idempotency_in_progress; a stored outcome with the same fingerprint is replayed. Only after that
|
||||
// does the server check If-Match, so a retry of a completed change replays its outcome instead of
|
||||
// failing on the version it has just changed. After 24 hours the key may be accepted as new.
|
||||
IdempotencyKey string
|
||||
}
|
||||
|
||||
func unpackCreateMySupportCaseParams(packed middleware.Parameters) (params CreateMySupportCaseParams) {
|
||||
{
|
||||
key := middleware.ParameterKey{
|
||||
Name: "Idempotency-Key",
|
||||
In: "header",
|
||||
}
|
||||
params.IdempotencyKey = packed[key].(string)
|
||||
}
|
||||
return params
|
||||
}
|
||||
|
||||
func decodeCreateMySupportCaseParams(args [0]string, argsEscaped bool, r *http.Request) (params CreateMySupportCaseParams, _ error) {
|
||||
h := uri.NewHeaderDecoder(r.Header)
|
||||
// Decode header: Idempotency-Key.
|
||||
if err := func() error {
|
||||
cfg := uri.HeaderParameterDecodingConfig{
|
||||
Name: "Idempotency-Key",
|
||||
Explode: false,
|
||||
}
|
||||
if err := h.HasParam(cfg); err == nil {
|
||||
if err := h.DecodeParam(cfg, func(d uri.Decoder) error {
|
||||
val, err := d.DecodeValue()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
c, err := conv.ToString(val)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
params.IdempotencyKey = c
|
||||
return nil
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := func() error {
|
||||
if err := (validate.String{
|
||||
MinLength: 1,
|
||||
MinLengthSet: true,
|
||||
MaxLength: 255,
|
||||
MaxLengthSet: true,
|
||||
Email: false,
|
||||
Hostname: false,
|
||||
Regex: regexMap["^[A-Za-z0-9._:-]+$"],
|
||||
MinNumeric: 0,
|
||||
MinNumericSet: false,
|
||||
MaxNumeric: 0,
|
||||
MaxNumericSet: false,
|
||||
}).Validate(string(params.IdempotencyKey)); err != nil {
|
||||
return errors.Wrap(err, "string")
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return params, &ogenerrors.DecodeParamError{
|
||||
Name: "Idempotency-Key",
|
||||
In: "header",
|
||||
Err: err,
|
||||
}
|
||||
}
|
||||
return params, nil
|
||||
}
|
||||
|
||||
// CreateOrganizationNeedParams is parameters of CreateOrganizationNeed operation.
|
||||
type CreateOrganizationNeedParams struct {
|
||||
// Identifier of an organization. Access comes only from an active membership of the session account in
|
||||
@@ -617,6 +711,73 @@ func decodeGetMyAssessmentResultParams(args [1]string, argsEscaped bool, r *http
|
||||
return params, nil
|
||||
}
|
||||
|
||||
// GetMySupportCaseParams is parameters of GetMySupportCase operation.
|
||||
type GetMySupportCaseParams struct {
|
||||
// Identifier of a case of the current account. A case of another account and an unknown identifier
|
||||
// both answer 404 not_found, so identifiers cannot be enumerated.
|
||||
CaseID uuid.UUID
|
||||
}
|
||||
|
||||
func unpackGetMySupportCaseParams(packed middleware.Parameters) (params GetMySupportCaseParams) {
|
||||
{
|
||||
key := middleware.ParameterKey{
|
||||
Name: "case_id",
|
||||
In: "path",
|
||||
}
|
||||
params.CaseID = packed[key].(uuid.UUID)
|
||||
}
|
||||
return params
|
||||
}
|
||||
|
||||
func decodeGetMySupportCaseParams(args [1]string, argsEscaped bool, r *http.Request) (params GetMySupportCaseParams, _ error) {
|
||||
// Decode path: case_id.
|
||||
if err := func() error {
|
||||
param := args[0]
|
||||
if argsEscaped {
|
||||
unescaped, err := url.PathUnescape(args[0])
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "unescape path")
|
||||
}
|
||||
param = unescaped
|
||||
}
|
||||
if len(param) > 0 {
|
||||
d := uri.NewPathDecoder(uri.PathDecoderConfig{
|
||||
Param: "case_id",
|
||||
Value: param,
|
||||
Style: uri.PathStyleSimple,
|
||||
Explode: false,
|
||||
})
|
||||
|
||||
if err := func() error {
|
||||
val, err := d.DecodeValue()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
c, err := conv.ToUUID(val)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
params.CaseID = c
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
return validate.ErrFieldRequired
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return params, &ogenerrors.DecodeParamError{
|
||||
Name: "case_id",
|
||||
In: "path",
|
||||
Err: err,
|
||||
}
|
||||
}
|
||||
return params, nil
|
||||
}
|
||||
|
||||
// GetOrganizationNeedParams is parameters of GetOrganizationNeed operation.
|
||||
type GetOrganizationNeedParams struct {
|
||||
// Identifier of an organization. Access comes only from an active membership of the session account in
|
||||
@@ -741,6 +902,182 @@ func decodeGetOrganizationNeedParams(args [2]string, argsEscaped bool, r *http.R
|
||||
return params, nil
|
||||
}
|
||||
|
||||
// ListMySupportCasesParams is parameters of ListMySupportCases operation.
|
||||
type ListMySupportCasesParams struct {
|
||||
// Maximum number of items in the page. The server may return fewer items even when more remain; use
|
||||
// `page.has_more` to detect the end.
|
||||
Limit OptInt32 `json:",omitempty,omitzero"`
|
||||
// Opaque `page.next_cursor` value from the previous page of the same listing. Omit it to read the
|
||||
// first page. A malformed or foreign cursor returns 400 with code validation_failed.
|
||||
Cursor OptString `json:",omitempty,omitzero"`
|
||||
}
|
||||
|
||||
func unpackListMySupportCasesParams(packed middleware.Parameters) (params ListMySupportCasesParams) {
|
||||
{
|
||||
key := middleware.ParameterKey{
|
||||
Name: "limit",
|
||||
In: "query",
|
||||
}
|
||||
if v, ok := packed[key]; ok {
|
||||
params.Limit = v.(OptInt32)
|
||||
}
|
||||
}
|
||||
{
|
||||
key := middleware.ParameterKey{
|
||||
Name: "cursor",
|
||||
In: "query",
|
||||
}
|
||||
if v, ok := packed[key]; ok {
|
||||
params.Cursor = v.(OptString)
|
||||
}
|
||||
}
|
||||
return params
|
||||
}
|
||||
|
||||
func decodeListMySupportCasesParams(args [0]string, argsEscaped bool, r *http.Request) (params ListMySupportCasesParams, _ error) {
|
||||
q := uri.NewQueryDecoder(r.URL.Query())
|
||||
// Set default value for query: limit.
|
||||
{
|
||||
val := int32(20)
|
||||
params.Limit.SetTo(val)
|
||||
}
|
||||
// Decode query: limit.
|
||||
if err := func() error {
|
||||
cfg := uri.QueryParameterDecodingConfig{
|
||||
Name: "limit",
|
||||
Style: uri.QueryStyleForm,
|
||||
Explode: true,
|
||||
}
|
||||
|
||||
if err := q.HasParam(cfg); err == nil {
|
||||
if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
|
||||
var paramsDotLimitVal int32
|
||||
if err := func() error {
|
||||
val, err := d.DecodeValue()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
c, err := conv.ToInt32(val)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
paramsDotLimitVal = c
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return err
|
||||
}
|
||||
params.Limit.SetTo(paramsDotLimitVal)
|
||||
return nil
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := func() error {
|
||||
if value, ok := params.Limit.Get(); ok {
|
||||
if err := func() error {
|
||||
if err := (validate.Int{
|
||||
MinSet: true,
|
||||
Min: 1,
|
||||
MaxSet: true,
|
||||
Max: 100,
|
||||
MinExclusive: false,
|
||||
MaxExclusive: false,
|
||||
MultipleOfSet: false,
|
||||
MultipleOf: 0,
|
||||
Pattern: nil,
|
||||
}).Validate(int64(value)); err != nil {
|
||||
return errors.Wrap(err, "int")
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return params, &ogenerrors.DecodeParamError{
|
||||
Name: "limit",
|
||||
In: "query",
|
||||
Err: err,
|
||||
}
|
||||
}
|
||||
// Decode query: cursor.
|
||||
if err := func() error {
|
||||
cfg := uri.QueryParameterDecodingConfig{
|
||||
Name: "cursor",
|
||||
Style: uri.QueryStyleForm,
|
||||
Explode: true,
|
||||
}
|
||||
|
||||
if err := q.HasParam(cfg); err == nil {
|
||||
if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
|
||||
var paramsDotCursorVal string
|
||||
if err := func() error {
|
||||
val, err := d.DecodeValue()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
c, err := conv.ToString(val)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
paramsDotCursorVal = c
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return err
|
||||
}
|
||||
params.Cursor.SetTo(paramsDotCursorVal)
|
||||
return nil
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := func() error {
|
||||
if value, ok := params.Cursor.Get(); ok {
|
||||
if err := func() error {
|
||||
if err := (validate.String{
|
||||
MinLength: 1,
|
||||
MinLengthSet: true,
|
||||
MaxLength: 512,
|
||||
MaxLengthSet: true,
|
||||
Email: false,
|
||||
Hostname: false,
|
||||
Regex: regexMap["^[A-Za-z0-9_-]+$"],
|
||||
MinNumeric: 0,
|
||||
MinNumericSet: false,
|
||||
MaxNumeric: 0,
|
||||
MaxNumericSet: false,
|
||||
}).Validate(string(value)); err != nil {
|
||||
return errors.Wrap(err, "string")
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return params, &ogenerrors.DecodeParamError{
|
||||
Name: "cursor",
|
||||
In: "query",
|
||||
Err: err,
|
||||
}
|
||||
}
|
||||
return params, nil
|
||||
}
|
||||
|
||||
// ListOrganizationNeedsParams is parameters of ListOrganizationNeeds operation.
|
||||
type ListOrganizationNeedsParams struct {
|
||||
// Identifier of an organization. Access comes only from an active membership of the session account in
|
||||
|
||||
@@ -172,6 +172,85 @@ func (s *Server) decodeCreateMyAssessmentAttemptRequest(r *http.Request) (
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Server) decodeCreateMySupportCaseRequest(r *http.Request) (
|
||||
req SupportCaseCreate,
|
||||
rawBody []byte,
|
||||
close func() error,
|
||||
rerr error,
|
||||
) {
|
||||
var closers []func() error
|
||||
close = func() error {
|
||||
var merr error
|
||||
// Close in reverse order, to match defer behavior.
|
||||
for i := len(closers) - 1; i >= 0; i-- {
|
||||
c := closers[i]
|
||||
merr = errors.Join(merr, c())
|
||||
}
|
||||
return merr
|
||||
}
|
||||
defer func() {
|
||||
if rerr != nil {
|
||||
rerr = errors.Join(rerr, close())
|
||||
}
|
||||
}()
|
||||
ct, _, err := mime.ParseMediaType(r.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
return req, rawBody, close, errors.Wrap(err, "parse media type")
|
||||
}
|
||||
switch {
|
||||
case ct == "application/json":
|
||||
if r.ContentLength == 0 {
|
||||
return req, rawBody, close, validate.ErrBodyRequired
|
||||
}
|
||||
buf, err := io.ReadAll(r.Body)
|
||||
defer func() {
|
||||
_ = r.Body.Close()
|
||||
}()
|
||||
if err != nil {
|
||||
return req, rawBody, close, err
|
||||
}
|
||||
|
||||
// Reset the body to allow for downstream reading.
|
||||
r.Body = io.NopCloser(bytes.NewBuffer(buf))
|
||||
|
||||
if len(buf) == 0 {
|
||||
return req, rawBody, close, validate.ErrBodyRequired
|
||||
}
|
||||
|
||||
rawBody = append(rawBody, buf...)
|
||||
d := jx.DecodeBytes(buf)
|
||||
|
||||
var request SupportCaseCreate
|
||||
if err := func() error {
|
||||
if err := request.Decode(d); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := d.Skip(); err != io.EOF {
|
||||
return errors.New("unexpected trailing data")
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
err = &ogenerrors.DecodeBodyError{
|
||||
ContentType: ct,
|
||||
Body: buf,
|
||||
Err: err,
|
||||
}
|
||||
return req, rawBody, close, err
|
||||
}
|
||||
if err := func() error {
|
||||
if err := request.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return req, rawBody, close, errors.Wrap(err, "validate")
|
||||
}
|
||||
return request, rawBody, close, nil
|
||||
default:
|
||||
return req, rawBody, close, validate.InvalidContentType(ct)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Server) decodeCreateOrganizationNeedRequest(r *http.Request) (
|
||||
req *NeedCreate,
|
||||
rawBody []byte,
|
||||
|
||||
@@ -216,6 +216,145 @@ func encodeCreateMyAssessmentAttemptResponse(response CreateMyAssessmentAttemptR
|
||||
}
|
||||
}
|
||||
|
||||
func encodeCreateMySupportCaseResponse(response CreateMySupportCaseRes, w http.ResponseWriter, span trace.Span) error {
|
||||
switch response := response.(type) {
|
||||
case *SupportCaseHeaders:
|
||||
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
||||
// Encoding response headers.
|
||||
{
|
||||
h := uri.NewHeaderEncoder(w.Header())
|
||||
// Encode "Cache-Control" header.
|
||||
{
|
||||
cfg := uri.HeaderParameterEncodingConfig{
|
||||
Name: "Cache-Control",
|
||||
Explode: false,
|
||||
}
|
||||
if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
|
||||
return e.EncodeValue(conv.StringToString(string(response.CacheControl)))
|
||||
}); err != nil {
|
||||
return errors.Wrap(err, "encode Cache-Control header")
|
||||
}
|
||||
}
|
||||
}
|
||||
w.WriteHeader(201)
|
||||
|
||||
e := new(jx.Encoder)
|
||||
response.Response.Encode(e)
|
||||
if _, err := e.WriteTo(w); err != nil {
|
||||
return errors.Wrap(err, "write")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
case *CreateMySupportCaseBadRequest:
|
||||
w.Header().Set("Content-Type", "application/problem+json")
|
||||
w.WriteHeader(400)
|
||||
|
||||
e := new(jx.Encoder)
|
||||
response.Encode(e)
|
||||
if _, err := e.WriteTo(w); err != nil {
|
||||
return errors.Wrap(err, "write")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
case *CreateMySupportCaseUnauthorized:
|
||||
w.Header().Set("Content-Type", "application/problem+json")
|
||||
w.WriteHeader(401)
|
||||
|
||||
e := new(jx.Encoder)
|
||||
response.Encode(e)
|
||||
if _, err := e.WriteTo(w); err != nil {
|
||||
return errors.Wrap(err, "write")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
case *CreateMySupportCaseForbidden:
|
||||
w.Header().Set("Content-Type", "application/problem+json")
|
||||
w.WriteHeader(403)
|
||||
|
||||
e := new(jx.Encoder)
|
||||
response.Encode(e)
|
||||
if _, err := e.WriteTo(w); err != nil {
|
||||
return errors.Wrap(err, "write")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
case *CreateMySupportCaseNotFound:
|
||||
w.Header().Set("Content-Type", "application/problem+json")
|
||||
w.WriteHeader(404)
|
||||
|
||||
e := new(jx.Encoder)
|
||||
response.Encode(e)
|
||||
if _, err := e.WriteTo(w); err != nil {
|
||||
return errors.Wrap(err, "write")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
case *CreateMySupportCaseConflict:
|
||||
w.Header().Set("Content-Type", "application/problem+json")
|
||||
w.WriteHeader(409)
|
||||
|
||||
e := new(jx.Encoder)
|
||||
response.Encode(e)
|
||||
if _, err := e.WriteTo(w); err != nil {
|
||||
return errors.Wrap(err, "write")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
case *CreateMySupportCaseUnprocessableEntity:
|
||||
w.Header().Set("Content-Type", "application/problem+json")
|
||||
w.WriteHeader(422)
|
||||
|
||||
e := new(jx.Encoder)
|
||||
response.Encode(e)
|
||||
if _, err := e.WriteTo(w); err != nil {
|
||||
return errors.Wrap(err, "write")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
case *TooManyRequestsHeaders:
|
||||
w.Header().Set("Content-Type", "application/problem+json")
|
||||
w.Header().Set("Access-Control-Expose-Headers", "Retry-After")
|
||||
// Encoding response headers.
|
||||
{
|
||||
h := uri.NewHeaderEncoder(w.Header())
|
||||
// Encode "Retry-After" header.
|
||||
{
|
||||
cfg := uri.HeaderParameterEncodingConfig{
|
||||
Name: "Retry-After",
|
||||
Explode: false,
|
||||
}
|
||||
if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
|
||||
if val, ok := response.RetryAfter.Get(); ok {
|
||||
return e.EncodeValue(conv.Int32ToString(val))
|
||||
}
|
||||
return nil
|
||||
}); err != nil {
|
||||
return errors.Wrap(err, "encode Retry-After header")
|
||||
}
|
||||
}
|
||||
}
|
||||
w.WriteHeader(429)
|
||||
|
||||
e := new(jx.Encoder)
|
||||
response.Response.Encode(e)
|
||||
if _, err := e.WriteTo(w); err != nil {
|
||||
return errors.Wrap(err, "write")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
default:
|
||||
return errors.Errorf("unexpected response type: %T", response)
|
||||
}
|
||||
}
|
||||
|
||||
func encodeCreateOrganizationNeedResponse(response CreateOrganizationNeedRes, w http.ResponseWriter, span trace.Span) error {
|
||||
switch response := response.(type) {
|
||||
case *NeedHeaders:
|
||||
@@ -884,6 +1023,77 @@ func encodeGetMyQuestionnaireResponse(response GetMyQuestionnaireRes, w http.Res
|
||||
}
|
||||
}
|
||||
|
||||
func encodeGetMySupportCaseResponse(response GetMySupportCaseRes, w http.ResponseWriter, span trace.Span) error {
|
||||
switch response := response.(type) {
|
||||
case *SupportCaseHeaders:
|
||||
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
||||
// Encoding response headers.
|
||||
{
|
||||
h := uri.NewHeaderEncoder(w.Header())
|
||||
// Encode "Cache-Control" header.
|
||||
{
|
||||
cfg := uri.HeaderParameterEncodingConfig{
|
||||
Name: "Cache-Control",
|
||||
Explode: false,
|
||||
}
|
||||
if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
|
||||
return e.EncodeValue(conv.StringToString(string(response.CacheControl)))
|
||||
}); err != nil {
|
||||
return errors.Wrap(err, "encode Cache-Control header")
|
||||
}
|
||||
}
|
||||
}
|
||||
w.WriteHeader(200)
|
||||
|
||||
e := new(jx.Encoder)
|
||||
response.Response.Encode(e)
|
||||
if _, err := e.WriteTo(w); err != nil {
|
||||
return errors.Wrap(err, "write")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
case *GetMySupportCaseBadRequest:
|
||||
w.Header().Set("Content-Type", "application/problem+json")
|
||||
w.WriteHeader(400)
|
||||
|
||||
e := new(jx.Encoder)
|
||||
response.Encode(e)
|
||||
if _, err := e.WriteTo(w); err != nil {
|
||||
return errors.Wrap(err, "write")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
case *GetMySupportCaseUnauthorized:
|
||||
w.Header().Set("Content-Type", "application/problem+json")
|
||||
w.WriteHeader(401)
|
||||
|
||||
e := new(jx.Encoder)
|
||||
response.Encode(e)
|
||||
if _, err := e.WriteTo(w); err != nil {
|
||||
return errors.Wrap(err, "write")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
case *GetMySupportCaseNotFound:
|
||||
w.Header().Set("Content-Type", "application/problem+json")
|
||||
w.WriteHeader(404)
|
||||
|
||||
e := new(jx.Encoder)
|
||||
response.Encode(e)
|
||||
if _, err := e.WriteTo(w); err != nil {
|
||||
return errors.Wrap(err, "write")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
default:
|
||||
return errors.Errorf("unexpected response type: %T", response)
|
||||
}
|
||||
}
|
||||
|
||||
func encodeGetOrganizationNeedResponse(response GetOrganizationNeedRes, w http.ResponseWriter, span trace.Span) error {
|
||||
switch response := response.(type) {
|
||||
case *NeedHeaders:
|
||||
@@ -980,6 +1190,65 @@ func encodeGetSpecializationCatalogResponse(response *SpecializationCatalog, w h
|
||||
return nil
|
||||
}
|
||||
|
||||
func encodeListMySupportCasesResponse(response ListMySupportCasesRes, w http.ResponseWriter, span trace.Span) error {
|
||||
switch response := response.(type) {
|
||||
case *SupportCaseListHeaders:
|
||||
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
||||
// Encoding response headers.
|
||||
{
|
||||
h := uri.NewHeaderEncoder(w.Header())
|
||||
// Encode "Cache-Control" header.
|
||||
{
|
||||
cfg := uri.HeaderParameterEncodingConfig{
|
||||
Name: "Cache-Control",
|
||||
Explode: false,
|
||||
}
|
||||
if err := h.EncodeParam(cfg, func(e uri.Encoder) error {
|
||||
return e.EncodeValue(conv.StringToString(string(response.CacheControl)))
|
||||
}); err != nil {
|
||||
return errors.Wrap(err, "encode Cache-Control header")
|
||||
}
|
||||
}
|
||||
}
|
||||
w.WriteHeader(200)
|
||||
|
||||
e := new(jx.Encoder)
|
||||
response.Response.Encode(e)
|
||||
if _, err := e.WriteTo(w); err != nil {
|
||||
return errors.Wrap(err, "write")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
case *ListMySupportCasesBadRequest:
|
||||
w.Header().Set("Content-Type", "application/problem+json")
|
||||
w.WriteHeader(400)
|
||||
|
||||
e := new(jx.Encoder)
|
||||
response.Encode(e)
|
||||
if _, err := e.WriteTo(w); err != nil {
|
||||
return errors.Wrap(err, "write")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
case *ListMySupportCasesUnauthorized:
|
||||
w.Header().Set("Content-Type", "application/problem+json")
|
||||
w.WriteHeader(401)
|
||||
|
||||
e := new(jx.Encoder)
|
||||
response.Encode(e)
|
||||
if _, err := e.WriteTo(w); err != nil {
|
||||
return errors.Wrap(err, "write")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
default:
|
||||
return errors.Errorf("unexpected response type: %T", response)
|
||||
}
|
||||
}
|
||||
|
||||
func encodeListOrganizationNeedsResponse(response ListOrganizationNeedsRes, w http.ResponseWriter, span trace.Span) error {
|
||||
switch response := response.(type) {
|
||||
case *NeedListHeaders:
|
||||
|
||||
@@ -11,37 +11,40 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
rn28AllowedHeaders = map[string]string{
|
||||
rn31AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type",
|
||||
}
|
||||
rn1AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type",
|
||||
}
|
||||
rn26AllowedHeaders = map[string]string{
|
||||
rn29AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type,Idempotency-Key",
|
||||
}
|
||||
rn25AllowedHeaders = map[string]string{
|
||||
rn28AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type",
|
||||
}
|
||||
rn14AllowedHeaders = map[string]string{
|
||||
rn16AllowedHeaders = map[string]string{
|
||||
"DELETE": "X-Csrf-Token",
|
||||
}
|
||||
rn3AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type,Idempotency-Key,X-Csrf-Token",
|
||||
}
|
||||
rn29AllowedHeaders = map[string]string{
|
||||
rn32AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type,Idempotency-Key,X-Csrf-Token",
|
||||
}
|
||||
rn9AllowedHeaders = map[string]string{
|
||||
rn11AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type,Idempotency-Key,X-Csrf-Token",
|
||||
}
|
||||
rn21AllowedHeaders = map[string]string{
|
||||
rn22AllowedHeaders = map[string]string{
|
||||
"PUT": "Content-Type,X-Csrf-Token",
|
||||
}
|
||||
rn6AllowedHeaders = map[string]string{
|
||||
rn5AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type,Idempotency-Key,X-Csrf-Token",
|
||||
}
|
||||
rn23AllowedHeaders = map[string]string{
|
||||
rn8AllowedHeaders = map[string]string{
|
||||
"POST": "Content-Type,Idempotency-Key,X-Csrf-Token",
|
||||
}
|
||||
rn26AllowedHeaders = map[string]string{
|
||||
"PATCH": "Content-Type,X-Csrf-Token",
|
||||
}
|
||||
)
|
||||
@@ -198,7 +201,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "POST",
|
||||
allowedHeaders: rn28AllowedHeaders,
|
||||
allowedHeaders: rn31AllowedHeaders,
|
||||
acceptPost: "application/json",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -275,7 +278,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "POST",
|
||||
allowedHeaders: rn26AllowedHeaders,
|
||||
allowedHeaders: rn29AllowedHeaders,
|
||||
acceptPost: "application/json",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -299,7 +302,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "POST",
|
||||
allowedHeaders: rn25AllowedHeaders,
|
||||
allowedHeaders: rn28AllowedHeaders,
|
||||
acceptPost: "application/json",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -326,7 +329,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "DELETE,GET",
|
||||
allowedHeaders: rn14AllowedHeaders,
|
||||
allowedHeaders: rn16AllowedHeaders,
|
||||
acceptPost: "",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -452,7 +455,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "POST",
|
||||
allowedHeaders: rn29AllowedHeaders,
|
||||
allowedHeaders: rn32AllowedHeaders,
|
||||
acceptPost: "application/json",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -479,7 +482,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "POST",
|
||||
allowedHeaders: rn9AllowedHeaders,
|
||||
allowedHeaders: rn11AllowedHeaders,
|
||||
acceptPost: "application/json",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -566,7 +569,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "GET,PUT",
|
||||
allowedHeaders: rn21AllowedHeaders,
|
||||
allowedHeaders: rn22AllowedHeaders,
|
||||
acceptPost: "",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -575,6 +578,70 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
case 's': // Prefix: "support-cases"
|
||||
|
||||
if l := len("support-cases"); len(elem) >= l && elem[0:l] == "support-cases" {
|
||||
elem = elem[l:]
|
||||
} else {
|
||||
break
|
||||
}
|
||||
|
||||
if len(elem) == 0 {
|
||||
switch r.Method {
|
||||
case "GET":
|
||||
s.handleListMySupportCasesRequest([0]string{}, elemIsEscaped, w, r)
|
||||
case "POST":
|
||||
s.handleCreateMySupportCaseRequest([0]string{}, elemIsEscaped, w, r)
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "GET,POST",
|
||||
allowedHeaders: rn5AllowedHeaders,
|
||||
acceptPost: "application/json",
|
||||
acceptPatch: "",
|
||||
})
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
switch elem[0] {
|
||||
case '/': // Prefix: "/"
|
||||
|
||||
if l := len("/"); len(elem) >= l && elem[0:l] == "/" {
|
||||
elem = elem[l:]
|
||||
} else {
|
||||
break
|
||||
}
|
||||
|
||||
// Param: "case_id"
|
||||
// Leaf parameter, slashes are prohibited
|
||||
idx := strings.IndexByte(elem, '/')
|
||||
if idx >= 0 {
|
||||
break
|
||||
}
|
||||
args[0] = elem
|
||||
elem = ""
|
||||
|
||||
if len(elem) == 0 {
|
||||
// Leaf node.
|
||||
switch r.Method {
|
||||
case "GET":
|
||||
s.handleGetMySupportCaseRequest([1]string{
|
||||
args[0],
|
||||
}, elemIsEscaped, w, r)
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "GET",
|
||||
allowedHeaders: nil,
|
||||
acceptPost: "",
|
||||
acceptPatch: "",
|
||||
})
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
case 'o': // Prefix: "organizations/"
|
||||
@@ -619,7 +686,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "GET,POST",
|
||||
allowedHeaders: rn6AllowedHeaders,
|
||||
allowedHeaders: rn8AllowedHeaders,
|
||||
acceptPost: "application/json",
|
||||
acceptPatch: "",
|
||||
})
|
||||
@@ -661,7 +728,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
default:
|
||||
s.notAllowed(w, r, notAllowedParams{
|
||||
allowedMethods: "GET,PATCH",
|
||||
allowedHeaders: rn23AllowedHeaders,
|
||||
allowedHeaders: rn26AllowedHeaders,
|
||||
acceptPost: "",
|
||||
acceptPatch: "application/json",
|
||||
})
|
||||
@@ -1281,6 +1348,75 @@ func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool) {
|
||||
}
|
||||
}
|
||||
|
||||
case 's': // Prefix: "support-cases"
|
||||
|
||||
if l := len("support-cases"); len(elem) >= l && elem[0:l] == "support-cases" {
|
||||
elem = elem[l:]
|
||||
} else {
|
||||
break
|
||||
}
|
||||
|
||||
if len(elem) == 0 {
|
||||
switch method {
|
||||
case "GET":
|
||||
r.name = ListMySupportCasesOperation
|
||||
r.summary = "List the support cases of the current account."
|
||||
r.operationID = "ListMySupportCases"
|
||||
r.operationGroup = ""
|
||||
r.pathPattern = "/api/v1/me/support-cases"
|
||||
r.args = args
|
||||
r.count = 0
|
||||
return r, true
|
||||
case "POST":
|
||||
r.name = CreateMySupportCaseOperation
|
||||
r.summary = "Open a support case, a complaint, an appeal, or a manual assessment request."
|
||||
r.operationID = "CreateMySupportCase"
|
||||
r.operationGroup = ""
|
||||
r.pathPattern = "/api/v1/me/support-cases"
|
||||
r.args = args
|
||||
r.count = 0
|
||||
return r, true
|
||||
default:
|
||||
return
|
||||
}
|
||||
}
|
||||
switch elem[0] {
|
||||
case '/': // Prefix: "/"
|
||||
|
||||
if l := len("/"); len(elem) >= l && elem[0:l] == "/" {
|
||||
elem = elem[l:]
|
||||
} else {
|
||||
break
|
||||
}
|
||||
|
||||
// Param: "case_id"
|
||||
// Leaf parameter, slashes are prohibited
|
||||
idx := strings.IndexByte(elem, '/')
|
||||
if idx >= 0 {
|
||||
break
|
||||
}
|
||||
args[0] = elem
|
||||
elem = ""
|
||||
|
||||
if len(elem) == 0 {
|
||||
// Leaf node.
|
||||
switch method {
|
||||
case "GET":
|
||||
r.name = GetMySupportCaseOperation
|
||||
r.summary = "Read a support case of the current account."
|
||||
r.operationID = "GetMySupportCase"
|
||||
r.operationGroup = ""
|
||||
r.pathPattern = "/api/v1/me/support-cases/{case_id}"
|
||||
r.args = args
|
||||
r.count = 1
|
||||
return r, true
|
||||
default:
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
case 'o': // Prefix: "organizations/"
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -57,6 +57,7 @@ func findAuthorization(h http.Header, prefix string) (string, bool) {
|
||||
// operationRolesSessionCookie is a private map storing roles per operation.
|
||||
var operationRolesSessionCookie = map[string][]string{
|
||||
CreateMyAssessmentAttemptOperation: []string{},
|
||||
CreateMySupportCaseOperation: []string{},
|
||||
CreateOrganizationNeedOperation: []string{},
|
||||
FinalizeMyAssessmentAttemptOperation: []string{},
|
||||
GetCurrentAccountOperation: []string{},
|
||||
@@ -65,7 +66,9 @@ var operationRolesSessionCookie = map[string][]string{
|
||||
GetMyAssessmentAvailabilityOperation: []string{},
|
||||
GetMyAssessmentResultOperation: []string{},
|
||||
GetMyQuestionnaireOperation: []string{},
|
||||
GetMySupportCaseOperation: []string{},
|
||||
GetOrganizationNeedOperation: []string{},
|
||||
ListMySupportCasesOperation: []string{},
|
||||
ListOrganizationNeedsOperation: []string{},
|
||||
LogoutOperation: []string{},
|
||||
SaveMyQuestionnaireOperation: []string{},
|
||||
@@ -97,6 +100,7 @@ func GetRolesForSessionCookie(operation string) []string {
|
||||
// operationRolesSessionCsrf is a private map storing roles per operation.
|
||||
var operationRolesSessionCsrf = map[string][]string{
|
||||
CreateMyAssessmentAttemptOperation: []string{},
|
||||
CreateMySupportCaseOperation: []string{},
|
||||
CreateOrganizationNeedOperation: []string{},
|
||||
FinalizeMyAssessmentAttemptOperation: []string{},
|
||||
LogoutOperation: []string{},
|
||||
|
||||
@@ -74,6 +74,97 @@ type Handler interface {
|
||||
//
|
||||
// POST /api/v1/me/assessment-attempts
|
||||
CreateMyAssessmentAttempt(ctx context.Context, req *AssessmentAttemptCreate, params CreateMyAssessmentAttemptParams) (CreateMyAssessmentAttemptRes, error)
|
||||
// CreateMySupportCase implements CreateMySupportCase operation.
|
||||
//
|
||||
// Requires the session cookie, the CSRF token of that session in X-CSRF-Token, an allowed Origin, and
|
||||
// an Idempotency-Key. The author is the account of the session; the body has no user, account, or
|
||||
// organization field. A case is reachable from any screen, including a screen that denies access to an
|
||||
// assessment: being refused an action never removes the path to a case about it.
|
||||
//
|
||||
// The client sends only what the user states: `type`, a non-blank `description`, and the fields of the
|
||||
// type. It never sets the status, the decision, the outcome, the priority, the response target, the
|
||||
// rubric, the assignee, or the moderator: every variant has `additionalProperties: false`, so such
|
||||
// fields answer 400. Attachments are not part of the MVP; they are planned as an optional field and
|
||||
// change no existing one.
|
||||
//
|
||||
// Types, accounts, and allowed references:
|
||||
//
|
||||
// Type | Accounts | Object reference | Other fields
|
||||
// --------------------+---------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------
|
||||
// `support` | candidate, employer | optional; `assessment_attempt` of the caller, an `organization` that the caller can see, an `invitation` addressed to the caller, or another `support_case` of the caller | optional `assessment_target`
|
||||
// `complaint` | candidate | required; an `organization` that the caller can see or an `invitation` addressed to the caller | required `complaint_reason`; `offer_content` and `salary_terms_violation` require an invitation
|
||||
// `grade_appeal` | candidate | required; `assessment_attempt` of the caller in a terminal state, so it has a result, or a `support_case` of the caller of type `manual_assessment` that is `resolved` with the outcome `assessed`, for a category that an expert assigned without an attempt | none
|
||||
// `anticheat_appeal` | candidate | required; `assessment_attempt` of the caller with an anti-cheat review decision | none
|
||||
// `manual_assessment` | candidate | optional; a prior `assessment_attempt` of the caller in the same specialization | required `assessment_target`
|
||||
//
|
||||
// An organization is visible to a candidate when it sent the candidate an invitation or when the
|
||||
// organization contract (TASK-077) shows the candidate its profile, and to an employer account when
|
||||
// the account has an active membership in it. Invitations are not in the contract yet, so until they
|
||||
// are, every `invitation` reference answers 404 not_found; anti-cheat review decisions are not either,
|
||||
// so until TASK-173 every anti-cheat appeal answers 409 state_conflict. The schema rejects an object
|
||||
// type that the case type does not accept, for example an organization in a grade appeal.
|
||||
//
|
||||
// Ownership of the reference: the server checks the object against the session account on every
|
||||
// create. An unknown object and an object of someone else, such as another candidate's attempt,
|
||||
// another account's case, or an invitation addressed to another person, both answer 404 not_found, so
|
||||
// a reference never reveals whether a foreign object exists. An own case that a grade appeal cannot
|
||||
// dispute, because it is not a manual assessment, is not resolved yet, or was resolved with another
|
||||
// outcome, answers 409 state_conflict. An identifier that is not a UUID fails validation with the
|
||||
// whole-body pointer, because the decoder does not record the path inside the selected variant. The
|
||||
// case stores only the type and the identifier of the object.
|
||||
//
|
||||
// Limits: an attempt and a resolved manual assessment each accept at most one grade appeal, and an
|
||||
// attempt at most one anti-cheat appeal, in any status; a disagreement with the decision goes into a
|
||||
// support case that references the appeal as `support_case`. A specialization accepts one open manual
|
||||
// assessment, and an object accepts one open complaint; open means not `resolved` or `closed`. A
|
||||
// second one answers 409 state_conflict. A grade appeal of an attempt that is still active also
|
||||
// answers 409. Every create that passed authentication, validation, and the account scenario counts
|
||||
// against a per-account limit from the product policy, including replays, 404, and 409, so the limit
|
||||
// also bounds probing of references; over the limit the server answers 429 with Retry-After and
|
||||
// creates nothing.
|
||||
//
|
||||
// Description check: the schema pattern `\S` uses the ECMAScript white space set in both generated
|
||||
// validators (ogen converts it for Go), so a description of spaces such as U+00A0 or U+3000 already
|
||||
// fails validation with the pointer `/description`. ECMAScript white space omits U+0085 (NEL), which
|
||||
// Go `unicode.IsSpace` includes, so the server also applies a domain check: a description whose every
|
||||
// character is `unicode.IsSpace` or U+FEFF answers 400 validation_failed with the pointer
|
||||
// `/description`. This check comes with the implementation; generated Zod accepts a description of
|
||||
// NEL, and the server stays authoritative.
|
||||
//
|
||||
// The new case gets a number and the status `submitted`. A grade appeal, an anti-cheat appeal, and a
|
||||
// manual assessment are moved to `waiting_expert` by a `system` event in the same transaction, so the
|
||||
// 201 already shows that status with both events; a support case and a complaint stay `submitted`.
|
||||
// Each case gets a response target from the product policy version and the configured business
|
||||
// calendar: 5 business days for a manual assessment and 10 for an appeal (PRD FR18 and C3), and a
|
||||
// policy value for support and complaints. The target is an operational goal, not a deadline set by
|
||||
// law. A manual assessment fixes the published rubric version of the category, or null when the
|
||||
// category has none yet; the expert assesses with the same rubric as the automated assessment, and the
|
||||
// request assigns no category by itself. Creating a case never grants, revokes, or changes a consent,
|
||||
// a grade, or an attempt.
|
||||
//
|
||||
// Replies: the case itself is the channel. Support replies and decisions appear in the public
|
||||
// `history` and `decision`. The server may also notify the verified email address of the account that
|
||||
// the case changed, with the case number and a link, never with the description, the reply, or
|
||||
// assessment details. No request field names another address or contact, so the operation cannot send
|
||||
// mail to an address that the user typed.
|
||||
//
|
||||
// Idempotency: a retry with the same key and body within 24 hours replays the stored 201 with the same
|
||||
// number and creates nothing, so a lost response never opens a second case. The replay is the snapshot
|
||||
// stored at creation, following the repository convention; the client reads the current status and
|
||||
// history with GetMySupportCase. 404 and 409 state_conflict are stored and replayed as well. A
|
||||
// different body with the same key answers 422 idempotency_key_reused. 400, 403, and 429 are never
|
||||
// stored.
|
||||
//
|
||||
// Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400),
|
||||
// account scenario (403 forbidden for an employer account with a type other than `support`), the
|
||||
// per-account case limit (429), the Idempotency-Key (422, 409 idempotency_in_progress, replay), domain
|
||||
// rules (400 with the pointer `/description` for a text of only Unicode spaces or `/object/type` for a
|
||||
// complaint reason that requires an invitation), the object reference (404 not_found), then the state
|
||||
// of the object and the limits (409 state_conflict). The general rate limit can answer 429 with
|
||||
// Retry-After before any check.
|
||||
//
|
||||
// POST /api/v1/me/support-cases
|
||||
CreateMySupportCase(ctx context.Context, req SupportCaseCreate, params CreateMySupportCaseParams) (CreateMySupportCaseRes, error)
|
||||
// CreateOrganizationNeed implements CreateOrganizationNeed operation.
|
||||
//
|
||||
// Requires the session cookie of an employer account with an active membership in `org_id`, the CSRF
|
||||
@@ -287,6 +378,28 @@ type Handler interface {
|
||||
//
|
||||
// GET /api/v1/me/questionnaire
|
||||
GetMyQuestionnaire(ctx context.Context) (GetMyQuestionnaireRes, error)
|
||||
// GetMySupportCase implements GetMySupportCase operation.
|
||||
//
|
||||
// Requires the session cookie of a candidate or an employer account. Returns the case with its number,
|
||||
// type, object reference, status, response target, decision, and public history. The owner reads the
|
||||
// case whatever happened to the object since then: a revoked access, a closed invitation, or a refused
|
||||
// test never hides the case from its author.
|
||||
//
|
||||
// The case never contains the identity of a moderator, an expert, or a support agent, internal notes,
|
||||
// evidence, assessment answers, anti-cheat or risk signals, or contact data of another person.
|
||||
// `decision` is null until the case is `resolved`.
|
||||
//
|
||||
// The history lists every public event and is never truncated: the server keeps a case within 200
|
||||
// events by rejecting a staff event that would leave no room for the terminal one.
|
||||
//
|
||||
// The case must belong to the account of the session: a case of another account, including another
|
||||
// member of the same organization, answers 404 not_found, the same as an unknown identifier, so
|
||||
// identifiers cannot be probed. TASK-314 says forbidden for a foreign case URL; the contract answers
|
||||
// 404 instead, so the client shows the same "not found" state for a foreign and an unknown case. A
|
||||
// malformed `case_id` answers 400 validation_failed with the path pointer.
|
||||
//
|
||||
// GET /api/v1/me/support-cases/{case_id}
|
||||
GetMySupportCase(ctx context.Context, params GetMySupportCaseParams) (GetMySupportCaseRes, error)
|
||||
// GetOrganizationNeed implements GetOrganizationNeed operation.
|
||||
//
|
||||
// Requires the session cookie of an employer account with an active membership in `org_id`. The
|
||||
@@ -338,6 +451,21 @@ type Handler interface {
|
||||
//
|
||||
// GET /api/v1/specializations
|
||||
GetSpecializationCatalog(ctx context.Context) (*SpecializationCatalog, error)
|
||||
// ListMySupportCases implements ListMySupportCases operation.
|
||||
//
|
||||
// Requires the session cookie of a candidate or an employer account. Returns a page of the cases that
|
||||
// this account created, newest first by creation time with the identifier as the tie-breaker, with
|
||||
// cursor pagination. Each item is a summary with the number, type, status, object reference, category,
|
||||
// response target, and decision outcome; it has no description and no history, which GetMySupportCase
|
||||
// returns with the full case. Cases of other accounts are never listed, including cases of other
|
||||
// members of the same organization.
|
||||
//
|
||||
// Access: a missing, unknown, expired, or revoked session answers 401 unauthenticated. A malformed
|
||||
// `limit` or `cursor` answers 400 validation_failed. Filters by status and type are planned and add
|
||||
// optional parameters.
|
||||
//
|
||||
// GET /api/v1/me/support-cases
|
||||
ListMySupportCases(ctx context.Context, params ListMySupportCasesParams) (ListMySupportCasesRes, error)
|
||||
// ListOrganizationNeeds implements ListOrganizationNeeds operation.
|
||||
//
|
||||
// Requires the session cookie of an employer account with an active membership in `org_id`. The
|
||||
|
||||
@@ -85,6 +85,100 @@ func (UnimplementedHandler) CreateMyAssessmentAttempt(ctx context.Context, req *
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// CreateMySupportCase implements CreateMySupportCase operation.
|
||||
//
|
||||
// Requires the session cookie, the CSRF token of that session in X-CSRF-Token, an allowed Origin, and
|
||||
// an Idempotency-Key. The author is the account of the session; the body has no user, account, or
|
||||
// organization field. A case is reachable from any screen, including a screen that denies access to an
|
||||
// assessment: being refused an action never removes the path to a case about it.
|
||||
//
|
||||
// The client sends only what the user states: `type`, a non-blank `description`, and the fields of the
|
||||
// type. It never sets the status, the decision, the outcome, the priority, the response target, the
|
||||
// rubric, the assignee, or the moderator: every variant has `additionalProperties: false`, so such
|
||||
// fields answer 400. Attachments are not part of the MVP; they are planned as an optional field and
|
||||
// change no existing one.
|
||||
//
|
||||
// Types, accounts, and allowed references:
|
||||
//
|
||||
// Type | Accounts | Object reference | Other fields
|
||||
// --------------------+---------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------
|
||||
// `support` | candidate, employer | optional; `assessment_attempt` of the caller, an `organization` that the caller can see, an `invitation` addressed to the caller, or another `support_case` of the caller | optional `assessment_target`
|
||||
// `complaint` | candidate | required; an `organization` that the caller can see or an `invitation` addressed to the caller | required `complaint_reason`; `offer_content` and `salary_terms_violation` require an invitation
|
||||
// `grade_appeal` | candidate | required; `assessment_attempt` of the caller in a terminal state, so it has a result, or a `support_case` of the caller of type `manual_assessment` that is `resolved` with the outcome `assessed`, for a category that an expert assigned without an attempt | none
|
||||
// `anticheat_appeal` | candidate | required; `assessment_attempt` of the caller with an anti-cheat review decision | none
|
||||
// `manual_assessment` | candidate | optional; a prior `assessment_attempt` of the caller in the same specialization | required `assessment_target`
|
||||
//
|
||||
// An organization is visible to a candidate when it sent the candidate an invitation or when the
|
||||
// organization contract (TASK-077) shows the candidate its profile, and to an employer account when
|
||||
// the account has an active membership in it. Invitations are not in the contract yet, so until they
|
||||
// are, every `invitation` reference answers 404 not_found; anti-cheat review decisions are not either,
|
||||
// so until TASK-173 every anti-cheat appeal answers 409 state_conflict. The schema rejects an object
|
||||
// type that the case type does not accept, for example an organization in a grade appeal.
|
||||
//
|
||||
// Ownership of the reference: the server checks the object against the session account on every
|
||||
// create. An unknown object and an object of someone else, such as another candidate's attempt,
|
||||
// another account's case, or an invitation addressed to another person, both answer 404 not_found, so
|
||||
// a reference never reveals whether a foreign object exists. An own case that a grade appeal cannot
|
||||
// dispute, because it is not a manual assessment, is not resolved yet, or was resolved with another
|
||||
// outcome, answers 409 state_conflict. An identifier that is not a UUID fails validation with the
|
||||
// whole-body pointer, because the decoder does not record the path inside the selected variant. The
|
||||
// case stores only the type and the identifier of the object.
|
||||
//
|
||||
// Limits: an attempt and a resolved manual assessment each accept at most one grade appeal, and an
|
||||
// attempt at most one anti-cheat appeal, in any status; a disagreement with the decision goes into a
|
||||
// support case that references the appeal as `support_case`. A specialization accepts one open manual
|
||||
// assessment, and an object accepts one open complaint; open means not `resolved` or `closed`. A
|
||||
// second one answers 409 state_conflict. A grade appeal of an attempt that is still active also
|
||||
// answers 409. Every create that passed authentication, validation, and the account scenario counts
|
||||
// against a per-account limit from the product policy, including replays, 404, and 409, so the limit
|
||||
// also bounds probing of references; over the limit the server answers 429 with Retry-After and
|
||||
// creates nothing.
|
||||
//
|
||||
// Description check: the schema pattern `\S` uses the ECMAScript white space set in both generated
|
||||
// validators (ogen converts it for Go), so a description of spaces such as U+00A0 or U+3000 already
|
||||
// fails validation with the pointer `/description`. ECMAScript white space omits U+0085 (NEL), which
|
||||
// Go `unicode.IsSpace` includes, so the server also applies a domain check: a description whose every
|
||||
// character is `unicode.IsSpace` or U+FEFF answers 400 validation_failed with the pointer
|
||||
// `/description`. This check comes with the implementation; generated Zod accepts a description of
|
||||
// NEL, and the server stays authoritative.
|
||||
//
|
||||
// The new case gets a number and the status `submitted`. A grade appeal, an anti-cheat appeal, and a
|
||||
// manual assessment are moved to `waiting_expert` by a `system` event in the same transaction, so the
|
||||
// 201 already shows that status with both events; a support case and a complaint stay `submitted`.
|
||||
// Each case gets a response target from the product policy version and the configured business
|
||||
// calendar: 5 business days for a manual assessment and 10 for an appeal (PRD FR18 and C3), and a
|
||||
// policy value for support and complaints. The target is an operational goal, not a deadline set by
|
||||
// law. A manual assessment fixes the published rubric version of the category, or null when the
|
||||
// category has none yet; the expert assesses with the same rubric as the automated assessment, and the
|
||||
// request assigns no category by itself. Creating a case never grants, revokes, or changes a consent,
|
||||
// a grade, or an attempt.
|
||||
//
|
||||
// Replies: the case itself is the channel. Support replies and decisions appear in the public
|
||||
// `history` and `decision`. The server may also notify the verified email address of the account that
|
||||
// the case changed, with the case number and a link, never with the description, the reply, or
|
||||
// assessment details. No request field names another address or contact, so the operation cannot send
|
||||
// mail to an address that the user typed.
|
||||
//
|
||||
// Idempotency: a retry with the same key and body within 24 hours replays the stored 201 with the same
|
||||
// number and creates nothing, so a lost response never opens a second case. The replay is the snapshot
|
||||
// stored at creation, following the repository convention; the client reads the current status and
|
||||
// history with GetMySupportCase. 404 and 409 state_conflict are stored and replayed as well. A
|
||||
// different body with the same key answers 422 idempotency_key_reused. 400, 403, and 429 are never
|
||||
// stored.
|
||||
//
|
||||
// Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400),
|
||||
// account scenario (403 forbidden for an employer account with a type other than `support`), the
|
||||
// per-account case limit (429), the Idempotency-Key (422, 409 idempotency_in_progress, replay), domain
|
||||
// rules (400 with the pointer `/description` for a text of only Unicode spaces or `/object/type` for a
|
||||
// complaint reason that requires an invitation), the object reference (404 not_found), then the state
|
||||
// of the object and the limits (409 state_conflict). The general rate limit can answer 429 with
|
||||
// Retry-After before any check.
|
||||
//
|
||||
// POST /api/v1/me/support-cases
|
||||
func (UnimplementedHandler) CreateMySupportCase(ctx context.Context, req SupportCaseCreate, params CreateMySupportCaseParams) (r CreateMySupportCaseRes, _ error) {
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// CreateOrganizationNeed implements CreateOrganizationNeed operation.
|
||||
//
|
||||
// Requires the session cookie of an employer account with an active membership in `org_id`, the CSRF
|
||||
@@ -328,6 +422,31 @@ func (UnimplementedHandler) GetMyQuestionnaire(ctx context.Context) (r GetMyQues
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// GetMySupportCase implements GetMySupportCase operation.
|
||||
//
|
||||
// Requires the session cookie of a candidate or an employer account. Returns the case with its number,
|
||||
// type, object reference, status, response target, decision, and public history. The owner reads the
|
||||
// case whatever happened to the object since then: a revoked access, a closed invitation, or a refused
|
||||
// test never hides the case from its author.
|
||||
//
|
||||
// The case never contains the identity of a moderator, an expert, or a support agent, internal notes,
|
||||
// evidence, assessment answers, anti-cheat or risk signals, or contact data of another person.
|
||||
// `decision` is null until the case is `resolved`.
|
||||
//
|
||||
// The history lists every public event and is never truncated: the server keeps a case within 200
|
||||
// events by rejecting a staff event that would leave no room for the terminal one.
|
||||
//
|
||||
// The case must belong to the account of the session: a case of another account, including another
|
||||
// member of the same organization, answers 404 not_found, the same as an unknown identifier, so
|
||||
// identifiers cannot be probed. TASK-314 says forbidden for a foreign case URL; the contract answers
|
||||
// 404 instead, so the client shows the same "not found" state for a foreign and an unknown case. A
|
||||
// malformed `case_id` answers 400 validation_failed with the path pointer.
|
||||
//
|
||||
// GET /api/v1/me/support-cases/{case_id}
|
||||
func (UnimplementedHandler) GetMySupportCase(ctx context.Context, params GetMySupportCaseParams) (r GetMySupportCaseRes, _ error) {
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// GetOrganizationNeed implements GetOrganizationNeed operation.
|
||||
//
|
||||
// Requires the session cookie of an employer account with an active membership in `org_id`. The
|
||||
@@ -385,6 +504,24 @@ func (UnimplementedHandler) GetSpecializationCatalog(ctx context.Context) (r *Sp
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// ListMySupportCases implements ListMySupportCases operation.
|
||||
//
|
||||
// Requires the session cookie of a candidate or an employer account. Returns a page of the cases that
|
||||
// this account created, newest first by creation time with the identifier as the tie-breaker, with
|
||||
// cursor pagination. Each item is a summary with the number, type, status, object reference, category,
|
||||
// response target, and decision outcome; it has no description and no history, which GetMySupportCase
|
||||
// returns with the full case. Cases of other accounts are never listed, including cases of other
|
||||
// members of the same organization.
|
||||
//
|
||||
// Access: a missing, unknown, expired, or revoked session answers 401 unauthenticated. A malformed
|
||||
// `limit` or `cursor` answers 400 validation_failed. Filters by status and type are planned and add
|
||||
// optional parameters.
|
||||
//
|
||||
// GET /api/v1/me/support-cases
|
||||
func (UnimplementedHandler) ListMySupportCases(ctx context.Context, params ListMySupportCasesParams) (r ListMySupportCasesRes, _ error) {
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// ListOrganizationNeeds implements ListOrganizationNeeds operation.
|
||||
//
|
||||
// Requires the session cookie of an employer account with an active membership in `org_id`. The
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user