feat(visibility): add the candidate publication, hiding and search status contract
This commit is contained in:
1 parent
4436f626a3
commit
0529601021
87 files changed
+21456
-83
No files matched your search
File diff suppressed because it is too large.
Load diff
@@ -65,10 +65,18 @@ type GetMyAssessmentResultRes interface {
|
||||
getMyAssessmentResultRes()
|
||||
}
|
||||
|
||||
type GetMyCardPreviewRes interface {
|
||||
getMyCardPreviewRes()
|
||||
}
|
||||
|
||||
type GetMyInvitationRes interface {
|
||||
getMyInvitationRes()
|
||||
}
|
||||
|
||||
type GetMyPrivacySettingsRes interface {
|
||||
getMyPrivacySettingsRes()
|
||||
}
|
||||
|
||||
type GetMyProfileRes interface {
|
||||
getMyProfileRes()
|
||||
}
|
||||
@@ -97,10 +105,22 @@ type GetOrganizationRes interface {
|
||||
getOrganizationRes()
|
||||
}
|
||||
|
||||
type HideOrganizationRes interface {
|
||||
hideOrganizationRes()
|
||||
}
|
||||
|
||||
type ListMyCardAccessHistoryRes interface {
|
||||
listMyCardAccessHistoryRes()
|
||||
}
|
||||
|
||||
type ListMyConsentsRes interface {
|
||||
listMyConsentsRes()
|
||||
}
|
||||
|
||||
type ListMyHiddenOrganizationsRes interface {
|
||||
listMyHiddenOrganizationsRes()
|
||||
}
|
||||
|
||||
type ListMyInvitationsRes interface {
|
||||
listMyInvitationsRes()
|
||||
}
|
||||
@@ -109,6 +129,10 @@ type ListMyOrganizationsRes interface {
|
||||
listMyOrganizationsRes()
|
||||
}
|
||||
|
||||
type ListMyPrivacyHistoryRes interface {
|
||||
listMyPrivacyHistoryRes()
|
||||
}
|
||||
|
||||
type ListMySupportCasesRes interface {
|
||||
listMySupportCasesRes()
|
||||
}
|
||||
@@ -153,10 +177,22 @@ type SendOrganizationInvitationRes interface {
|
||||
sendOrganizationInvitationRes()
|
||||
}
|
||||
|
||||
type SetMyPublicationRes interface {
|
||||
setMyPublicationRes()
|
||||
}
|
||||
|
||||
type SetMySearchStatusRes interface {
|
||||
setMySearchStatusRes()
|
||||
}
|
||||
|
||||
type SubmitMyAssessmentAnswerRes interface {
|
||||
submitMyAssessmentAnswerRes()
|
||||
}
|
||||
|
||||
type UnhideOrganizationRes interface {
|
||||
unhideOrganizationRes()
|
||||
}
|
||||
|
||||
type UpdateOrganizationInvitationRes interface {
|
||||
updateOrganizationInvitationRes()
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -23,7 +23,9 @@ const (
|
||||
GetMyAssessmentAttemptOperation OperationName = "GetMyAssessmentAttempt"
|
||||
GetMyAssessmentAvailabilityOperation OperationName = "GetMyAssessmentAvailability"
|
||||
GetMyAssessmentResultOperation OperationName = "GetMyAssessmentResult"
|
||||
GetMyCardPreviewOperation OperationName = "GetMyCardPreview"
|
||||
GetMyInvitationOperation OperationName = "GetMyInvitation"
|
||||
GetMyPrivacySettingsOperation OperationName = "GetMyPrivacySettings"
|
||||
GetMyProfileOperation OperationName = "GetMyProfile"
|
||||
GetMyQuestionnaireOperation OperationName = "GetMyQuestionnaire"
|
||||
GetMySupportCaseOperation OperationName = "GetMySupportCase"
|
||||
@@ -32,9 +34,13 @@ const (
|
||||
GetOrganizationInvitationContactsOperation OperationName = "GetOrganizationInvitationContacts"
|
||||
GetOrganizationNeedOperation OperationName = "GetOrganizationNeed"
|
||||
GetSpecializationCatalogOperation OperationName = "GetSpecializationCatalog"
|
||||
HideOrganizationOperation OperationName = "HideOrganization"
|
||||
ListMyCardAccessHistoryOperation OperationName = "ListMyCardAccessHistory"
|
||||
ListMyConsentsOperation OperationName = "ListMyConsents"
|
||||
ListMyHiddenOrganizationsOperation OperationName = "ListMyHiddenOrganizations"
|
||||
ListMyInvitationsOperation OperationName = "ListMyInvitations"
|
||||
ListMyOrganizationsOperation OperationName = "ListMyOrganizations"
|
||||
ListMyPrivacyHistoryOperation OperationName = "ListMyPrivacyHistory"
|
||||
ListMySupportCasesOperation OperationName = "ListMySupportCases"
|
||||
ListOrganizationInvitationsOperation OperationName = "ListOrganizationInvitations"
|
||||
ListOrganizationNeedsOperation OperationName = "ListOrganizationNeeds"
|
||||
@@ -46,7 +52,10 @@ const (
|
||||
SaveMyProfileOperation OperationName = "SaveMyProfile"
|
||||
SaveMyQuestionnaireOperation OperationName = "SaveMyQuestionnaire"
|
||||
SendOrganizationInvitationOperation OperationName = "SendOrganizationInvitation"
|
||||
SetMyPublicationOperation OperationName = "SetMyPublication"
|
||||
SetMySearchStatusOperation OperationName = "SetMySearchStatus"
|
||||
SubmitMyAssessmentAnswerOperation OperationName = "SubmitMyAssessmentAnswer"
|
||||
UnhideOrganizationOperation OperationName = "UnhideOrganization"
|
||||
UpdateOrganizationOperation OperationName = "UpdateOrganization"
|
||||
UpdateOrganizationInvitationOperation OperationName = "UpdateOrganizationInvitation"
|
||||
UpdateOrganizationNeedOperation OperationName = "UpdateOrganizationNeed"
|
||||
|
||||
@@ -1982,6 +1982,252 @@ func decodeGetOrganizationNeedParams(args [2]string, argsEscaped bool, r *http.R
|
||||
return params, nil
|
||||
}
|
||||
|
||||
// HideOrganizationParams is parameters of HideOrganization operation.
|
||||
type HideOrganizationParams struct {
|
||||
// Identifier of the organization that the current candidate hides or stops hiding the profile from. It
|
||||
// names the target of a candidate's own setting and grants the candidate nothing about the
|
||||
// organization. Hiding answers the same 404 not_found for an organization that does not exist and for
|
||||
// one that the candidate cannot see, so organizations cannot be enumerated; lifting the hiding answers
|
||||
// 204 for any well-formed identifier.
|
||||
OrgID uuid.UUID
|
||||
}
|
||||
|
||||
func unpackHideOrganizationParams(packed middleware.Parameters) (params HideOrganizationParams) {
|
||||
{
|
||||
key := middleware.ParameterKey{
|
||||
Name: "org_id",
|
||||
In: "path",
|
||||
}
|
||||
params.OrgID = packed[key].(uuid.UUID)
|
||||
}
|
||||
return params
|
||||
}
|
||||
|
||||
func decodeHideOrganizationParams(args [1]string, argsEscaped bool, r *http.Request) (params HideOrganizationParams, _ error) {
|
||||
// Decode path: org_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: "org_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.OrgID = c
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
return validate.ErrFieldRequired
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return params, &ogenerrors.DecodeParamError{
|
||||
Name: "org_id",
|
||||
In: "path",
|
||||
Err: err,
|
||||
}
|
||||
}
|
||||
return params, nil
|
||||
}
|
||||
|
||||
// ListMyCardAccessHistoryParams is parameters of ListMyCardAccessHistory operation.
|
||||
type ListMyCardAccessHistoryParams 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 unpackListMyCardAccessHistoryParams(packed middleware.Parameters) (params ListMyCardAccessHistoryParams) {
|
||||
{
|
||||
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 decodeListMyCardAccessHistoryParams(args [0]string, argsEscaped bool, r *http.Request) (params ListMyCardAccessHistoryParams, _ 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
|
||||
}
|
||||
|
||||
// ListMyConsentsParams is parameters of ListMyConsents operation.
|
||||
type ListMyConsentsParams struct {
|
||||
// Lists only the records in this state; omit it for the whole history.
|
||||
@@ -2225,6 +2471,182 @@ func decodeListMyConsentsParams(args [0]string, argsEscaped bool, r *http.Reques
|
||||
return params, nil
|
||||
}
|
||||
|
||||
// ListMyHiddenOrganizationsParams is parameters of ListMyHiddenOrganizations operation.
|
||||
type ListMyHiddenOrganizationsParams 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 unpackListMyHiddenOrganizationsParams(packed middleware.Parameters) (params ListMyHiddenOrganizationsParams) {
|
||||
{
|
||||
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 decodeListMyHiddenOrganizationsParams(args [0]string, argsEscaped bool, r *http.Request) (params ListMyHiddenOrganizationsParams, _ 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
|
||||
}
|
||||
|
||||
// ListMyInvitationsParams is parameters of ListMyInvitations operation.
|
||||
type ListMyInvitationsParams struct {
|
||||
// Maximum number of items in the page. The server may return fewer items even when more remain; use
|
||||
@@ -2577,6 +2999,182 @@ func decodeListMyOrganizationsParams(args [0]string, argsEscaped bool, r *http.R
|
||||
return params, nil
|
||||
}
|
||||
|
||||
// ListMyPrivacyHistoryParams is parameters of ListMyPrivacyHistory operation.
|
||||
type ListMyPrivacyHistoryParams 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 unpackListMyPrivacyHistoryParams(packed middleware.Parameters) (params ListMyPrivacyHistoryParams) {
|
||||
{
|
||||
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 decodeListMyPrivacyHistoryParams(args [0]string, argsEscaped bool, r *http.Request) (params ListMyPrivacyHistoryParams, _ 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
|
||||
}
|
||||
|
||||
// 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
|
||||
@@ -3874,6 +4472,76 @@ func decodeSubmitMyAssessmentAnswerParams(args [1]string, argsEscaped bool, r *h
|
||||
return params, nil
|
||||
}
|
||||
|
||||
// UnhideOrganizationParams is parameters of UnhideOrganization operation.
|
||||
type UnhideOrganizationParams struct {
|
||||
// Identifier of the organization that the current candidate hides or stops hiding the profile from. It
|
||||
// names the target of a candidate's own setting and grants the candidate nothing about the
|
||||
// organization. Hiding answers the same 404 not_found for an organization that does not exist and for
|
||||
// one that the candidate cannot see, so organizations cannot be enumerated; lifting the hiding answers
|
||||
// 204 for any well-formed identifier.
|
||||
OrgID uuid.UUID
|
||||
}
|
||||
|
||||
func unpackUnhideOrganizationParams(packed middleware.Parameters) (params UnhideOrganizationParams) {
|
||||
{
|
||||
key := middleware.ParameterKey{
|
||||
Name: "org_id",
|
||||
In: "path",
|
||||
}
|
||||
params.OrgID = packed[key].(uuid.UUID)
|
||||
}
|
||||
return params
|
||||
}
|
||||
|
||||
func decodeUnhideOrganizationParams(args [1]string, argsEscaped bool, r *http.Request) (params UnhideOrganizationParams, _ error) {
|
||||
// Decode path: org_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: "org_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.OrgID = c
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
return validate.ErrFieldRequired
|
||||
}
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return params, &ogenerrors.DecodeParamError{
|
||||
Name: "org_id",
|
||||
In: "path",
|
||||
Err: err,
|
||||
}
|
||||
}
|
||||
return params, nil
|
||||
}
|
||||
|
||||
// UpdateOrganizationParams is parameters of UpdateOrganization operation.
|
||||
type UpdateOrganizationParams struct {
|
||||
// Identifier of an organization. Access comes only from an active membership of the session account in
|
||||
|
||||
@@ -1357,6 +1357,164 @@ func (s *Server) decodeSendOrganizationInvitationRequest(r *http.Request) (
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Server) decodeSetMyPublicationRequest(r *http.Request) (
|
||||
req *PublicationUpdate,
|
||||
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 PublicationUpdate
|
||||
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) decodeSetMySearchStatusRequest(r *http.Request) (
|
||||
req *SearchStatusUpdate,
|
||||
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 SearchStatusUpdate
|
||||
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) decodeSubmitMyAssessmentAnswerRequest(r *http.Request) (
|
||||
req *AssessmentAnswerSubmission,
|
||||
rawBody []byte,
|
||||
|
||||
@@ -1683,6 +1683,65 @@ func encodeGetMyAssessmentResultResponse(response GetMyAssessmentResultRes, w ht
|
||||
}
|
||||
}
|
||||
|
||||
func encodeGetMyCardPreviewResponse(response GetMyCardPreviewRes, w http.ResponseWriter, span trace.Span) error {
|
||||
switch response := response.(type) {
|
||||
case *CardPreviewHeaders:
|
||||
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 *GetMyCardPreviewUnauthorized:
|
||||
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 *GetMyCardPreviewForbidden:
|
||||
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
|
||||
|
||||
default:
|
||||
return errors.Errorf("unexpected response type: %T", response)
|
||||
}
|
||||
}
|
||||
|
||||
func encodeGetMyInvitationResponse(response GetMyInvitationRes, w http.ResponseWriter, span trace.Span) error {
|
||||
switch response := response.(type) {
|
||||
case *CandidateInvitationHeaders:
|
||||
@@ -1766,6 +1825,65 @@ func encodeGetMyInvitationResponse(response GetMyInvitationRes, w http.ResponseW
|
||||
}
|
||||
}
|
||||
|
||||
func encodeGetMyPrivacySettingsResponse(response GetMyPrivacySettingsRes, w http.ResponseWriter, span trace.Span) error {
|
||||
switch response := response.(type) {
|
||||
case *PrivacySettingsHeaders:
|
||||
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 *GetMyPrivacySettingsUnauthorized:
|
||||
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 *GetMyPrivacySettingsForbidden:
|
||||
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
|
||||
|
||||
default:
|
||||
return errors.Errorf("unexpected response type: %T", response)
|
||||
}
|
||||
}
|
||||
|
||||
func encodeGetMyProfileResponse(response GetMyProfileRes, w http.ResponseWriter, span trace.Span) error {
|
||||
switch response := response.(type) {
|
||||
case *CandidateProfileHeaders:
|
||||
@@ -2300,6 +2418,204 @@ func encodeGetSpecializationCatalogResponse(response *SpecializationCatalog, w h
|
||||
return nil
|
||||
}
|
||||
|
||||
func encodeHideOrganizationResponse(response HideOrganizationRes, w http.ResponseWriter, span trace.Span) error {
|
||||
switch response := response.(type) {
|
||||
case *HiddenOrganizationHeaders:
|
||||
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 *HideOrganizationBadRequest:
|
||||
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 *HideOrganizationUnauthorized:
|
||||
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 *HideOrganizationForbidden:
|
||||
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 *HideOrganizationNotFound:
|
||||
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 *HideOrganizationConflict:
|
||||
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 *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 encodeListMyCardAccessHistoryResponse(response ListMyCardAccessHistoryRes, w http.ResponseWriter, span trace.Span) error {
|
||||
switch response := response.(type) {
|
||||
case *CardAccessListHeaders:
|
||||
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 *ListMyCardAccessHistoryBadRequest:
|
||||
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 *ListMyCardAccessHistoryUnauthorized:
|
||||
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 *ListMyCardAccessHistoryForbidden:
|
||||
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
|
||||
|
||||
default:
|
||||
return errors.Errorf("unexpected response type: %T", response)
|
||||
}
|
||||
}
|
||||
|
||||
func encodeListMyConsentsResponse(response ListMyConsentsRes, w http.ResponseWriter, span trace.Span) error {
|
||||
switch response := response.(type) {
|
||||
case *ConsentRecordListHeaders:
|
||||
@@ -2359,6 +2675,77 @@ func encodeListMyConsentsResponse(response ListMyConsentsRes, w http.ResponseWri
|
||||
}
|
||||
}
|
||||
|
||||
func encodeListMyHiddenOrganizationsResponse(response ListMyHiddenOrganizationsRes, w http.ResponseWriter, span trace.Span) error {
|
||||
switch response := response.(type) {
|
||||
case *HiddenOrganizationListHeaders:
|
||||
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 *ListMyHiddenOrganizationsBadRequest:
|
||||
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 *ListMyHiddenOrganizationsUnauthorized:
|
||||
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 *ListMyHiddenOrganizationsForbidden:
|
||||
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
|
||||
|
||||
default:
|
||||
return errors.Errorf("unexpected response type: %T", response)
|
||||
}
|
||||
}
|
||||
|
||||
func encodeListMyInvitationsResponse(response ListMyInvitationsRes, w http.ResponseWriter, span trace.Span) error {
|
||||
switch response := response.(type) {
|
||||
case *CandidateInvitationListHeaders:
|
||||
@@ -2501,6 +2888,77 @@ func encodeListMyOrganizationsResponse(response ListMyOrganizationsRes, w http.R
|
||||
}
|
||||
}
|
||||
|
||||
func encodeListMyPrivacyHistoryResponse(response ListMyPrivacyHistoryRes, w http.ResponseWriter, span trace.Span) error {
|
||||
switch response := response.(type) {
|
||||
case *PrivacyEventListHeaders:
|
||||
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 *ListMyPrivacyHistoryBadRequest:
|
||||
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 *ListMyPrivacyHistoryUnauthorized:
|
||||
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 *ListMyPrivacyHistoryForbidden:
|
||||
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
|
||||
|
||||
default:
|
||||
return errors.Errorf("unexpected response type: %T", response)
|
||||
}
|
||||
}
|
||||
|
||||
func encodeListMySupportCasesResponse(response ListMySupportCasesRes, w http.ResponseWriter, span trace.Span) error {
|
||||
switch response := response.(type) {
|
||||
case *SupportCaseListHeaders:
|
||||
@@ -3554,6 +4012,184 @@ func encodeSendOrganizationInvitationResponse(response SendOrganizationInvitatio
|
||||
}
|
||||
}
|
||||
|
||||
func encodeSetMyPublicationResponse(response SetMyPublicationRes, w http.ResponseWriter, span trace.Span) error {
|
||||
switch response := response.(type) {
|
||||
case *PublicationHeaders:
|
||||
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 *SetMyPublicationBadRequest:
|
||||
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 *SetMyPublicationUnauthorized:
|
||||
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 *SetMyPublicationForbidden:
|
||||
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 *SetMyPublicationConflict:
|
||||
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 *SetMyPublicationPreconditionFailed:
|
||||
w.Header().Set("Content-Type", "application/problem+json")
|
||||
w.WriteHeader(412)
|
||||
|
||||
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 encodeSetMySearchStatusResponse(response SetMySearchStatusRes, w http.ResponseWriter, span trace.Span) error {
|
||||
switch response := response.(type) {
|
||||
case *SearchStatusHeaders:
|
||||
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 *SetMySearchStatusBadRequest:
|
||||
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 *SetMySearchStatusUnauthorized:
|
||||
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 *SetMySearchStatusForbidden:
|
||||
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 *SetMySearchStatusPreconditionFailed:
|
||||
w.Header().Set("Content-Type", "application/problem+json")
|
||||
w.WriteHeader(412)
|
||||
|
||||
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 encodeSubmitMyAssessmentAnswerResponse(response SubmitMyAssessmentAnswerRes, w http.ResponseWriter, span trace.Span) error {
|
||||
switch response := response.(type) {
|
||||
case *AssessmentAttemptHeaders:
|
||||
@@ -3705,6 +4341,70 @@ func encodeSubmitMyAssessmentAnswerResponse(response SubmitMyAssessmentAnswerRes
|
||||
}
|
||||
}
|
||||
|
||||
func encodeUnhideOrganizationResponse(response UnhideOrganizationRes, w http.ResponseWriter, span trace.Span) error {
|
||||
switch response := response.(type) {
|
||||
case *UnhideOrganizationNoContent:
|
||||
// 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(204)
|
||||
|
||||
return nil
|
||||
|
||||
case *UnhideOrganizationBadRequest:
|
||||
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 *UnhideOrganizationUnauthorized:
|
||||
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 *UnhideOrganizationForbidden:
|
||||
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
|
||||
|
||||
default:
|
||||
return errors.Errorf("unexpected response type: %T", response)
|
||||
}
|
||||
}
|
||||
|
||||
func encodeUpdateOrganizationResponse(response UpdateOrganizationRes, w http.ResponseWriter, span trace.Span) error {
|
||||
switch response := response.(type) {
|
||||
case *OrganizationHeaders:
|
||||
|
||||
@@ -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"
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -70,7 +70,9 @@ var operationRolesSessionCookie = map[string][]string{
|
||||
GetMyAssessmentAttemptOperation: []string{},
|
||||
GetMyAssessmentAvailabilityOperation: []string{},
|
||||
GetMyAssessmentResultOperation: []string{},
|
||||
GetMyCardPreviewOperation: []string{},
|
||||
GetMyInvitationOperation: []string{},
|
||||
GetMyPrivacySettingsOperation: []string{},
|
||||
GetMyProfileOperation: []string{},
|
||||
GetMyQuestionnaireOperation: []string{},
|
||||
GetMySupportCaseOperation: []string{},
|
||||
@@ -78,9 +80,13 @@ var operationRolesSessionCookie = map[string][]string{
|
||||
GetOrganizationInvitationOperation: []string{},
|
||||
GetOrganizationInvitationContactsOperation: []string{},
|
||||
GetOrganizationNeedOperation: []string{},
|
||||
HideOrganizationOperation: []string{},
|
||||
ListMyCardAccessHistoryOperation: []string{},
|
||||
ListMyConsentsOperation: []string{},
|
||||
ListMyHiddenOrganizationsOperation: []string{},
|
||||
ListMyInvitationsOperation: []string{},
|
||||
ListMyOrganizationsOperation: []string{},
|
||||
ListMyPrivacyHistoryOperation: []string{},
|
||||
ListMySupportCasesOperation: []string{},
|
||||
ListOrganizationInvitationsOperation: []string{},
|
||||
ListOrganizationNeedsOperation: []string{},
|
||||
@@ -89,7 +95,10 @@ var operationRolesSessionCookie = map[string][]string{
|
||||
SaveMyProfileOperation: []string{},
|
||||
SaveMyQuestionnaireOperation: []string{},
|
||||
SendOrganizationInvitationOperation: []string{},
|
||||
SetMyPublicationOperation: []string{},
|
||||
SetMySearchStatusOperation: []string{},
|
||||
SubmitMyAssessmentAnswerOperation: []string{},
|
||||
UnhideOrganizationOperation: []string{},
|
||||
UpdateOrganizationOperation: []string{},
|
||||
UpdateOrganizationInvitationOperation: []string{},
|
||||
UpdateOrganizationNeedOperation: []string{},
|
||||
@@ -129,12 +138,16 @@ var operationRolesSessionCsrf = map[string][]string{
|
||||
CreateOrganizationNeedOperation: []string{},
|
||||
DeclineMyInvitationOperation: []string{},
|
||||
FinalizeMyAssessmentAttemptOperation: []string{},
|
||||
HideOrganizationOperation: []string{},
|
||||
LogoutOperation: []string{},
|
||||
RaiseOrganizationInvitationSalaryOperation: []string{},
|
||||
SaveMyProfileOperation: []string{},
|
||||
SaveMyQuestionnaireOperation: []string{},
|
||||
SendOrganizationInvitationOperation: []string{},
|
||||
SetMyPublicationOperation: []string{},
|
||||
SetMySearchStatusOperation: []string{},
|
||||
SubmitMyAssessmentAnswerOperation: []string{},
|
||||
UnhideOrganizationOperation: []string{},
|
||||
UpdateOrganizationOperation: []string{},
|
||||
UpdateOrganizationInvitationOperation: []string{},
|
||||
UpdateOrganizationNeedOperation: []string{},
|
||||
|
||||
@@ -572,6 +572,29 @@ type Handler interface {
|
||||
//
|
||||
// GET /api/v1/me/assessment-attempts/{attempt_id}/result
|
||||
GetMyAssessmentResult(ctx context.Context, params GetMyAssessmentResultParams) (GetMyAssessmentResultRes, error)
|
||||
// GetMyCardPreview implements GetMyCardPreview operation.
|
||||
//
|
||||
// Requires the session cookie of a candidate account. Returns the card exactly as an organization that
|
||||
// the candidate does not hide the profile from would read it now, built from the current profile, the
|
||||
// current publication, and the consent ledger. The response is `Cache-Control: no-store`.
|
||||
//
|
||||
// The preview is a private read for the candidate: it creates no view, leaves no access record, and is
|
||||
// never shown to an organization. While the profile is closed `card` is null. `card` is
|
||||
// `AnonymousCardContent`, whose schema reaches no private profile schema, no contact, and no
|
||||
// identifier of the candidate: it has no name, email, phone, Telegram name, employer, salary figure,
|
||||
// or account or profile identifier, and each property is null when it is not published or has no
|
||||
// value, so a reader cannot tell the two apart. Only the fields in `fields` are filled, and only with
|
||||
// values that the candidate confirmed: an unconfirmed suggestion and an unknown value never appear. A
|
||||
// free text value that looks like a contact (an email address, a phone number, a URL, a Telegram link,
|
||||
// an @handle) is dropped from the card, so the preview shows exactly what an organization would read.
|
||||
// The self-assessed grade is not a category and never appears; categories come only from assessment
|
||||
// results.
|
||||
//
|
||||
// A missing, unknown, expired, or revoked session answers 401 unauthenticated; an employer account
|
||||
// answers 403 forbidden.
|
||||
//
|
||||
// GET /api/v1/me/privacy/preview
|
||||
GetMyCardPreview(ctx context.Context) (GetMyCardPreviewRes, error)
|
||||
// GetMyInvitation implements GetMyInvitation operation.
|
||||
//
|
||||
// Requires the session cookie of a candidate account. The candidate comes from the session; the
|
||||
@@ -603,6 +626,27 @@ type Handler interface {
|
||||
//
|
||||
// GET /api/v1/me/invitations/{invitation_id}
|
||||
GetMyInvitation(ctx context.Context, params GetMyInvitationParams) (GetMyInvitationRes, error)
|
||||
// GetMyPrivacySettings implements GetMyPrivacySettings operation.
|
||||
//
|
||||
// Requires the session cookie of a candidate account. The candidate comes from the session, never from
|
||||
// a request parameter. Returns the publication of the candidate card, the search status, and the
|
||||
// number of hidden organizations in one read. The response is `Cache-Control: no-store`.
|
||||
//
|
||||
// A profile is closed by default. A candidate who never published reads `publication.state` `closed`
|
||||
// with `closed_reason` `never_published`, an empty field set, and version 0; creating or saving the
|
||||
// profile (`SaveMyProfile`) never publishes it, and no operation of the profile, the questionnaire, or
|
||||
// an assessment changes these settings. The C2 consent, the search status, and the hidden
|
||||
// organizations are three independent settings: the C2 record in the consent ledger proves that the
|
||||
// candidate accepted the publication text, the publication records which fields are published, and the
|
||||
// search status is a statement of the candidate that is not a consent. A change of one never changes
|
||||
// another, and none of them ever makes the candidate more visible by itself: the search status lapses
|
||||
// to the non-public `not_looking`, a revoked C2 closes the card, and a new C2 grant publishes nothing.
|
||||
//
|
||||
// A missing, unknown, expired, or revoked session answers 401 unauthenticated; an employer account
|
||||
// answers 403 forbidden.
|
||||
//
|
||||
// GET /api/v1/me/privacy
|
||||
GetMyPrivacySettings(ctx context.Context) (GetMyPrivacySettingsRes, error)
|
||||
// GetMyProfile implements GetMyProfile operation.
|
||||
//
|
||||
// Requires the session cookie of a candidate account. The candidate comes from the session, never from
|
||||
@@ -795,6 +839,66 @@ type Handler interface {
|
||||
//
|
||||
// GET /api/v1/specializations
|
||||
GetSpecializationCatalog(ctx context.Context) (*SpecializationCatalog, error)
|
||||
// HideOrganization implements HideOrganization operation.
|
||||
//
|
||||
// Requires the session cookie of a candidate account, the CSRF token of that session in X-CSRF-Token,
|
||||
// and an allowed Origin. The request has no body: the path names the organization and the candidate
|
||||
// comes from the session. The hiding is a record that belongs to the candidate and references the
|
||||
// organization; it changes neither the C2 consent, nor the publication, nor the search status.
|
||||
//
|
||||
// The operation sets a state, so it is idempotent and needs no Idempotency-Key: hiding an organization
|
||||
// that is already hidden answers 200 with the existing record and its original `hidden_at`, changes
|
||||
// nothing, and writes no history record. There is one record per candidate and organization.
|
||||
//
|
||||
// Anti-enumeration: an organization that does not exist and an organization that the candidate cannot
|
||||
// see answer the same 404 not_found, with the same body and without a timing or an error code that
|
||||
// tells them apart, so the operation is not a way to ask whether an identifier belongs to an
|
||||
// organization. The candidate can see an organization that has sent them an invitation, and the
|
||||
// organizations that a candidate lookup will list (planned; see the open questions of the contract).
|
||||
// The response names the organization only after that check, with its current name. The identifiers
|
||||
// are random, the general rate limit applies and can answer 429 with Retry-After before any check, and
|
||||
// the record never reveals to an organization that a candidate hides it.
|
||||
//
|
||||
// A candidate hides at most 1000 organizations; hiding one more answers 409 state_conflict with the
|
||||
// entry `{in: path, pointer: /org_id, code: limit_reached}` in `errors`, which tells it apart from
|
||||
// other conflicts, and changes nothing, and a repeat of an existing hiding is never refused for the
|
||||
// limit.
|
||||
//
|
||||
// Hiding an organization that holds an active contact grant of the candidate revokes that grant with
|
||||
// the reason `visibility_closed` in the same transaction (planned together with the invitation
|
||||
// operations). Lifting the hiding never reopens a grant.
|
||||
//
|
||||
// Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation of the
|
||||
// path (400), account scenario (403 forbidden for an employer), the organization and its visibility to
|
||||
// the candidate (404 not_found), then the repeat (200), then the limit (409 state_conflict). Like
|
||||
// every visibility change, hiding needs a verified email (a usecase requirement).
|
||||
//
|
||||
// PUT /api/v1/me/privacy/hidden-organizations/{org_id}
|
||||
HideOrganization(ctx context.Context, params HideOrganizationParams) (HideOrganizationRes, error)
|
||||
// ListMyCardAccessHistory implements ListMyCardAccessHistory operation.
|
||||
//
|
||||
// Requires the session cookie of a candidate account. The candidate comes from the session, so the
|
||||
// response holds only accesses to the caller's own card. Returns a page, newest first with the record
|
||||
// identifier as the tie-breaker, with cursor pagination. The response is `Cache-Control: no-store`.
|
||||
//
|
||||
// An access is a view of the anonymous card by an organization (`card_viewed`) or a read of the
|
||||
// contacts through an active contact grant (`contact_read`). Reading the history is not an access and
|
||||
// writes nothing. A view of the card by an organization that has no invitation relation with the
|
||||
// candidate carries `organization` null, so the candidate sees that the card was viewed without
|
||||
// learning a company that they cannot otherwise see; a contact read always names the organization,
|
||||
// because the candidate accepted its invitation. The entries carry no search query, filter, or ranking
|
||||
// of the organization, and no organization the candidate hides ever appears as a viewer, because a
|
||||
// hidden organization cannot read the card.
|
||||
//
|
||||
// The storage of accesses is planned with the card and contact operations of the organization side
|
||||
// (TASK-185 and the contact read of the invitation contract); until then the operation answers 501
|
||||
// not_implemented after the session and request checks.
|
||||
//
|
||||
// A missing, unknown, expired, or revoked session answers 401 unauthenticated; an employer account
|
||||
// answers 403 forbidden. A malformed `limit` or `cursor` answers 400 validation_failed.
|
||||
//
|
||||
// GET /api/v1/me/privacy/access-history
|
||||
ListMyCardAccessHistory(ctx context.Context, params ListMyCardAccessHistoryParams) (ListMyCardAccessHistoryRes, error)
|
||||
// ListMyConsents implements ListMyConsents operation.
|
||||
//
|
||||
// Requires the session cookie of a candidate or an employer account. The subject comes from the
|
||||
@@ -824,6 +928,22 @@ type Handler interface {
|
||||
//
|
||||
// GET /api/v1/me/consents
|
||||
ListMyConsents(ctx context.Context, params ListMyConsentsParams) (ListMyConsentsRes, error)
|
||||
// ListMyHiddenOrganizations implements ListMyHiddenOrganizations operation.
|
||||
//
|
||||
// Requires the session cookie of a candidate account. The candidate comes from the session, so the
|
||||
// response holds only the caller's own records and no request can name another account. Returns a page
|
||||
// of the hidden organizations, newest first with the organization identifier as the tie-breaker, with
|
||||
// cursor pagination. The response is `Cache-Control: no-store`.
|
||||
//
|
||||
// The records belong to the candidate. An organization never reads them, never learns that it is
|
||||
// hidden, and sees a hidden candidate exactly as it sees one who is not published: no search result,
|
||||
// no card, no contact read.
|
||||
//
|
||||
// A missing, unknown, expired, or revoked session answers 401 unauthenticated; an employer account
|
||||
// answers 403 forbidden. A malformed `limit` or `cursor` answers 400 validation_failed.
|
||||
//
|
||||
// GET /api/v1/me/privacy/hidden-organizations
|
||||
ListMyHiddenOrganizations(ctx context.Context, params ListMyHiddenOrganizationsParams) (ListMyHiddenOrganizationsRes, error)
|
||||
// ListMyInvitations implements ListMyInvitations operation.
|
||||
//
|
||||
// Requires the session cookie of a candidate account. The candidate comes from the session, never from
|
||||
@@ -871,6 +991,24 @@ type Handler interface {
|
||||
//
|
||||
// GET /api/v1/me/organizations
|
||||
ListMyOrganizations(ctx context.Context, params ListMyOrganizationsParams) (ListMyOrganizationsRes, error)
|
||||
// ListMyPrivacyHistory implements ListMyPrivacyHistory operation.
|
||||
//
|
||||
// Requires the session cookie of a candidate account. The candidate comes from the session, so the
|
||||
// response holds only the caller's own records. Returns a page of the settings history, newest first
|
||||
// with the event identifier as the tie-breaker, with cursor pagination. The response is
|
||||
// `Cache-Control: no-store`.
|
||||
//
|
||||
// The history is append-only evidence of what the candidate published, hid, and announced, and when. A
|
||||
// publication event keeps the published fields and the C2 record behind them, which is what the
|
||||
// consent ledger deliberately does not carry (the C2 record proves the consent to the text, not the
|
||||
// field set). A revocation of C2 and a lapse of the search status are computed and are not events
|
||||
// here; the consent history shows the revocation. The history never contains a profile value.
|
||||
//
|
||||
// A missing, unknown, expired, or revoked session answers 401 unauthenticated; an employer account
|
||||
// answers 403 forbidden. A malformed `limit` or `cursor` answers 400 validation_failed.
|
||||
//
|
||||
// GET /api/v1/me/privacy/history
|
||||
ListMyPrivacyHistory(ctx context.Context, params ListMyPrivacyHistoryParams) (ListMyPrivacyHistoryRes, error)
|
||||
// ListMySupportCases implements ListMySupportCases operation.
|
||||
//
|
||||
// Requires the session cookie of a candidate or an employer account. Returns a page of the cases that
|
||||
@@ -1186,6 +1324,90 @@ type Handler interface {
|
||||
//
|
||||
// POST /api/v1/organizations/{org_id}/invitations/{invitation_id}/send
|
||||
SendOrganizationInvitation(ctx context.Context, req *InvitationCommand, params SendOrganizationInvitationParams) (SendOrganizationInvitationRes, error)
|
||||
// SetMyPublication implements SetMyPublication operation.
|
||||
//
|
||||
// Requires the session cookie of a candidate account, the CSRF token of that session in X-CSRF-Token,
|
||||
// and an allowed Origin. The body is the complete new publication setting: `state` `published` with
|
||||
// the non-empty set of card fields, or `closed` with an empty set. It changes only the publication;
|
||||
// the search status and the hidden organizations stay as they were.
|
||||
//
|
||||
// Publication is not a consent and does not duplicate one. The consent C2 lives in the consent ledger
|
||||
// (`ListMyConsents`); this setting refers to it. Publishing requires an active, unrevoked C2 record of
|
||||
// the account and binds the publication to that record, so a client sends no consent identifier and
|
||||
// cannot forge one. Without one the server answers 409 state_conflict with the entry
|
||||
// `{in: body, pointer: /state, code: consent_required}` in `errors`, which tells it apart from every
|
||||
// other conflict, and changes nothing: the client gives C2 first (planned in the consent settings,
|
||||
// TASK-063) and then publishes. The server takes the C2 record under a share lock in the transaction
|
||||
// that writes the publication, so a revocation that races with a publication either commits first (the
|
||||
// publication is refused) or closes the card right after. A revocation of C2 closes the card at once,
|
||||
// because `state` is computed from the unrevoked record; a later C2 grant never reopens it, and the
|
||||
// candidate publishes again under the new record. The revocation path itself (TASK-064) closes the
|
||||
// stored publication and revokes the contact grants in its own transaction. A closing sent over a
|
||||
// stored publication whose C2 was revoked is a real change: it stores the closing, records
|
||||
// `publication_closed`, and revokes the grants as any closing does. Publishing, like every visibility
|
||||
// change, needs a verified email (a usecase requirement; the unverified account cleanup deletes only
|
||||
// accounts without such records). Publishing never adds a field that the body did not name, and a new
|
||||
// `CardField` value is never published for a candidate who did not choose it.
|
||||
//
|
||||
// The field set contains only the groups of `CardField`. The full name, contacts, and the lowest
|
||||
// salary have no value there, so no body can publish them. Only values that the candidate confirmed
|
||||
// ever reach the card. Contacts reach an organization only through the contact grant (C4), and a
|
||||
// profile that is published or closed changes none of the grants that exist; closing the publication,
|
||||
// and hiding an organization that holds a grant, revoke the contact grants concerned with the reason
|
||||
// `visibility_closed` in the same transaction as the change (planned together with the operations, see
|
||||
// the invitation contract).
|
||||
//
|
||||
// Optimistic concurrency uses `expected_version` in the body: the client sends the `version` it read,
|
||||
// 0 for the first publication. If it is not the current version the server answers 412
|
||||
// version_conflict and changes nothing. The version travels in the body rather than in If-Match
|
||||
// because the generated client cannot read the ETag header yet. A body that equals the stored setting
|
||||
// changes nothing, keeps the version, and answers 200 even when `expected_version` is older, so a
|
||||
// retry after a lost response succeeds without an Idempotency-Key. A version above the current one
|
||||
// never existed and always answers 412. Every change is recorded in the settings history with its
|
||||
// time, the fields, and the C2 record.
|
||||
//
|
||||
// Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400),
|
||||
// account scenario (403 forbidden for an employer), a version above the current one (412), rules that
|
||||
// depend on the body alone (400), an unchanged body (200), a stale version (412), then the active C2
|
||||
// for a publication (409 state_conflict). The schema rejects an unknown field, a repeated or unknown
|
||||
// card field, and more fields than there are groups; a published state with no field, and a closed
|
||||
// state with a field, answer 400 validation_failed with the pointer `/fields`. Error bodies never
|
||||
// repeat a submitted value.
|
||||
//
|
||||
// PUT /api/v1/me/privacy/publication
|
||||
SetMyPublication(ctx context.Context, req *PublicationUpdate) (SetMyPublicationRes, error)
|
||||
// SetMySearchStatus implements SetMySearchStatus operation.
|
||||
//
|
||||
// Requires the session cookie of a candidate account, the CSRF token of that session in X-CSRF-Token,
|
||||
// and an allowed Origin. The body is the complete new status: `looking` ("Ищу") or `not_looking`.
|
||||
// The status is a statement of the candidate and never a consent. It changes neither the C2 consent,
|
||||
// nor the publication, nor the hidden organizations, and it does not close or open any contact grant;
|
||||
// a candidate whose profile is closed who sets `looking` becomes visible to no one.
|
||||
//
|
||||
// `looking` stores the moment of the confirmation and a lapse time. The server takes the interval from
|
||||
// the `search_status` section of the effective product policy (30 days in the demo policy,
|
||||
// `searching_confirmation_interval_days`), stores the policy version it used, and fixes the lapse time
|
||||
// then, so a later policy change moves no stored time. Setting `looking` again is the confirmation: it
|
||||
// replaces the confirmation time with now and advances the version, also after a lapse. The body
|
||||
// carries no time, interval, or policy version.
|
||||
//
|
||||
// After the lapse time the status holds as `not_looking` with `lapsed` true on the next read. The
|
||||
// lapse is computed and written nowhere, so it needs no job, it can never make the candidate more
|
||||
// visible, and it never touches the publication or the hidden organizations. A reminder before the
|
||||
// lapse is a planned notification, not a part of this operation.
|
||||
//
|
||||
// Optimistic concurrency uses `expected_version` in the body, 0 for a candidate who never set the
|
||||
// status; a stale or non-existent version answers 412 version_conflict and changes nothing.
|
||||
// `not_looking` over a stored `not_looking` changes nothing and answers 200 even with a stale version.
|
||||
// `looking` always changes the stored confirmation, so a retry of a confirmation whose response was
|
||||
// lost with the old version answers 412 and the client reads the status again.
|
||||
//
|
||||
// Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400),
|
||||
// account scenario (403 forbidden for an employer), a version above the current one (412), an
|
||||
// unchanged `not_looking` (200), then a stale version (412).
|
||||
//
|
||||
// PUT /api/v1/me/privacy/search-status
|
||||
SetMySearchStatus(ctx context.Context, req *SearchStatusUpdate) (SetMySearchStatusRes, error)
|
||||
// SubmitMyAssessmentAnswer implements SubmitMyAssessmentAnswer operation.
|
||||
//
|
||||
// Requires the session cookie of a candidate account, the CSRF token of that session in X-CSRF-Token,
|
||||
@@ -1243,6 +1465,24 @@ type Handler interface {
|
||||
//
|
||||
// POST /api/v1/me/assessment-attempts/{attempt_id}/answers
|
||||
SubmitMyAssessmentAnswer(ctx context.Context, req *AssessmentAnswerSubmission, params SubmitMyAssessmentAnswerParams) (SubmitMyAssessmentAnswerRes, error)
|
||||
// UnhideOrganization implements UnhideOrganization operation.
|
||||
//
|
||||
// Requires the session cookie of a candidate account, the CSRF token of that session in X-CSRF-Token,
|
||||
// and an allowed Origin. Deletes the hiding record of the candidate for the organization in the path.
|
||||
// The request is idempotent: it answers 204 whether the organization was hidden, was not hidden, or
|
||||
// does not exist, so the operation reveals nothing about the organization, and a repeat after a lost
|
||||
// response succeeds. The record is deleted, the settings history keeps the event
|
||||
// `organization_unhidden` only when a record was deleted.
|
||||
//
|
||||
// Lifting the hiding makes the candidate readable by that organization again only if the profile is
|
||||
// published and the organization otherwise may read it. It changes neither the C2 consent, nor the
|
||||
// publication, nor the search status, and it never reopens a contact grant that the hiding closed.
|
||||
//
|
||||
// Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation of the
|
||||
// path (400), account scenario (403 forbidden for an employer), then the deletion (204).
|
||||
//
|
||||
// DELETE /api/v1/me/privacy/hidden-organizations/{org_id}
|
||||
UnhideOrganization(ctx context.Context, params UnhideOrganizationParams) (UnhideOrganizationRes, error)
|
||||
// UpdateOrganization implements UpdateOrganization operation.
|
||||
//
|
||||
// Requires the session cookie of an employer account with an active membership in `org_id`, the CSRF
|
||||
|
||||
@@ -628,6 +628,32 @@ func (UnimplementedHandler) GetMyAssessmentResult(ctx context.Context, params Ge
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// GetMyCardPreview implements GetMyCardPreview operation.
|
||||
//
|
||||
// Requires the session cookie of a candidate account. Returns the card exactly as an organization that
|
||||
// the candidate does not hide the profile from would read it now, built from the current profile, the
|
||||
// current publication, and the consent ledger. The response is `Cache-Control: no-store`.
|
||||
//
|
||||
// The preview is a private read for the candidate: it creates no view, leaves no access record, and is
|
||||
// never shown to an organization. While the profile is closed `card` is null. `card` is
|
||||
// `AnonymousCardContent`, whose schema reaches no private profile schema, no contact, and no
|
||||
// identifier of the candidate: it has no name, email, phone, Telegram name, employer, salary figure,
|
||||
// or account or profile identifier, and each property is null when it is not published or has no
|
||||
// value, so a reader cannot tell the two apart. Only the fields in `fields` are filled, and only with
|
||||
// values that the candidate confirmed: an unconfirmed suggestion and an unknown value never appear. A
|
||||
// free text value that looks like a contact (an email address, a phone number, a URL, a Telegram link,
|
||||
// an @handle) is dropped from the card, so the preview shows exactly what an organization would read.
|
||||
// The self-assessed grade is not a category and never appears; categories come only from assessment
|
||||
// results.
|
||||
//
|
||||
// A missing, unknown, expired, or revoked session answers 401 unauthenticated; an employer account
|
||||
// answers 403 forbidden.
|
||||
//
|
||||
// GET /api/v1/me/privacy/preview
|
||||
func (UnimplementedHandler) GetMyCardPreview(ctx context.Context) (r GetMyCardPreviewRes, _ error) {
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// GetMyInvitation implements GetMyInvitation operation.
|
||||
//
|
||||
// Requires the session cookie of a candidate account. The candidate comes from the session; the
|
||||
@@ -662,6 +688,30 @@ func (UnimplementedHandler) GetMyInvitation(ctx context.Context, params GetMyInv
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// GetMyPrivacySettings implements GetMyPrivacySettings operation.
|
||||
//
|
||||
// Requires the session cookie of a candidate account. The candidate comes from the session, never from
|
||||
// a request parameter. Returns the publication of the candidate card, the search status, and the
|
||||
// number of hidden organizations in one read. The response is `Cache-Control: no-store`.
|
||||
//
|
||||
// A profile is closed by default. A candidate who never published reads `publication.state` `closed`
|
||||
// with `closed_reason` `never_published`, an empty field set, and version 0; creating or saving the
|
||||
// profile (`SaveMyProfile`) never publishes it, and no operation of the profile, the questionnaire, or
|
||||
// an assessment changes these settings. The C2 consent, the search status, and the hidden
|
||||
// organizations are three independent settings: the C2 record in the consent ledger proves that the
|
||||
// candidate accepted the publication text, the publication records which fields are published, and the
|
||||
// search status is a statement of the candidate that is not a consent. A change of one never changes
|
||||
// another, and none of them ever makes the candidate more visible by itself: the search status lapses
|
||||
// to the non-public `not_looking`, a revoked C2 closes the card, and a new C2 grant publishes nothing.
|
||||
//
|
||||
// A missing, unknown, expired, or revoked session answers 401 unauthenticated; an employer account
|
||||
// answers 403 forbidden.
|
||||
//
|
||||
// GET /api/v1/me/privacy
|
||||
func (UnimplementedHandler) GetMyPrivacySettings(ctx context.Context) (r GetMyPrivacySettingsRes, _ error) {
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// GetMyProfile implements GetMyProfile operation.
|
||||
//
|
||||
// Requires the session cookie of a candidate account. The candidate comes from the session, never from
|
||||
@@ -878,6 +928,72 @@ func (UnimplementedHandler) GetSpecializationCatalog(ctx context.Context) (r *Sp
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// HideOrganization implements HideOrganization operation.
|
||||
//
|
||||
// Requires the session cookie of a candidate account, the CSRF token of that session in X-CSRF-Token,
|
||||
// and an allowed Origin. The request has no body: the path names the organization and the candidate
|
||||
// comes from the session. The hiding is a record that belongs to the candidate and references the
|
||||
// organization; it changes neither the C2 consent, nor the publication, nor the search status.
|
||||
//
|
||||
// The operation sets a state, so it is idempotent and needs no Idempotency-Key: hiding an organization
|
||||
// that is already hidden answers 200 with the existing record and its original `hidden_at`, changes
|
||||
// nothing, and writes no history record. There is one record per candidate and organization.
|
||||
//
|
||||
// Anti-enumeration: an organization that does not exist and an organization that the candidate cannot
|
||||
// see answer the same 404 not_found, with the same body and without a timing or an error code that
|
||||
// tells them apart, so the operation is not a way to ask whether an identifier belongs to an
|
||||
// organization. The candidate can see an organization that has sent them an invitation, and the
|
||||
// organizations that a candidate lookup will list (planned; see the open questions of the contract).
|
||||
// The response names the organization only after that check, with its current name. The identifiers
|
||||
// are random, the general rate limit applies and can answer 429 with Retry-After before any check, and
|
||||
// the record never reveals to an organization that a candidate hides it.
|
||||
//
|
||||
// A candidate hides at most 1000 organizations; hiding one more answers 409 state_conflict with the
|
||||
// entry `{in: path, pointer: /org_id, code: limit_reached}` in `errors`, which tells it apart from
|
||||
// other conflicts, and changes nothing, and a repeat of an existing hiding is never refused for the
|
||||
// limit.
|
||||
//
|
||||
// Hiding an organization that holds an active contact grant of the candidate revokes that grant with
|
||||
// the reason `visibility_closed` in the same transaction (planned together with the invitation
|
||||
// operations). Lifting the hiding never reopens a grant.
|
||||
//
|
||||
// Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation of the
|
||||
// path (400), account scenario (403 forbidden for an employer), the organization and its visibility to
|
||||
// the candidate (404 not_found), then the repeat (200), then the limit (409 state_conflict). Like
|
||||
// every visibility change, hiding needs a verified email (a usecase requirement).
|
||||
//
|
||||
// PUT /api/v1/me/privacy/hidden-organizations/{org_id}
|
||||
func (UnimplementedHandler) HideOrganization(ctx context.Context, params HideOrganizationParams) (r HideOrganizationRes, _ error) {
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// ListMyCardAccessHistory implements ListMyCardAccessHistory operation.
|
||||
//
|
||||
// Requires the session cookie of a candidate account. The candidate comes from the session, so the
|
||||
// response holds only accesses to the caller's own card. Returns a page, newest first with the record
|
||||
// identifier as the tie-breaker, with cursor pagination. The response is `Cache-Control: no-store`.
|
||||
//
|
||||
// An access is a view of the anonymous card by an organization (`card_viewed`) or a read of the
|
||||
// contacts through an active contact grant (`contact_read`). Reading the history is not an access and
|
||||
// writes nothing. A view of the card by an organization that has no invitation relation with the
|
||||
// candidate carries `organization` null, so the candidate sees that the card was viewed without
|
||||
// learning a company that they cannot otherwise see; a contact read always names the organization,
|
||||
// because the candidate accepted its invitation. The entries carry no search query, filter, or ranking
|
||||
// of the organization, and no organization the candidate hides ever appears as a viewer, because a
|
||||
// hidden organization cannot read the card.
|
||||
//
|
||||
// The storage of accesses is planned with the card and contact operations of the organization side
|
||||
// (TASK-185 and the contact read of the invitation contract); until then the operation answers 501
|
||||
// not_implemented after the session and request checks.
|
||||
//
|
||||
// A missing, unknown, expired, or revoked session answers 401 unauthenticated; an employer account
|
||||
// answers 403 forbidden. A malformed `limit` or `cursor` answers 400 validation_failed.
|
||||
//
|
||||
// GET /api/v1/me/privacy/access-history
|
||||
func (UnimplementedHandler) ListMyCardAccessHistory(ctx context.Context, params ListMyCardAccessHistoryParams) (r ListMyCardAccessHistoryRes, _ error) {
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// ListMyConsents implements ListMyConsents operation.
|
||||
//
|
||||
// Requires the session cookie of a candidate or an employer account. The subject comes from the
|
||||
@@ -910,6 +1026,25 @@ func (UnimplementedHandler) ListMyConsents(ctx context.Context, params ListMyCon
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// ListMyHiddenOrganizations implements ListMyHiddenOrganizations operation.
|
||||
//
|
||||
// Requires the session cookie of a candidate account. The candidate comes from the session, so the
|
||||
// response holds only the caller's own records and no request can name another account. Returns a page
|
||||
// of the hidden organizations, newest first with the organization identifier as the tie-breaker, with
|
||||
// cursor pagination. The response is `Cache-Control: no-store`.
|
||||
//
|
||||
// The records belong to the candidate. An organization never reads them, never learns that it is
|
||||
// hidden, and sees a hidden candidate exactly as it sees one who is not published: no search result,
|
||||
// no card, no contact read.
|
||||
//
|
||||
// A missing, unknown, expired, or revoked session answers 401 unauthenticated; an employer account
|
||||
// answers 403 forbidden. A malformed `limit` or `cursor` answers 400 validation_failed.
|
||||
//
|
||||
// GET /api/v1/me/privacy/hidden-organizations
|
||||
func (UnimplementedHandler) ListMyHiddenOrganizations(ctx context.Context, params ListMyHiddenOrganizationsParams) (r ListMyHiddenOrganizationsRes, _ error) {
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// ListMyInvitations implements ListMyInvitations operation.
|
||||
//
|
||||
// Requires the session cookie of a candidate account. The candidate comes from the session, never from
|
||||
@@ -963,6 +1098,27 @@ func (UnimplementedHandler) ListMyOrganizations(ctx context.Context, params List
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// ListMyPrivacyHistory implements ListMyPrivacyHistory operation.
|
||||
//
|
||||
// Requires the session cookie of a candidate account. The candidate comes from the session, so the
|
||||
// response holds only the caller's own records. Returns a page of the settings history, newest first
|
||||
// with the event identifier as the tie-breaker, with cursor pagination. The response is
|
||||
// `Cache-Control: no-store`.
|
||||
//
|
||||
// The history is append-only evidence of what the candidate published, hid, and announced, and when. A
|
||||
// publication event keeps the published fields and the C2 record behind them, which is what the
|
||||
// consent ledger deliberately does not carry (the C2 record proves the consent to the text, not the
|
||||
// field set). A revocation of C2 and a lapse of the search status are computed and are not events
|
||||
// here; the consent history shows the revocation. The history never contains a profile value.
|
||||
//
|
||||
// A missing, unknown, expired, or revoked session answers 401 unauthenticated; an employer account
|
||||
// answers 403 forbidden. A malformed `limit` or `cursor` answers 400 validation_failed.
|
||||
//
|
||||
// GET /api/v1/me/privacy/history
|
||||
func (UnimplementedHandler) ListMyPrivacyHistory(ctx context.Context, params ListMyPrivacyHistoryParams) (r ListMyPrivacyHistoryRes, _ error) {
|
||||
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
|
||||
@@ -1311,6 +1467,96 @@ func (UnimplementedHandler) SendOrganizationInvitation(ctx context.Context, req
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// SetMyPublication implements SetMyPublication operation.
|
||||
//
|
||||
// Requires the session cookie of a candidate account, the CSRF token of that session in X-CSRF-Token,
|
||||
// and an allowed Origin. The body is the complete new publication setting: `state` `published` with
|
||||
// the non-empty set of card fields, or `closed` with an empty set. It changes only the publication;
|
||||
// the search status and the hidden organizations stay as they were.
|
||||
//
|
||||
// Publication is not a consent and does not duplicate one. The consent C2 lives in the consent ledger
|
||||
// (`ListMyConsents`); this setting refers to it. Publishing requires an active, unrevoked C2 record of
|
||||
// the account and binds the publication to that record, so a client sends no consent identifier and
|
||||
// cannot forge one. Without one the server answers 409 state_conflict with the entry
|
||||
// `{in: body, pointer: /state, code: consent_required}` in `errors`, which tells it apart from every
|
||||
// other conflict, and changes nothing: the client gives C2 first (planned in the consent settings,
|
||||
// TASK-063) and then publishes. The server takes the C2 record under a share lock in the transaction
|
||||
// that writes the publication, so a revocation that races with a publication either commits first (the
|
||||
// publication is refused) or closes the card right after. A revocation of C2 closes the card at once,
|
||||
// because `state` is computed from the unrevoked record; a later C2 grant never reopens it, and the
|
||||
// candidate publishes again under the new record. The revocation path itself (TASK-064) closes the
|
||||
// stored publication and revokes the contact grants in its own transaction. A closing sent over a
|
||||
// stored publication whose C2 was revoked is a real change: it stores the closing, records
|
||||
// `publication_closed`, and revokes the grants as any closing does. Publishing, like every visibility
|
||||
// change, needs a verified email (a usecase requirement; the unverified account cleanup deletes only
|
||||
// accounts without such records). Publishing never adds a field that the body did not name, and a new
|
||||
// `CardField` value is never published for a candidate who did not choose it.
|
||||
//
|
||||
// The field set contains only the groups of `CardField`. The full name, contacts, and the lowest
|
||||
// salary have no value there, so no body can publish them. Only values that the candidate confirmed
|
||||
// ever reach the card. Contacts reach an organization only through the contact grant (C4), and a
|
||||
// profile that is published or closed changes none of the grants that exist; closing the publication,
|
||||
// and hiding an organization that holds a grant, revoke the contact grants concerned with the reason
|
||||
// `visibility_closed` in the same transaction as the change (planned together with the operations, see
|
||||
// the invitation contract).
|
||||
//
|
||||
// Optimistic concurrency uses `expected_version` in the body: the client sends the `version` it read,
|
||||
// 0 for the first publication. If it is not the current version the server answers 412
|
||||
// version_conflict and changes nothing. The version travels in the body rather than in If-Match
|
||||
// because the generated client cannot read the ETag header yet. A body that equals the stored setting
|
||||
// changes nothing, keeps the version, and answers 200 even when `expected_version` is older, so a
|
||||
// retry after a lost response succeeds without an Idempotency-Key. A version above the current one
|
||||
// never existed and always answers 412. Every change is recorded in the settings history with its
|
||||
// time, the fields, and the C2 record.
|
||||
//
|
||||
// Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400),
|
||||
// account scenario (403 forbidden for an employer), a version above the current one (412), rules that
|
||||
// depend on the body alone (400), an unchanged body (200), a stale version (412), then the active C2
|
||||
// for a publication (409 state_conflict). The schema rejects an unknown field, a repeated or unknown
|
||||
// card field, and more fields than there are groups; a published state with no field, and a closed
|
||||
// state with a field, answer 400 validation_failed with the pointer `/fields`. Error bodies never
|
||||
// repeat a submitted value.
|
||||
//
|
||||
// PUT /api/v1/me/privacy/publication
|
||||
func (UnimplementedHandler) SetMyPublication(ctx context.Context, req *PublicationUpdate) (r SetMyPublicationRes, _ error) {
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// SetMySearchStatus implements SetMySearchStatus operation.
|
||||
//
|
||||
// Requires the session cookie of a candidate account, the CSRF token of that session in X-CSRF-Token,
|
||||
// and an allowed Origin. The body is the complete new status: `looking` ("Ищу") or `not_looking`.
|
||||
// The status is a statement of the candidate and never a consent. It changes neither the C2 consent,
|
||||
// nor the publication, nor the hidden organizations, and it does not close or open any contact grant;
|
||||
// a candidate whose profile is closed who sets `looking` becomes visible to no one.
|
||||
//
|
||||
// `looking` stores the moment of the confirmation and a lapse time. The server takes the interval from
|
||||
// the `search_status` section of the effective product policy (30 days in the demo policy,
|
||||
// `searching_confirmation_interval_days`), stores the policy version it used, and fixes the lapse time
|
||||
// then, so a later policy change moves no stored time. Setting `looking` again is the confirmation: it
|
||||
// replaces the confirmation time with now and advances the version, also after a lapse. The body
|
||||
// carries no time, interval, or policy version.
|
||||
//
|
||||
// After the lapse time the status holds as `not_looking` with `lapsed` true on the next read. The
|
||||
// lapse is computed and written nowhere, so it needs no job, it can never make the candidate more
|
||||
// visible, and it never touches the publication or the hidden organizations. A reminder before the
|
||||
// lapse is a planned notification, not a part of this operation.
|
||||
//
|
||||
// Optimistic concurrency uses `expected_version` in the body, 0 for a candidate who never set the
|
||||
// status; a stale or non-existent version answers 412 version_conflict and changes nothing.
|
||||
// `not_looking` over a stored `not_looking` changes nothing and answers 200 even with a stale version.
|
||||
// `looking` always changes the stored confirmation, so a retry of a confirmation whose response was
|
||||
// lost with the old version answers 412 and the client reads the status again.
|
||||
//
|
||||
// Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation (400),
|
||||
// account scenario (403 forbidden for an employer), a version above the current one (412), an
|
||||
// unchanged `not_looking` (200), then a stale version (412).
|
||||
//
|
||||
// PUT /api/v1/me/privacy/search-status
|
||||
func (UnimplementedHandler) SetMySearchStatus(ctx context.Context, req *SearchStatusUpdate) (r SetMySearchStatusRes, _ error) {
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// SubmitMyAssessmentAnswer implements SubmitMyAssessmentAnswer operation.
|
||||
//
|
||||
// Requires the session cookie of a candidate account, the CSRF token of that session in X-CSRF-Token,
|
||||
@@ -1371,6 +1617,27 @@ func (UnimplementedHandler) SubmitMyAssessmentAnswer(ctx context.Context, req *A
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// UnhideOrganization implements UnhideOrganization operation.
|
||||
//
|
||||
// Requires the session cookie of a candidate account, the CSRF token of that session in X-CSRF-Token,
|
||||
// and an allowed Origin. Deletes the hiding record of the candidate for the organization in the path.
|
||||
// The request is idempotent: it answers 204 whether the organization was hidden, was not hidden, or
|
||||
// does not exist, so the operation reveals nothing about the organization, and a repeat after a lost
|
||||
// response succeeds. The record is deleted, the settings history keeps the event
|
||||
// `organization_unhidden` only when a record was deleted.
|
||||
//
|
||||
// Lifting the hiding makes the candidate readable by that organization again only if the profile is
|
||||
// published and the organization otherwise may read it. It changes neither the C2 consent, nor the
|
||||
// publication, nor the search status, and it never reopens a contact grant that the hiding closed.
|
||||
//
|
||||
// Order of checks: session (401), CSRF and Origin (403 csrf_check_failed), request validation of the
|
||||
// path (400), account scenario (403 forbidden for an employer), then the deletion (204).
|
||||
//
|
||||
// DELETE /api/v1/me/privacy/hidden-organizations/{org_id}
|
||||
func (UnimplementedHandler) UnhideOrganization(ctx context.Context, params UnhideOrganizationParams) (r UnhideOrganizationRes, _ error) {
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
// UpdateOrganization implements UpdateOrganization operation.
|
||||
//
|
||||
// Requires the session cookie of an employer account with an active membership in `org_id`, the CSRF
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,408 @@
|
||||
package httpadapter
|
||||
|
||||
import (
|
||||
"context"
|
||||
"log/slog"
|
||||
"net/http"
|
||||
"slices"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/ogen-go/ogen"
|
||||
|
||||
"lincodex/backend/internal/adapter/primary/http/api"
|
||||
"lincodex/backend/internal/adapter/primary/http/problem"
|
||||
v1 "lincodex/backend/internal/adapter/primary/http/v1"
|
||||
metrics "lincodex/backend/internal/adapter/secondary/prometheus"
|
||||
)
|
||||
|
||||
const (
|
||||
privacyBasePath = "/api/v1/me/privacy"
|
||||
privacyPublicationPath = privacyBasePath + "/publication"
|
||||
privacySearchStatusPath = privacyBasePath + "/search-status"
|
||||
privacyHiddenPath = privacyBasePath + "/hidden-organizations"
|
||||
privacyOrganizationID = "01928f7a-1a2b-7c3d-8e4f-5a6b7c8d9e01"
|
||||
)
|
||||
|
||||
// Each visibility setting is its own family of schemas. The three never
|
||||
// refer to one another, so a client cannot read or write one setting through
|
||||
// the DTO of another, and the search status is not a consent.
|
||||
var (
|
||||
publicationSchemas = []string{"Publication", "PublicationUpdate", "PublicationVersion", "PublicationState", "PublicationClosedReason", "CardField", "CardFieldSet"}
|
||||
searchStatusSchemas = []string{"SearchStatus", "SearchStatusUpdate", "SearchStatusVersion", "SearchStatusValue"}
|
||||
hiddenSchemas = []string{"HiddenOrganization", "HiddenOrganizationList", "PrivacyOrganization"}
|
||||
privacyOnlySchemas = []string{"PrivacySettings", "CardPreview", "AnonymousCardContent", "CardCategory", "PrivacyEvent", "PrivacyEventKind", "PrivacyEventList", "CardAccess", "CardAccessKind", "CardAccessList"}
|
||||
// sharedLeafSchemas are the reusable leaves that the privacy family may
|
||||
// refer to; none of them identifies a person or carries a contact.
|
||||
sharedLeafSchemas = []string{"Timestamp", "PageInfo", "SpecializationCode", "GradeCode", "StackTag"}
|
||||
)
|
||||
|
||||
func isPrivacySchema(name string) bool {
|
||||
return slices.Contains(publicationSchemas, name) || slices.Contains(searchStatusSchemas, name) ||
|
||||
slices.Contains(hiddenSchemas, name) || slices.Contains(privacyOnlySchemas, name)
|
||||
}
|
||||
|
||||
// parameterName names a parameter by its component when it is a reference.
|
||||
func parameterName(parameter *ogen.Parameter) string {
|
||||
if parameter.Ref != "" {
|
||||
return parameter.Ref[strings.LastIndex(parameter.Ref, "/")+1:]
|
||||
}
|
||||
return parameter.Name
|
||||
}
|
||||
|
||||
func privacyOperations(t *testing.T, spec *ogen.Spec) []*ogen.Operation {
|
||||
t.Helper()
|
||||
operations := make([]*ogen.Operation, 0, 9)
|
||||
for _, id := range []string{
|
||||
"GetMyPrivacySettings", "SetMyPublication", "GetMyCardPreview", "SetMySearchStatus", "ListMyHiddenOrganizations",
|
||||
"HideOrganization", "UnhideOrganization", "ListMyPrivacyHistory", "ListMyCardAccessHistory",
|
||||
} {
|
||||
operations = append(operations, operationByID(t, spec, id))
|
||||
}
|
||||
return operations
|
||||
}
|
||||
|
||||
// Every visibility operation follows the project conventions: the session
|
||||
// only for reads, the session and the CSRF token for changes, the version in
|
||||
// the body with 412, 409 for a state that does not allow the change, 404
|
||||
// without a distinction, and no new problem code.
|
||||
func TestPrivacyOperationsFollowTheConventions(t *testing.T) {
|
||||
spec := parsePublicContract(t)
|
||||
unsafe := map[string]bool{"SetMyPublication": true, "SetMySearchStatus": true, "HideOrganization": true, "UnhideOrganization": true}
|
||||
for _, operation := range privacyOperations(t, spec) {
|
||||
if !slices.Contains(operation.Tags, "privacy") {
|
||||
t.Errorf("%s is not in the privacy tag", operation.OperationID)
|
||||
}
|
||||
if !hasSecurity(operation, "sessionCookie") || hasSecurity(operation, "sessionCsrf") != unsafe[operation.OperationID] {
|
||||
t.Errorf("%s security = %v, want the session cookie, and the CSRF token exactly for a change", operation.OperationID, operation.Security)
|
||||
}
|
||||
for _, status := range []string{"401", "403"} {
|
||||
if operation.Responses[status] == nil {
|
||||
t.Errorf("%s does not declare %s", operation.OperationID, status)
|
||||
}
|
||||
}
|
||||
for _, parameter := range operation.Parameters {
|
||||
name := parameterName(parameter)
|
||||
if strings.EqualFold(name, "IdempotencyKey") || strings.EqualFold(name, "IfMatch") || strings.EqualFold(name, "Idempotency-Key") || strings.EqualFold(name, "If-Match") {
|
||||
t.Errorf("%s takes %s, but every setting is a replaced state with its version in the body", operation.OperationID, name)
|
||||
}
|
||||
}
|
||||
if success := operation.Responses["200"]; success != nil && success.Headers["Cache-Control"] == nil {
|
||||
t.Errorf("%s does not mark its 200 response no-store", operation.OperationID)
|
||||
}
|
||||
if operation.Responses["default"] == nil {
|
||||
t.Errorf("%s does not declare the problem default", operation.OperationID)
|
||||
}
|
||||
}
|
||||
for _, id := range []string{"SetMyPublication", "SetMySearchStatus"} {
|
||||
operation := operationByID(t, spec, id)
|
||||
if operation.Responses["412"] == nil || operation.Responses["400"] == nil {
|
||||
t.Errorf("%s does not declare 400 and 412", id)
|
||||
}
|
||||
update := resolveSchema(t, spec, operation.RequestBody.Content["application/json"].Schema)
|
||||
if !slices.Contains(update.Required, "expected_version") {
|
||||
t.Errorf("%s does not require expected_version", id)
|
||||
}
|
||||
}
|
||||
// Publishing needs the C2 consent, and a missing one is a state conflict.
|
||||
if operationByID(t, spec, "SetMyPublication").Responses["409"] == nil {
|
||||
t.Error("SetMyPublication does not declare 409 state_conflict for a missing C2 consent")
|
||||
}
|
||||
if operationByID(t, spec, "SetMySearchStatus").Responses["409"] != nil {
|
||||
t.Error("SetMySearchStatus declares 409: the status never depends on a consent")
|
||||
}
|
||||
// Hiding uses the same 404 for an unknown organization and one the
|
||||
// candidate cannot see; lifting the hiding reveals nothing and has no 404.
|
||||
hide := operationByID(t, spec, "HideOrganization")
|
||||
if hide.Responses["404"] == nil || hide.Responses["409"] == nil || hide.Responses["429"] == nil || hide.RequestBody != nil {
|
||||
t.Error("HideOrganization must declare 404, 409, and 429 and take no body")
|
||||
}
|
||||
unhide := operationByID(t, spec, "UnhideOrganization")
|
||||
if unhide.Responses["204"] == nil || unhide.Responses["404"] != nil {
|
||||
t.Error("UnhideOrganization must answer 204 and declare no 404: it reveals nothing about the organization")
|
||||
}
|
||||
// Lists page with the shared cursor parameters.
|
||||
for _, id := range []string{"ListMyHiddenOrganizations", "ListMyPrivacyHistory", "ListMyCardAccessHistory"} {
|
||||
names := []string{}
|
||||
for _, parameter := range operationByID(t, spec, id).Parameters {
|
||||
names = append(names, parameterName(parameter))
|
||||
}
|
||||
if !slices.Contains(names, "PageLimit") || !slices.Contains(names, "PageCursor") {
|
||||
t.Errorf("%s parameters = %v, want the shared PageLimit and PageCursor", id, names)
|
||||
}
|
||||
}
|
||||
|
||||
// No new problem code: every code of the privacy responses already exists.
|
||||
codes := enumValues(t, resolveSchema(t, spec, &ogen.Schema{Ref: "#/components/schemas/ProblemCode"}))
|
||||
for _, code := range []string{"state_conflict", "version_conflict", "not_found", "rate_limited", "validation_failed"} {
|
||||
if !slices.Contains(codes, code) {
|
||||
t.Errorf("ProblemCode has no %s", code)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The publication stores which fields are published and refers to the C2
|
||||
// consent of the ledger; it neither carries nor changes a consent. The search
|
||||
// status is not a consent either.
|
||||
func TestPublicationAndSearchStatusAreNotConsents(t *testing.T) {
|
||||
spec := parsePublicContract(t)
|
||||
index := componentsIndex(t, spec)
|
||||
|
||||
for _, pair := range []struct {
|
||||
name string
|
||||
want []string
|
||||
}{
|
||||
// The body names no consent: the server binds the active C2 record.
|
||||
{"PublicationUpdate", []string{"expected_version", "fields", "state"}},
|
||||
{"SearchStatusUpdate", []string{"expected_version", "value"}},
|
||||
{"Publication", []string{"closed_reason", "consent_id", "fields", "published_at", "state", "version"}},
|
||||
{"SearchStatus", []string{"confirmed_at", "lapsed", "lapses_at", "value", "version"}},
|
||||
{"HiddenOrganization", []string{"hidden_at", "organization"}},
|
||||
{"PrivacySettings", []string{"hidden_organizations_total", "publication", "search_status"}},
|
||||
} {
|
||||
schema := spec.Components.Schemas[pair.name]
|
||||
if schema == nil {
|
||||
t.Fatalf("the contract has no schema %s", pair.name)
|
||||
}
|
||||
if got := propertyNames(schema); !slices.Equal(got, pair.want) {
|
||||
t.Errorf("%s properties = %v, want %v", pair.name, got, pair.want)
|
||||
}
|
||||
if schema.AdditionalProperties.Bool == nil || *schema.AdditionalProperties.Bool {
|
||||
t.Errorf("%s accepts unknown fields", pair.name)
|
||||
}
|
||||
}
|
||||
|
||||
// The families do not reach one another. PrivacySettings is the one place
|
||||
// that reads the three together.
|
||||
families := map[string][]string{"publication": publicationSchemas, "search status": searchStatusSchemas, "hidden organizations": hiddenSchemas}
|
||||
for name, members := range families {
|
||||
for _, member := range members {
|
||||
for reached := range reachableSchemas(index, mustJSONValue(t, spec.Components.Schemas[member])) {
|
||||
for otherName, others := range families {
|
||||
if otherName != name && slices.Contains(others, reached) {
|
||||
t.Errorf("the %s schema %s reaches the %s schema %s", name, member, otherName, reached)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// A consent, a profile, an account, or an invitation is reachable from
|
||||
// none of the settings: the status is a statement, never a consent.
|
||||
for _, name := range slices.Concat(publicationSchemas, searchStatusSchemas, hiddenSchemas, privacyOnlySchemas) {
|
||||
for reached := range reachableSchemas(index, mustJSONValue(t, spec.Components.Schemas[name])) {
|
||||
if strings.HasPrefix(reached, "Consent") || strings.HasPrefix(reached, "Profile") || strings.HasPrefix(reached, "CandidateProfile") ||
|
||||
strings.HasPrefix(reached, "Invitation") || strings.HasPrefix(reached, "Contact") || reached == "Session" || reached == "User" {
|
||||
t.Errorf("%s reaches %s", name, reached)
|
||||
}
|
||||
}
|
||||
}
|
||||
// The search status operation reaches no publication or hidden schema.
|
||||
statusOperation := reachableSchemas(index, mustJSONValue(t, spec.Paths[privacySearchStatusPath]))
|
||||
for _, name := range slices.Concat(publicationSchemas, hiddenSchemas, privacyOnlySchemas) {
|
||||
if statusOperation[name] {
|
||||
t.Errorf("the search status path reaches %s", name)
|
||||
}
|
||||
}
|
||||
|
||||
// The published field set cannot name a name, a contact, or the salary.
|
||||
fields := enumValues(t, resolveSchema(t, spec, &ogen.Schema{Ref: "#/components/schemas/CardField"}))
|
||||
want := []string{"categories", "stack", "experience", "soft_skills", "location", "relocation"}
|
||||
slices.Sort(fields)
|
||||
slices.Sort(want)
|
||||
if !slices.Equal(fields, want) {
|
||||
t.Errorf("CardField = %v, want %v", fields, want)
|
||||
}
|
||||
if update := spec.Components.Schemas["CardFieldSet"]; update.UniqueItems != true || update.MaxItems == nil || *update.MaxItems != uint64(len(want)) {
|
||||
t.Error("CardFieldSet must hold distinct items and at most one per field")
|
||||
}
|
||||
status := enumValues(t, resolveSchema(t, spec, &ogen.Schema{Ref: "#/components/schemas/SearchStatusValue"}))
|
||||
if !slices.Equal(status, []string{"looking", "not_looking"}) {
|
||||
t.Errorf("SearchStatusValue = %v, want looking and not_looking", status)
|
||||
}
|
||||
}
|
||||
|
||||
// The anonymous card never reaches a profile, a contact, or an identifier:
|
||||
// whatever an organization reads of a candidate before an accepted invitation
|
||||
// is limited to its own closed set of properties.
|
||||
func TestAnonymousCardReachesNoProfileOrContactSchema(t *testing.T) {
|
||||
spec := parsePublicContract(t)
|
||||
index := componentsIndex(t, spec)
|
||||
|
||||
card := spec.Components.Schemas["AnonymousCardContent"]
|
||||
if card == nil {
|
||||
t.Fatal("the contract has no AnonymousCardContent")
|
||||
}
|
||||
if got, want := propertyNames(card), []string{"categories", "experience_months", "location", "relocation", "soft_skills", "stack"}; !slices.Equal(got, want) {
|
||||
t.Errorf("AnonymousCardContent properties = %v, want %v", got, want)
|
||||
}
|
||||
if card.AdditionalProperties.Bool == nil || *card.AdditionalProperties.Bool {
|
||||
t.Error("AnonymousCardContent accepts unknown properties")
|
||||
}
|
||||
// Each property is a card field and nothing else; a null is a hidden or
|
||||
// missing value, never a flag that tells which.
|
||||
for _, forbidden := range []string{"email", "phone", "telegram", "contact", "name", "salary", "user", "account", "profile", "employer", "id", "url", "link", "github", "resume"} {
|
||||
for _, name := range propertyNames(card) {
|
||||
if strings.Contains(name, forbidden) {
|
||||
t.Errorf("AnonymousCardContent has the property %q, which looks like %q", name, forbidden)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// What the card and the preview reach is a small closed list of leaves.
|
||||
allowed := []string{"AnonymousCardContent", "CardCategory", "CardField", "CardFieldSet", "PublicationState", "SpecializationCode", "GradeCode", "StackTag", "Timestamp", "CardPreview"}
|
||||
for _, name := range []string{"AnonymousCardContent", "CardPreview"} {
|
||||
for reached := range reachableSchemas(index, mustJSONValue(t, spec.Components.Schemas[name])) {
|
||||
if !slices.Contains(allowed, reached) {
|
||||
t.Errorf("%s reaches %s, which the anonymous card must not carry", name, reached)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The private profile, the contact formats, and the contact disclosure
|
||||
// are not reachable from any privacy schema or operation.
|
||||
for path, item := range spec.Paths {
|
||||
if !strings.HasPrefix(path, privacyBasePath) {
|
||||
continue
|
||||
}
|
||||
for reached := range reachableSchemas(index, mustJSONValue(t, item)) {
|
||||
if isProfileSchema(reached) || strings.HasPrefix(reached, "Contact") || reached == "EmailAddress" || reached == "PhoneNumber" ||
|
||||
strings.HasPrefix(reached, "Invitation") || strings.HasPrefix(reached, "Need") || strings.HasPrefix(reached, "Consent") {
|
||||
t.Errorf("%s reaches %s", path, reached)
|
||||
}
|
||||
if !isPrivacySchema(reached) && !slices.Contains(sharedLeafSchemas, reached) && !strings.HasPrefix(reached, "Problem") &&
|
||||
reached != "Problem" && reached != "ProblemCode" {
|
||||
t.Errorf("%s reaches %s, which is neither a privacy schema nor a shared leaf", path, reached)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The reverse: the private profile family does not reach the card or any
|
||||
// visibility schema, and an organization path reaches no setting of a
|
||||
// candidate. The card content stays the only privacy schema meant for
|
||||
// organization-visible operations later (TASK-185).
|
||||
for name, schema := range spec.Components.Schemas {
|
||||
if isPrivacySchema(name) {
|
||||
continue
|
||||
}
|
||||
for reached := range reachableSchemas(index, mustJSONValue(t, schema)) {
|
||||
if isPrivacySchema(reached) && reached != "AnonymousCardContent" && reached != "CardCategory" && reached != "CardField" && reached != "CardFieldSet" {
|
||||
t.Errorf("%s reaches the candidate-private schema %s", name, reached)
|
||||
}
|
||||
}
|
||||
}
|
||||
for path, item := range spec.Paths {
|
||||
if !strings.HasPrefix(path, "/api/v1/organizations") {
|
||||
continue
|
||||
}
|
||||
for reached := range reachableSchemas(index, mustJSONValue(t, item)) {
|
||||
if isPrivacySchema(reached) {
|
||||
t.Errorf("%s reaches the candidate-private schema %s", path, reached)
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, dto := range []any{api.AnonymousCardContent{}, api.CardCategory{}, api.CardPreview{}} {
|
||||
assertNoJSONFields(t, dto, []string{
|
||||
"full_name", "name", "email", "phone", "telegram", "contacts", "salary_minimum", "user_id", "account_id", "profile_id", "employer", "resume",
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// The generated request DTOs carry only what the candidate may choose: no
|
||||
// consent identifier, time, interval, or policy version.
|
||||
func TestGeneratedPrivacyDTOsCarryNoServerOwnedFields(t *testing.T) {
|
||||
assertNoJSONFields(t, api.PublicationUpdate{}, []string{"consent_id", "consent", "published_at", "version", "user_id", "contacts", "full_name", "salary_minimum"})
|
||||
assertNoJSONFields(t, api.SearchStatusUpdate{}, []string{"confirmed_at", "lapses_at", "lapsed", "interval", "policy_version", "policy_version_id", "consent_id", "version"})
|
||||
assertNoJSONFields(t, api.SearchStatus{}, []string{"consent_id", "published", "fields", "hidden_organizations", "policy_version_id"})
|
||||
assertNoJSONFields(t, api.HiddenOrganization{}, []string{"user_id", "candidate_id", "candidate", "reason"})
|
||||
}
|
||||
|
||||
func newPrivacyRouter(t *testing.T) http.Handler {
|
||||
t.Helper()
|
||||
logger := slog.New(slog.DiscardHandler)
|
||||
healthHandler := newTestHealthHandler(func(context.Context) error { return nil })
|
||||
router, err := NewRouter(healthHandler, v1.NewHandler(healthHandler, problem.NewResponder(logger)), &recordingSecurity{}, problem.NewResponder(logger), metrics.New(), logger, nil)
|
||||
if err != nil {
|
||||
t.Fatalf("NewRouter() error = %v", err)
|
||||
}
|
||||
return router
|
||||
}
|
||||
|
||||
// The operations are in the contract before their business logic: a schema
|
||||
// failure answers 400 before anything else, a valid request with an accepted
|
||||
// session answers 501, and no body reaches the handler without validation.
|
||||
func TestPrivacySchemaValidationPrecedesImplementation(t *testing.T) {
|
||||
session := map[string]string{"Cookie": testSessionCookie, "X-CSRF-Token": testCSRFToken}
|
||||
for _, test := range []struct {
|
||||
name string
|
||||
method string
|
||||
path string
|
||||
body string
|
||||
statusCode int
|
||||
location api.ProblemFieldLocation
|
||||
pointer string
|
||||
code string
|
||||
}{
|
||||
{name: "a valid publication", method: http.MethodPut, path: privacyPublicationPath, body: `{"expected_version":0,"state":"published","fields":["categories","stack"]}`, statusCode: http.StatusNotImplemented},
|
||||
{name: "a valid closing", method: http.MethodPut, path: privacyPublicationPath, body: `{"expected_version":3,"state":"closed","fields":[]}`, statusCode: http.StatusNotImplemented},
|
||||
{name: "a missing version", method: http.MethodPut, path: privacyPublicationPath, body: `{"state":"closed","fields":[]}`, statusCode: http.StatusBadRequest, location: api.ProblemFieldLocationBody, pointer: "/expected_version", code: "required"},
|
||||
{name: "a negative version", method: http.MethodPut, path: privacyPublicationPath, body: `{"expected_version":-1,"state":"closed","fields":[]}`, statusCode: http.StatusBadRequest, location: api.ProblemFieldLocationBody, pointer: "/expected_version", code: "invalid"},
|
||||
{name: "a contact as a card field", method: http.MethodPut, path: privacyPublicationPath, body: `{"expected_version":0,"state":"published","fields":["phone"]}`, statusCode: http.StatusBadRequest, location: api.ProblemFieldLocationBody, pointer: "/fields/0", code: "invalid"},
|
||||
{name: "the full name as a card field", method: http.MethodPut, path: privacyPublicationPath, body: `{"expected_version":0,"state":"published","fields":["full_name"]}`, statusCode: http.StatusBadRequest, location: api.ProblemFieldLocationBody, pointer: "/fields/0", code: "invalid"},
|
||||
{name: "a repeated card field", method: http.MethodPut, path: privacyPublicationPath, body: `{"expected_version":0,"state":"published","fields":["stack","stack"]}`, statusCode: http.StatusBadRequest, location: api.ProblemFieldLocationBody, pointer: "/fields", code: "invalid"},
|
||||
{name: "a state outside the enum", method: http.MethodPut, path: privacyPublicationPath, body: `{"expected_version":0,"state":"draft","fields":[]}`, statusCode: http.StatusBadRequest, location: api.ProblemFieldLocationBody, pointer: "/state", code: "invalid"},
|
||||
{name: "a consent identifier from the client", method: http.MethodPut, path: privacyPublicationPath, body: `{"expected_version":0,"state":"published","fields":["stack"],"consent_id":"01928f7a-7a8b-7c9d-8e0f-1a2b3c4d5e60"}`, statusCode: http.StatusBadRequest, location: api.ProblemFieldLocationBody, pointer: "", code: "invalid"},
|
||||
{name: "a valid status", method: http.MethodPut, path: privacySearchStatusPath, body: `{"expected_version":0,"value":"looking"}`, statusCode: http.StatusNotImplemented},
|
||||
{name: "a status outside the enum", method: http.MethodPut, path: privacySearchStatusPath, body: `{"expected_version":0,"value":"open"}`, statusCode: http.StatusBadRequest, location: api.ProblemFieldLocationBody, pointer: "/value", code: "invalid"},
|
||||
{name: "a confirmation time from the client", method: http.MethodPut, path: privacySearchStatusPath, body: `{"expected_version":0,"value":"looking","confirmed_at":"2026-10-06T09:00:00Z"}`, statusCode: http.StatusBadRequest, location: api.ProblemFieldLocationBody, pointer: "", code: "invalid"},
|
||||
{name: "hiding an organization", method: http.MethodPut, path: privacyHiddenPath + "/" + privacyOrganizationID, statusCode: http.StatusNotImplemented},
|
||||
{name: "hiding a malformed identifier", method: http.MethodPut, path: privacyHiddenPath + "/not-a-uuid", statusCode: http.StatusBadRequest, location: api.ProblemFieldLocationPath, pointer: "/org_id", code: "invalid"},
|
||||
{name: "lifting a hiding", method: http.MethodDelete, path: privacyHiddenPath + "/" + privacyOrganizationID, statusCode: http.StatusNotImplemented},
|
||||
{name: "lifting a malformed identifier", method: http.MethodDelete, path: privacyHiddenPath + "/not-a-uuid", statusCode: http.StatusBadRequest, location: api.ProblemFieldLocationPath, pointer: "/org_id", code: "invalid"},
|
||||
{name: "the settings", method: http.MethodGet, path: privacyBasePath, statusCode: http.StatusNotImplemented},
|
||||
{name: "the preview", method: http.MethodGet, path: privacyBasePath + "/preview", statusCode: http.StatusNotImplemented},
|
||||
{name: "the hidden list", method: http.MethodGet, path: privacyHiddenPath + "?limit=50", statusCode: http.StatusNotImplemented},
|
||||
{name: "a hidden list limit over 100", method: http.MethodGet, path: privacyHiddenPath + "?limit=101", statusCode: http.StatusBadRequest, location: api.ProblemFieldLocationQuery, pointer: "/limit", code: "invalid"},
|
||||
{name: "the history", method: http.MethodGet, path: privacyBasePath + "/history", statusCode: http.StatusNotImplemented},
|
||||
{name: "a malformed history cursor", method: http.MethodGet, path: privacyBasePath + "/history?cursor=not%20a%20cursor", statusCode: http.StatusBadRequest, location: api.ProblemFieldLocationQuery, pointer: "/cursor", code: "invalid"},
|
||||
{name: "the access history", method: http.MethodGet, path: privacyBasePath + "/access-history", statusCode: http.StatusNotImplemented},
|
||||
} {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
response := serveIdentityRequest(t, newPrivacyRouter(t), identityRequest{method: test.method, path: test.path, body: test.body, headers: session})
|
||||
if test.statusCode == http.StatusNotImplemented {
|
||||
requireProblem(t, response, http.StatusNotImplemented, api.ProblemCodeNotImplemented)
|
||||
return
|
||||
}
|
||||
problemBody := requireProblem(t, response, test.statusCode, api.ProblemCodeValidationFailed)
|
||||
want := api.ProblemFieldError{In: test.location, Pointer: test.pointer, Code: test.code}
|
||||
for _, field := range problemBody.Errors {
|
||||
if field.In == want.In && field.Pointer == want.Pointer && field.Code == want.Code {
|
||||
return
|
||||
}
|
||||
}
|
||||
t.Fatalf("errors = %+v, want an entry %+v", problemBody.Errors, want)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// Nothing here is reachable without a session: the deny-all security of the
|
||||
// scaffold answers 401 for every operation, with or without a cookie.
|
||||
func TestPrivacyAccessBeforeImplementation(t *testing.T) {
|
||||
session := map[string]string{"Cookie": testSessionCookie, "X-CSRF-Token": testCSRFToken}
|
||||
for _, test := range []identityRequest{
|
||||
{method: http.MethodGet, path: privacyBasePath},
|
||||
{method: http.MethodGet, path: privacyBasePath + "/preview"},
|
||||
{method: http.MethodGet, path: privacyBasePath + "/history", headers: session},
|
||||
{method: http.MethodGet, path: privacyBasePath + "/access-history"},
|
||||
{method: http.MethodGet, path: privacyHiddenPath},
|
||||
{method: http.MethodPut, path: privacyPublicationPath, body: `{"expected_version":0,"state":"closed","fields":[]}`, headers: session},
|
||||
{method: http.MethodPut, path: privacySearchStatusPath, body: `{"expected_version":0,"value":"not_looking"}`, headers: session},
|
||||
{method: http.MethodPut, path: privacyHiddenPath + "/" + privacyOrganizationID, headers: session},
|
||||
{method: http.MethodDelete, path: privacyHiddenPath + "/" + privacyOrganizationID, headers: session},
|
||||
} {
|
||||
t.Run(test.method+" "+test.path, func(t *testing.T) {
|
||||
router := newTestRouter(t, func(context.Context) error { return nil })
|
||||
requireProblem(t, serveIdentityRequest(t, router, test), http.StatusUnauthorized, api.ProblemCodeUnauthenticated)
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user