feat(visibility): add the candidate publication, hiding and search status contract

This commit is contained in:
shira committed 2026-10-07 00:15:52 +03:00
1 parent 4436f626a3
commit 0529601021
87 files changed
+21456 -83

No files matched your search

@@ -11,16 +11,16 @@ import (
)
var (
rn49AllowedHeaders = map[string]string{
rn59AllowedHeaders = map[string]string{
"POST": "Content-Type",
}
rn7AllowedHeaders = map[string]string{
"POST": "Content-Type",
}
rn47AllowedHeaders = map[string]string{
rn57AllowedHeaders = map[string]string{
"POST": "Content-Type,Idempotency-Key",
}
rn44AllowedHeaders = map[string]string{
rn54AllowedHeaders = map[string]string{
"POST": "Content-Type",
}
rn25AllowedHeaders = map[string]string{
@@ -29,7 +29,7 @@ var (
rn9AllowedHeaders = map[string]string{
"POST": "Content-Type,Idempotency-Key,X-Csrf-Token",
}
rn52AllowedHeaders = map[string]string{
rn65AllowedHeaders = map[string]string{
"POST": "Content-Type,Idempotency-Key,X-Csrf-Token",
}
rn20AllowedHeaders = map[string]string{
@@ -44,13 +44,23 @@ var (
rn17AllowedHeaders = map[string]string{
"POST": "Content-Type,Idempotency-Key,X-Csrf-Token",
}
rn53AllowedHeaders = map[string]string{
rn66AllowedHeaders = map[string]string{
"POST": "X-Csrf-Token",
}
rn31AllowedHeaders = map[string]string{
rn46AllowedHeaders = map[string]string{
"DELETE": "X-Csrf-Token",
"PUT": "X-Csrf-Token",
}
rn63AllowedHeaders = map[string]string{
"PUT": "Content-Type,X-Csrf-Token",
}
rn32AllowedHeaders = map[string]string{
rn64AllowedHeaders = map[string]string{
"PUT": "Content-Type,X-Csrf-Token",
}
rn34AllowedHeaders = map[string]string{
"PUT": "Content-Type,X-Csrf-Token",
}
rn35AllowedHeaders = map[string]string{
"PUT": "Content-Type,X-Csrf-Token",
}
rn10AllowedHeaders = map[string]string{
@@ -65,22 +75,22 @@ var (
rn14AllowedHeaders = map[string]string{
"POST": "Content-Type,Idempotency-Key,X-Csrf-Token",
}
rn36AllowedHeaders = map[string]string{
rn39AllowedHeaders = map[string]string{
"PATCH": "Content-Type,X-Csrf-Token",
}
rn46AllowedHeaders = map[string]string{
rn56AllowedHeaders = map[string]string{
"POST": "Content-Type,Idempotency-Key,X-Csrf-Token",
}
rn51AllowedHeaders = map[string]string{
rn61AllowedHeaders = map[string]string{
"POST": "Content-Type,Idempotency-Key,X-Csrf-Token",
}
rn54AllowedHeaders = map[string]string{
rn67AllowedHeaders = map[string]string{
"POST": "Content-Type,Idempotency-Key,X-Csrf-Token",
}
rn16AllowedHeaders = map[string]string{
"POST": "Content-Type,Idempotency-Key,X-Csrf-Token",
}
rn39AllowedHeaders = map[string]string{
rn42AllowedHeaders = map[string]string{
"PATCH": "Content-Type,X-Csrf-Token",
}
)
@@ -237,7 +247,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
default:
s.notAllowed(w, r, notAllowedParams{
allowedMethods: "POST",
allowedHeaders: rn49AllowedHeaders,
allowedHeaders: rn59AllowedHeaders,
acceptPost: "application/json",
acceptPatch: "",
})
@@ -314,7 +324,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
default:
s.notAllowed(w, r, notAllowedParams{
allowedMethods: "POST",
allowedHeaders: rn47AllowedHeaders,
allowedHeaders: rn57AllowedHeaders,
acceptPost: "application/json",
acceptPatch: "",
})
@@ -338,7 +348,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
default:
s.notAllowed(w, r, notAllowedParams{
allowedMethods: "POST",
allowedHeaders: rn44AllowedHeaders,
allowedHeaders: rn54AllowedHeaders,
acceptPost: "application/json",
acceptPatch: "",
})
@@ -491,7 +501,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
default:
s.notAllowed(w, r, notAllowedParams{
allowedMethods: "POST",
allowedHeaders: rn52AllowedHeaders,
allowedHeaders: rn65AllowedHeaders,
acceptPost: "application/json",
acceptPatch: "",
})
@@ -782,7 +792,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
default:
s.notAllowed(w, r, notAllowedParams{
allowedMethods: "POST",
allowedHeaders: rn53AllowedHeaders,
allowedHeaders: rn66AllowedHeaders,
acceptPost: "",
acceptPatch: "",
})
@@ -822,31 +832,304 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
return
}
case 'p': // Prefix: "profile"
case 'p': // Prefix: "pr"
if l := len("profile"); len(elem) >= l && elem[0:l] == "profile" {
if l := len("pr"); len(elem) >= l && elem[0:l] == "pr" {
elem = elem[l:]
} else {
break
}
if len(elem) == 0 {
// Leaf node.
switch r.Method {
case "GET":
s.handleGetMyProfileRequest([0]string{}, elemIsEscaped, w, r)
case "PUT":
s.handleSaveMyProfileRequest([0]string{}, elemIsEscaped, w, r)
default:
s.notAllowed(w, r, notAllowedParams{
allowedMethods: "GET,PUT",
allowedHeaders: rn31AllowedHeaders,
acceptPost: "",
acceptPatch: "",
})
break
}
switch elem[0] {
case 'i': // Prefix: "ivacy"
if l := len("ivacy"); len(elem) >= l && elem[0:l] == "ivacy" {
elem = elem[l:]
} else {
break
}
if len(elem) == 0 {
switch r.Method {
case "GET":
s.handleGetMyPrivacySettingsRequest([0]string{}, elemIsEscaped, w, r)
default:
s.notAllowed(w, r, notAllowedParams{
allowedMethods: "GET",
allowedHeaders: nil,
acceptPost: "",
acceptPatch: "",
})
}
return
}
switch elem[0] {
case '/': // Prefix: "/"
if l := len("/"); len(elem) >= l && elem[0:l] == "/" {
elem = elem[l:]
} else {
break
}
if len(elem) == 0 {
break
}
switch elem[0] {
case 'a': // Prefix: "access-history"
if l := len("access-history"); len(elem) >= l && elem[0:l] == "access-history" {
elem = elem[l:]
} else {
break
}
if len(elem) == 0 {
// Leaf node.
switch r.Method {
case "GET":
s.handleListMyCardAccessHistoryRequest([0]string{}, elemIsEscaped, w, r)
default:
s.notAllowed(w, r, notAllowedParams{
allowedMethods: "GET",
allowedHeaders: nil,
acceptPost: "",
acceptPatch: "",
})
}
return
}
case 'h': // Prefix: "hi"
if l := len("hi"); len(elem) >= l && elem[0:l] == "hi" {
elem = elem[l:]
} else {
break
}
if len(elem) == 0 {
break
}
switch elem[0] {
case 'd': // Prefix: "dden-organizations"
if l := len("dden-organizations"); len(elem) >= l && elem[0:l] == "dden-organizations" {
elem = elem[l:]
} else {
break
}
if len(elem) == 0 {
switch r.Method {
case "GET":
s.handleListMyHiddenOrganizationsRequest([0]string{}, elemIsEscaped, w, r)
default:
s.notAllowed(w, r, notAllowedParams{
allowedMethods: "GET",
allowedHeaders: nil,
acceptPost: "",
acceptPatch: "",
})
}
return
}
switch elem[0] {
case '/': // Prefix: "/"
if l := len("/"); len(elem) >= l && elem[0:l] == "/" {
elem = elem[l:]
} else {
break
}
// Param: "org_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 "DELETE":
s.handleUnhideOrganizationRequest([1]string{
args[0],
}, elemIsEscaped, w, r)
case "PUT":
s.handleHideOrganizationRequest([1]string{
args[0],
}, elemIsEscaped, w, r)
default:
s.notAllowed(w, r, notAllowedParams{
allowedMethods: "DELETE,PUT",
allowedHeaders: rn46AllowedHeaders,
acceptPost: "",
acceptPatch: "",
})
}
return
}
}
case 's': // Prefix: "story"
if l := len("story"); len(elem) >= l && elem[0:l] == "story" {
elem = elem[l:]
} else {
break
}
if len(elem) == 0 {
// Leaf node.
switch r.Method {
case "GET":
s.handleListMyPrivacyHistoryRequest([0]string{}, elemIsEscaped, w, r)
default:
s.notAllowed(w, r, notAllowedParams{
allowedMethods: "GET",
allowedHeaders: nil,
acceptPost: "",
acceptPatch: "",
})
}
return
}
}
case 'p': // Prefix: "p"
if l := len("p"); len(elem) >= l && elem[0:l] == "p" {
elem = elem[l:]
} else {
break
}
if len(elem) == 0 {
break
}
switch elem[0] {
case 'r': // Prefix: "review"
if l := len("review"); len(elem) >= l && elem[0:l] == "review" {
elem = elem[l:]
} else {
break
}
if len(elem) == 0 {
// Leaf node.
switch r.Method {
case "GET":
s.handleGetMyCardPreviewRequest([0]string{}, elemIsEscaped, w, r)
default:
s.notAllowed(w, r, notAllowedParams{
allowedMethods: "GET",
allowedHeaders: nil,
acceptPost: "",
acceptPatch: "",
})
}
return
}
case 'u': // Prefix: "ublication"
if l := len("ublication"); len(elem) >= l && elem[0:l] == "ublication" {
elem = elem[l:]
} else {
break
}
if len(elem) == 0 {
// Leaf node.
switch r.Method {
case "PUT":
s.handleSetMyPublicationRequest([0]string{}, elemIsEscaped, w, r)
default:
s.notAllowed(w, r, notAllowedParams{
allowedMethods: "PUT",
allowedHeaders: rn63AllowedHeaders,
acceptPost: "",
acceptPatch: "",
})
}
return
}
}
case 's': // Prefix: "search-status"
if l := len("search-status"); len(elem) >= l && elem[0:l] == "search-status" {
elem = elem[l:]
} else {
break
}
if len(elem) == 0 {
// Leaf node.
switch r.Method {
case "PUT":
s.handleSetMySearchStatusRequest([0]string{}, elemIsEscaped, w, r)
default:
s.notAllowed(w, r, notAllowedParams{
allowedMethods: "PUT",
allowedHeaders: rn64AllowedHeaders,
acceptPost: "",
acceptPatch: "",
})
}
return
}
}
}
case 'o': // Prefix: "ofile"
if l := len("ofile"); len(elem) >= l && elem[0:l] == "ofile" {
elem = elem[l:]
} else {
break
}
if len(elem) == 0 {
// Leaf node.
switch r.Method {
case "GET":
s.handleGetMyProfileRequest([0]string{}, elemIsEscaped, w, r)
case "PUT":
s.handleSaveMyProfileRequest([0]string{}, elemIsEscaped, w, r)
default:
s.notAllowed(w, r, notAllowedParams{
allowedMethods: "GET,PUT",
allowedHeaders: rn34AllowedHeaders,
acceptPost: "",
acceptPatch: "",
})
}
return
}
return
}
case 'q': // Prefix: "questionnaire"
@@ -867,7 +1150,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
default:
s.notAllowed(w, r, notAllowedParams{
allowedMethods: "GET,PUT",
allowedHeaders: rn32AllowedHeaders,
allowedHeaders: rn35AllowedHeaders,
acceptPost: "",
acceptPatch: "",
})
@@ -1079,7 +1362,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
default:
s.notAllowed(w, r, notAllowedParams{
allowedMethods: "GET,PATCH",
allowedHeaders: rn36AllowedHeaders,
allowedHeaders: rn39AllowedHeaders,
acceptPost: "",
acceptPatch: "application/json",
})
@@ -1159,7 +1442,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
default:
s.notAllowed(w, r, notAllowedParams{
allowedMethods: "POST",
allowedHeaders: rn46AllowedHeaders,
allowedHeaders: rn56AllowedHeaders,
acceptPost: "application/json",
acceptPatch: "",
})
@@ -1187,7 +1470,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
default:
s.notAllowed(w, r, notAllowedParams{
allowedMethods: "POST",
allowedHeaders: rn51AllowedHeaders,
allowedHeaders: rn61AllowedHeaders,
acceptPost: "application/json",
acceptPatch: "",
})
@@ -1217,7 +1500,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
default:
s.notAllowed(w, r, notAllowedParams{
allowedMethods: "POST",
allowedHeaders: rn54AllowedHeaders,
allowedHeaders: rn67AllowedHeaders,
acceptPost: "application/json",
acceptPatch: "",
})
@@ -1295,7 +1578,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
default:
s.notAllowed(w, r, notAllowedParams{
allowedMethods: "GET,PATCH",
allowedHeaders: rn39AllowedHeaders,
allowedHeaders: rn42AllowedHeaders,
acceptPost: "",
acceptPatch: "application/json",
})
@@ -2110,38 +2393,314 @@ func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool) {
}
}
case 'p': // Prefix: "profile"
case 'p': // Prefix: "pr"
if l := len("profile"); len(elem) >= l && elem[0:l] == "profile" {
if l := len("pr"); len(elem) >= l && elem[0:l] == "pr" {
elem = elem[l:]
} else {
break
}
if len(elem) == 0 {
// Leaf node.
switch method {
case "GET":
r.name = GetMyProfileOperation
r.summary = "Read the private profile of the current candidate."
r.operationID = "GetMyProfile"
r.operationGroup = ""
r.pathPattern = "/api/v1/me/profile"
r.args = args
r.count = 0
return r, true
case "PUT":
r.name = SaveMyProfileOperation
r.summary = "Replace the private profile of the current candidate."
r.operationID = "SaveMyProfile"
r.operationGroup = ""
r.pathPattern = "/api/v1/me/profile"
r.args = args
r.count = 0
return r, true
default:
return
break
}
switch elem[0] {
case 'i': // Prefix: "ivacy"
if l := len("ivacy"); len(elem) >= l && elem[0:l] == "ivacy" {
elem = elem[l:]
} else {
break
}
if len(elem) == 0 {
switch method {
case "GET":
r.name = GetMyPrivacySettingsOperation
r.summary = "Read the visibility settings of the current candidate."
r.operationID = "GetMyPrivacySettings"
r.operationGroup = ""
r.pathPattern = "/api/v1/me/privacy"
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
}
if len(elem) == 0 {
break
}
switch elem[0] {
case 'a': // Prefix: "access-history"
if l := len("access-history"); len(elem) >= l && elem[0:l] == "access-history" {
elem = elem[l:]
} else {
break
}
if len(elem) == 0 {
// Leaf node.
switch method {
case "GET":
r.name = ListMyCardAccessHistoryOperation
r.summary = "List the accesses of organizations to the card of the current candidate."
r.operationID = "ListMyCardAccessHistory"
r.operationGroup = ""
r.pathPattern = "/api/v1/me/privacy/access-history"
r.args = args
r.count = 0
return r, true
default:
return
}
}
case 'h': // Prefix: "hi"
if l := len("hi"); len(elem) >= l && elem[0:l] == "hi" {
elem = elem[l:]
} else {
break
}
if len(elem) == 0 {
break
}
switch elem[0] {
case 'd': // Prefix: "dden-organizations"
if l := len("dden-organizations"); len(elem) >= l && elem[0:l] == "dden-organizations" {
elem = elem[l:]
} else {
break
}
if len(elem) == 0 {
switch method {
case "GET":
r.name = ListMyHiddenOrganizationsOperation
r.summary = "List the organizations that the candidate hides the profile from."
r.operationID = "ListMyHiddenOrganizations"
r.operationGroup = ""
r.pathPattern = "/api/v1/me/privacy/hidden-organizations"
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: "org_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 "DELETE":
r.name = UnhideOrganizationOperation
r.summary = "Lift the hiding of the candidate profile from one organization."
r.operationID = "UnhideOrganization"
r.operationGroup = ""
r.pathPattern = "/api/v1/me/privacy/hidden-organizations/{org_id}"
r.args = args
r.count = 1
return r, true
case "PUT":
r.name = HideOrganizationOperation
r.summary = "Hide the candidate profile from one organization."
r.operationID = "HideOrganization"
r.operationGroup = ""
r.pathPattern = "/api/v1/me/privacy/hidden-organizations/{org_id}"
r.args = args
r.count = 1
return r, true
default:
return
}
}
}
case 's': // Prefix: "story"
if l := len("story"); len(elem) >= l && elem[0:l] == "story" {
elem = elem[l:]
} else {
break
}
if len(elem) == 0 {
// Leaf node.
switch method {
case "GET":
r.name = ListMyPrivacyHistoryOperation
r.summary = "List the changes of the visibility settings of the current candidate."
r.operationID = "ListMyPrivacyHistory"
r.operationGroup = ""
r.pathPattern = "/api/v1/me/privacy/history"
r.args = args
r.count = 0
return r, true
default:
return
}
}
}
case 'p': // Prefix: "p"
if l := len("p"); len(elem) >= l && elem[0:l] == "p" {
elem = elem[l:]
} else {
break
}
if len(elem) == 0 {
break
}
switch elem[0] {
case 'r': // Prefix: "review"
if l := len("review"); len(elem) >= l && elem[0:l] == "review" {
elem = elem[l:]
} else {
break
}
if len(elem) == 0 {
// Leaf node.
switch method {
case "GET":
r.name = GetMyCardPreviewOperation
r.summary = "Preview the anonymous card that organizations would read."
r.operationID = "GetMyCardPreview"
r.operationGroup = ""
r.pathPattern = "/api/v1/me/privacy/preview"
r.args = args
r.count = 0
return r, true
default:
return
}
}
case 'u': // Prefix: "ublication"
if l := len("ublication"); len(elem) >= l && elem[0:l] == "ublication" {
elem = elem[l:]
} else {
break
}
if len(elem) == 0 {
// Leaf node.
switch method {
case "PUT":
r.name = SetMyPublicationOperation
r.summary = "Publish or close the anonymous candidate card."
r.operationID = "SetMyPublication"
r.operationGroup = ""
r.pathPattern = "/api/v1/me/privacy/publication"
r.args = args
r.count = 0
return r, true
default:
return
}
}
}
case 's': // Prefix: "search-status"
if l := len("search-status"); len(elem) >= l && elem[0:l] == "search-status" {
elem = elem[l:]
} else {
break
}
if len(elem) == 0 {
// Leaf node.
switch method {
case "PUT":
r.name = SetMySearchStatusOperation
r.summary = "Set or confirm the search status of the current candidate."
r.operationID = "SetMySearchStatus"
r.operationGroup = ""
r.pathPattern = "/api/v1/me/privacy/search-status"
r.args = args
r.count = 0
return r, true
default:
return
}
}
}
}
case 'o': // Prefix: "ofile"
if l := len("ofile"); len(elem) >= l && elem[0:l] == "ofile" {
elem = elem[l:]
} else {
break
}
if len(elem) == 0 {
// Leaf node.
switch method {
case "GET":
r.name = GetMyProfileOperation
r.summary = "Read the private profile of the current candidate."
r.operationID = "GetMyProfile"
r.operationGroup = ""
r.pathPattern = "/api/v1/me/profile"
r.args = args
r.count = 0
return r, true
case "PUT":
r.name = SaveMyProfileOperation
r.summary = "Replace the private profile of the current candidate."
r.operationID = "SaveMyProfile"
r.operationGroup = ""
r.pathPattern = "/api/v1/me/profile"
r.args = args
r.count = 0
return r, true
default:
return
}
}
}
case 'q': // Prefix: "questionnaire"