feat(accounts): add consent settings and organization management

This commit is contained in:
TakuyaYagam1 committed 2026-10-07 13:00:39 +03:00
1 parent 24638d46d2
commit 391af7a1ef
83 files changed
+10198 -613

No files matched your search

File diff suppressed because it is too large. Load diff
@@ -69,6 +69,10 @@ type GetMyCardPreviewRes interface {
getMyCardPreviewRes()
}
type GetMyConsentTextRes interface {
getMyConsentTextRes()
}
type GetMyInvitationRes interface {
getMyInvitationRes()
}
@@ -105,6 +109,10 @@ type GetOrganizationRes interface {
getOrganizationRes()
}
type GrantMyConsentRes interface {
grantMyConsentRes()
}
type HideOrganizationRes interface {
hideOrganizationRes()
}
@@ -161,10 +169,22 @@ type RegisterAccountRes interface {
registerAccountRes()
}
type RequestMyAccountDeletionRes interface {
requestMyAccountDeletionRes()
}
type ResendEmailVerificationRes interface {
resendEmailVerificationRes()
}
type RevokeMyConsentRes interface {
revokeMyConsentRes()
}
type RevokeMyOrganizationContactConsentRes interface {
revokeMyOrganizationContactConsentRes()
}
type SaveMyProfileRes interface {
saveMyProfileRes()
}
@@ -12492,6 +12492,172 @@ func (s *ConfirmEmailForbidden) UnmarshalJSON(data []byte) error {
return s.Decode(d)
}
// Encode implements json.Marshaler.
func (s *ConsentDeletionRequest) Encode(e *jx.Encoder) {
e.ObjStart()
s.encodeFields(e)
e.ObjEnd()
}
// encodeFields encodes fields.
func (s *ConsentDeletionRequest) encodeFields(e *jx.Encoder) {
{
e.FieldStart("id")
json.EncodeUUID(e, s.ID)
}
{
e.FieldStart("status")
s.Status.Encode(e)
}
{
e.FieldStart("requested_at")
s.RequestedAt.Encode(e)
}
}
var jsonFieldsNameOfConsentDeletionRequest = [3]string{
0: "id",
1: "status",
2: "requested_at",
}
// Decode decodes ConsentDeletionRequest from json.
func (s *ConsentDeletionRequest) Decode(d *jx.Decoder) error {
if s == nil {
return errors.New("invalid: unable to decode ConsentDeletionRequest to nil")
}
var requiredBitSet [1]uint8
if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error {
switch string(k) {
case "id":
requiredBitSet[0] |= 1 << 0
if err := func() error {
v, err := json.DecodeUUID(d)
s.ID = v
if err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"id\"")
}
case "status":
requiredBitSet[0] |= 1 << 1
if err := func() error {
if err := s.Status.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"status\"")
}
case "requested_at":
requiredBitSet[0] |= 1 << 2
if err := func() error {
if err := s.RequestedAt.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"requested_at\"")
}
default:
return errors.Errorf("unexpected field %q", k)
}
return nil
}); err != nil {
return errors.Wrap(err, "decode ConsentDeletionRequest")
}
// Validate required fields.
var failures []validate.FieldError
for i, mask := range [1]uint8{
0b00000111,
} {
if result := (requiredBitSet[i] & mask) ^ mask; result != 0 {
// Mask only required fields and check equality to mask using XOR.
//
// If XOR result is not zero, result is not equal to expected, so some fields are missed.
// Bits of fields which would be set are actually bits of missed fields.
missed := bits.OnesCount8(result)
for bitN := 0; bitN < missed; bitN++ {
bitIdx := bits.TrailingZeros8(result)
fieldIdx := i*8 + bitIdx
var name string
if fieldIdx < len(jsonFieldsNameOfConsentDeletionRequest) {
name = jsonFieldsNameOfConsentDeletionRequest[fieldIdx]
} else {
name = strconv.Itoa(fieldIdx)
}
failures = append(failures, validate.FieldError{
Name: name,
Error: validate.ErrFieldRequired,
})
// Reset bit.
result &^= 1 << bitIdx
}
}
}
if len(failures) > 0 {
return &validate.Error{Fields: failures}
}
return nil
}
// MarshalJSON implements stdjson.Marshaler.
func (s *ConsentDeletionRequest) MarshalJSON() ([]byte, error) {
e := jx.Encoder{}
s.Encode(&e)
return e.Bytes(), nil
}
// UnmarshalJSON implements stdjson.Unmarshaler.
func (s *ConsentDeletionRequest) UnmarshalJSON(data []byte) error {
d := jx.DecodeBytes(data)
return s.Decode(d)
}
// Encode encodes ConsentDeletionRequestStatus as json.
func (s ConsentDeletionRequestStatus) Encode(e *jx.Encoder) {
e.Str(string(s))
}
// Decode decodes ConsentDeletionRequestStatus from json.
func (s *ConsentDeletionRequestStatus) Decode(d *jx.Decoder) error {
if s == nil {
return errors.New("invalid: unable to decode ConsentDeletionRequestStatus to nil")
}
v, err := d.StrBytes()
if err != nil {
return err
}
// Try to use constant string.
switch ConsentDeletionRequestStatus(v) {
case ConsentDeletionRequestStatusRequested:
*s = ConsentDeletionRequestStatusRequested
case ConsentDeletionRequestStatusProcessing:
*s = ConsentDeletionRequestStatusProcessing
default:
*s = ConsentDeletionRequestStatus(v)
}
return nil
}
// MarshalJSON implements stdjson.Marshaler.
func (s ConsentDeletionRequestStatus) MarshalJSON() ([]byte, error) {
e := jx.Encoder{}
s.Encode(&e)
return e.Bytes(), nil
}
// UnmarshalJSON implements stdjson.Unmarshaler.
func (s *ConsentDeletionRequestStatus) UnmarshalJSON(data []byte) error {
d := jx.DecodeBytes(data)
return s.Decode(d)
}
// Encode implements json.Marshaler.
func (s *ConsentOrganization) Encode(e *jx.Encoder) {
e.ObjStart()
@@ -12605,44 +12771,6 @@ func (s *ConsentOrganization) UnmarshalJSON(data []byte) error {
return s.Decode(d)
}
// Encode encodes ConsentPurpose as json.
func (s ConsentPurpose) Encode(e *jx.Encoder) {
e.Str(string(s))
}
// Decode decodes ConsentPurpose from json.
func (s *ConsentPurpose) Decode(d *jx.Decoder) error {
if s == nil {
return errors.New("invalid: unable to decode ConsentPurpose to nil")
}
v, err := d.StrBytes()
if err != nil {
return err
}
// Try to use constant string.
switch ConsentPurpose(v) {
case ConsentPurposeC1:
*s = ConsentPurposeC1
default:
*s = ConsentPurpose(v)
}
return nil
}
// MarshalJSON implements stdjson.Marshaler.
func (s ConsentPurpose) MarshalJSON() ([]byte, error) {
e := jx.Encoder{}
s.Encode(&e)
return e.Bytes(), nil
}
// UnmarshalJSON implements stdjson.Unmarshaler.
func (s *ConsentPurpose) UnmarshalJSON(data []byte) error {
d := jx.DecodeBytes(data)
return s.Decode(d)
}
// Encode encodes ConsentPurposeCode as json.
func (s ConsentPurposeCode) Encode(e *jx.Encoder) {
e.Str(string(s))
@@ -13135,6 +13263,147 @@ func (s *ConsentRevocationSource) UnmarshalJSON(data []byte) error {
return s.Decode(d)
}
// Encode implements json.Marshaler.
func (s *ConsentSettingsGrantRequest) Encode(e *jx.Encoder) {
e.ObjStart()
s.encodeFields(e)
e.ObjEnd()
}
// encodeFields encodes fields.
func (s *ConsentSettingsGrantRequest) encodeFields(e *jx.Encoder) {
{
e.FieldStart("text_version")
s.TextVersion.Encode(e)
}
{
e.FieldStart("accepted")
s.Accepted.Encode(e)
}
}
var jsonFieldsNameOfConsentSettingsGrantRequest = [2]string{
0: "text_version",
1: "accepted",
}
// Decode decodes ConsentSettingsGrantRequest from json.
func (s *ConsentSettingsGrantRequest) Decode(d *jx.Decoder) error {
if s == nil {
return errors.New("invalid: unable to decode ConsentSettingsGrantRequest to nil")
}
var requiredBitSet [1]uint8
if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error {
switch string(k) {
case "text_version":
requiredBitSet[0] |= 1 << 0
if err := func() error {
if err := s.TextVersion.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"text_version\"")
}
case "accepted":
requiredBitSet[0] |= 1 << 1
if err := func() error {
if err := s.Accepted.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "decode field \"accepted\"")
}
default:
return errors.Errorf("unexpected field %q", k)
}
return nil
}); err != nil {
return errors.Wrap(err, "decode ConsentSettingsGrantRequest")
}
// Validate required fields.
var failures []validate.FieldError
for i, mask := range [1]uint8{
0b00000011,
} {
if result := (requiredBitSet[i] & mask) ^ mask; result != 0 {
// Mask only required fields and check equality to mask using XOR.
//
// If XOR result is not zero, result is not equal to expected, so some fields are missed.
// Bits of fields which would be set are actually bits of missed fields.
missed := bits.OnesCount8(result)
for bitN := 0; bitN < missed; bitN++ {
bitIdx := bits.TrailingZeros8(result)
fieldIdx := i*8 + bitIdx
var name string
if fieldIdx < len(jsonFieldsNameOfConsentSettingsGrantRequest) {
name = jsonFieldsNameOfConsentSettingsGrantRequest[fieldIdx]
} else {
name = strconv.Itoa(fieldIdx)
}
failures = append(failures, validate.FieldError{
Name: name,
Error: validate.ErrFieldRequired,
})
// Reset bit.
result &^= 1 << bitIdx
}
}
}
if len(failures) > 0 {
return &validate.Error{Fields: failures}
}
return nil
}
// MarshalJSON implements stdjson.Marshaler.
func (s *ConsentSettingsGrantRequest) MarshalJSON() ([]byte, error) {
e := jx.Encoder{}
s.Encode(&e)
return e.Bytes(), nil
}
// UnmarshalJSON implements stdjson.Unmarshaler.
func (s *ConsentSettingsGrantRequest) UnmarshalJSON(data []byte) error {
d := jx.DecodeBytes(data)
return s.Decode(d)
}
// Encode encodes ConsentSettingsGrantRequestAccepted as json.
func (s ConsentSettingsGrantRequestAccepted) Encode(e *jx.Encoder) {
e.Bool(bool(s))
}
// Decode decodes ConsentSettingsGrantRequestAccepted from json.
func (s *ConsentSettingsGrantRequestAccepted) Decode(d *jx.Decoder) error {
if s == nil {
return errors.New("invalid: unable to decode ConsentSettingsGrantRequestAccepted to nil")
}
v, err := d.Bool()
if err != nil {
return err
}
*s = ConsentSettingsGrantRequestAccepted(v)
return nil
}
// MarshalJSON implements stdjson.Marshaler.
func (s ConsentSettingsGrantRequestAccepted) MarshalJSON() ([]byte, error) {
e := jx.Encoder{}
s.Encode(&e)
return e.Bytes(), nil
}
// UnmarshalJSON implements stdjson.Unmarshaler.
func (s *ConsentSettingsGrantRequestAccepted) UnmarshalJSON(data []byte) error {
d := jx.DecodeBytes(data)
return s.Decode(d)
}
// Encode encodes ConsentSource as json.
func (s ConsentSource) Encode(e *jx.Encoder) {
e.Str(string(s))
@@ -17436,6 +17705,82 @@ func (s *GetMyCardPreviewUnauthorized) UnmarshalJSON(data []byte) error {
return s.Decode(d)
}
// Encode encodes GetMyConsentTextBadRequest as json.
func (s *GetMyConsentTextBadRequest) Encode(e *jx.Encoder) {
unwrapped := (*Problem)(s)
unwrapped.Encode(e)
}
// Decode decodes GetMyConsentTextBadRequest from json.
func (s *GetMyConsentTextBadRequest) Decode(d *jx.Decoder) error {
if s == nil {
return errors.New("invalid: unable to decode GetMyConsentTextBadRequest to nil")
}
var unwrapped Problem
if err := func() error {
if err := unwrapped.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "alias")
}
*s = GetMyConsentTextBadRequest(unwrapped)
return nil
}
// MarshalJSON implements stdjson.Marshaler.
func (s *GetMyConsentTextBadRequest) MarshalJSON() ([]byte, error) {
e := jx.Encoder{}
s.Encode(&e)
return e.Bytes(), nil
}
// UnmarshalJSON implements stdjson.Unmarshaler.
func (s *GetMyConsentTextBadRequest) UnmarshalJSON(data []byte) error {
d := jx.DecodeBytes(data)
return s.Decode(d)
}
// Encode encodes GetMyConsentTextUnauthorized as json.
func (s *GetMyConsentTextUnauthorized) Encode(e *jx.Encoder) {
unwrapped := (*Problem)(s)
unwrapped.Encode(e)
}
// Decode decodes GetMyConsentTextUnauthorized from json.
func (s *GetMyConsentTextUnauthorized) Decode(d *jx.Decoder) error {
if s == nil {
return errors.New("invalid: unable to decode GetMyConsentTextUnauthorized to nil")
}
var unwrapped Problem
if err := func() error {
if err := unwrapped.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "alias")
}
*s = GetMyConsentTextUnauthorized(unwrapped)
return nil
}
// MarshalJSON implements stdjson.Marshaler.
func (s *GetMyConsentTextUnauthorized) MarshalJSON() ([]byte, error) {
e := jx.Encoder{}
s.Encode(&e)
return e.Bytes(), nil
}
// UnmarshalJSON implements stdjson.Unmarshaler.
func (s *GetMyConsentTextUnauthorized) UnmarshalJSON(data []byte) error {
d := jx.DecodeBytes(data)
return s.Decode(d)
}
// Encode encodes GetMyInvitationBadRequest as json.
func (s *GetMyInvitationBadRequest) Encode(e *jx.Encoder) {
unwrapped := (*Problem)(s)
@@ -18582,6 +18927,120 @@ func (s *GradeCode) UnmarshalJSON(data []byte) error {
return s.Decode(d)
}
// Encode encodes GrantMyConsentBadRequest as json.
func (s *GrantMyConsentBadRequest) Encode(e *jx.Encoder) {
unwrapped := (*Problem)(s)
unwrapped.Encode(e)
}
// Decode decodes GrantMyConsentBadRequest from json.
func (s *GrantMyConsentBadRequest) Decode(d *jx.Decoder) error {
if s == nil {
return errors.New("invalid: unable to decode GrantMyConsentBadRequest to nil")
}
var unwrapped Problem
if err := func() error {
if err := unwrapped.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "alias")
}
*s = GrantMyConsentBadRequest(unwrapped)
return nil
}
// MarshalJSON implements stdjson.Marshaler.
func (s *GrantMyConsentBadRequest) MarshalJSON() ([]byte, error) {
e := jx.Encoder{}
s.Encode(&e)
return e.Bytes(), nil
}
// UnmarshalJSON implements stdjson.Unmarshaler.
func (s *GrantMyConsentBadRequest) UnmarshalJSON(data []byte) error {
d := jx.DecodeBytes(data)
return s.Decode(d)
}
// Encode encodes GrantMyConsentForbidden as json.
func (s *GrantMyConsentForbidden) Encode(e *jx.Encoder) {
unwrapped := (*Problem)(s)
unwrapped.Encode(e)
}
// Decode decodes GrantMyConsentForbidden from json.
func (s *GrantMyConsentForbidden) Decode(d *jx.Decoder) error {
if s == nil {
return errors.New("invalid: unable to decode GrantMyConsentForbidden to nil")
}
var unwrapped Problem
if err := func() error {
if err := unwrapped.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "alias")
}
*s = GrantMyConsentForbidden(unwrapped)
return nil
}
// MarshalJSON implements stdjson.Marshaler.
func (s *GrantMyConsentForbidden) MarshalJSON() ([]byte, error) {
e := jx.Encoder{}
s.Encode(&e)
return e.Bytes(), nil
}
// UnmarshalJSON implements stdjson.Unmarshaler.
func (s *GrantMyConsentForbidden) UnmarshalJSON(data []byte) error {
d := jx.DecodeBytes(data)
return s.Decode(d)
}
// Encode encodes GrantMyConsentUnauthorized as json.
func (s *GrantMyConsentUnauthorized) Encode(e *jx.Encoder) {
unwrapped := (*Problem)(s)
unwrapped.Encode(e)
}
// Decode decodes GrantMyConsentUnauthorized from json.
func (s *GrantMyConsentUnauthorized) Decode(d *jx.Decoder) error {
if s == nil {
return errors.New("invalid: unable to decode GrantMyConsentUnauthorized to nil")
}
var unwrapped Problem
if err := func() error {
if err := unwrapped.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "alias")
}
*s = GrantMyConsentUnauthorized(unwrapped)
return nil
}
// MarshalJSON implements stdjson.Marshaler.
func (s *GrantMyConsentUnauthorized) MarshalJSON() ([]byte, error) {
e := jx.Encoder{}
s.Encode(&e)
return e.Bytes(), nil
}
// UnmarshalJSON implements stdjson.Unmarshaler.
func (s *GrantMyConsentUnauthorized) UnmarshalJSON(data []byte) error {
d := jx.DecodeBytes(data)
return s.Decode(d)
}
// Encode implements json.Marshaler.
func (s *HealthResponse) Encode(e *jx.Encoder) {
e.ObjStart()
@@ -43764,6 +44223,82 @@ func (s *RegistrationRequest) UnmarshalJSON(data []byte) error {
return s.Decode(d)
}
// Encode encodes RequestMyAccountDeletionForbidden as json.
func (s *RequestMyAccountDeletionForbidden) Encode(e *jx.Encoder) {
unwrapped := (*Problem)(s)
unwrapped.Encode(e)
}
// Decode decodes RequestMyAccountDeletionForbidden from json.
func (s *RequestMyAccountDeletionForbidden) Decode(d *jx.Decoder) error {
if s == nil {
return errors.New("invalid: unable to decode RequestMyAccountDeletionForbidden to nil")
}
var unwrapped Problem
if err := func() error {
if err := unwrapped.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "alias")
}
*s = RequestMyAccountDeletionForbidden(unwrapped)
return nil
}
// MarshalJSON implements stdjson.Marshaler.
func (s *RequestMyAccountDeletionForbidden) MarshalJSON() ([]byte, error) {
e := jx.Encoder{}
s.Encode(&e)
return e.Bytes(), nil
}
// UnmarshalJSON implements stdjson.Unmarshaler.
func (s *RequestMyAccountDeletionForbidden) UnmarshalJSON(data []byte) error {
d := jx.DecodeBytes(data)
return s.Decode(d)
}
// Encode encodes RequestMyAccountDeletionUnauthorized as json.
func (s *RequestMyAccountDeletionUnauthorized) Encode(e *jx.Encoder) {
unwrapped := (*Problem)(s)
unwrapped.Encode(e)
}
// Decode decodes RequestMyAccountDeletionUnauthorized from json.
func (s *RequestMyAccountDeletionUnauthorized) Decode(d *jx.Decoder) error {
if s == nil {
return errors.New("invalid: unable to decode RequestMyAccountDeletionUnauthorized to nil")
}
var unwrapped Problem
if err := func() error {
if err := unwrapped.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "alias")
}
*s = RequestMyAccountDeletionUnauthorized(unwrapped)
return nil
}
// MarshalJSON implements stdjson.Marshaler.
func (s *RequestMyAccountDeletionUnauthorized) MarshalJSON() ([]byte, error) {
e := jx.Encoder{}
s.Encode(&e)
return e.Bytes(), nil
}
// UnmarshalJSON implements stdjson.Unmarshaler.
func (s *RequestMyAccountDeletionUnauthorized) UnmarshalJSON(data []byte) error {
d := jx.DecodeBytes(data)
return s.Decode(d)
}
// Encode encodes ResendEmailVerificationBadRequest as json.
func (s *ResendEmailVerificationBadRequest) Encode(e *jx.Encoder) {
unwrapped := (*Problem)(s)
@@ -43840,6 +44375,158 @@ func (s *ResendEmailVerificationForbidden) UnmarshalJSON(data []byte) error {
return s.Decode(d)
}
// Encode encodes RevokeMyConsentForbidden as json.
func (s *RevokeMyConsentForbidden) Encode(e *jx.Encoder) {
unwrapped := (*Problem)(s)
unwrapped.Encode(e)
}
// Decode decodes RevokeMyConsentForbidden from json.
func (s *RevokeMyConsentForbidden) Decode(d *jx.Decoder) error {
if s == nil {
return errors.New("invalid: unable to decode RevokeMyConsentForbidden to nil")
}
var unwrapped Problem
if err := func() error {
if err := unwrapped.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "alias")
}
*s = RevokeMyConsentForbidden(unwrapped)
return nil
}
// MarshalJSON implements stdjson.Marshaler.
func (s *RevokeMyConsentForbidden) MarshalJSON() ([]byte, error) {
e := jx.Encoder{}
s.Encode(&e)
return e.Bytes(), nil
}
// UnmarshalJSON implements stdjson.Unmarshaler.
func (s *RevokeMyConsentForbidden) UnmarshalJSON(data []byte) error {
d := jx.DecodeBytes(data)
return s.Decode(d)
}
// Encode encodes RevokeMyConsentUnauthorized as json.
func (s *RevokeMyConsentUnauthorized) Encode(e *jx.Encoder) {
unwrapped := (*Problem)(s)
unwrapped.Encode(e)
}
// Decode decodes RevokeMyConsentUnauthorized from json.
func (s *RevokeMyConsentUnauthorized) Decode(d *jx.Decoder) error {
if s == nil {
return errors.New("invalid: unable to decode RevokeMyConsentUnauthorized to nil")
}
var unwrapped Problem
if err := func() error {
if err := unwrapped.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "alias")
}
*s = RevokeMyConsentUnauthorized(unwrapped)
return nil
}
// MarshalJSON implements stdjson.Marshaler.
func (s *RevokeMyConsentUnauthorized) MarshalJSON() ([]byte, error) {
e := jx.Encoder{}
s.Encode(&e)
return e.Bytes(), nil
}
// UnmarshalJSON implements stdjson.Unmarshaler.
func (s *RevokeMyConsentUnauthorized) UnmarshalJSON(data []byte) error {
d := jx.DecodeBytes(data)
return s.Decode(d)
}
// Encode encodes RevokeMyOrganizationContactConsentForbidden as json.
func (s *RevokeMyOrganizationContactConsentForbidden) Encode(e *jx.Encoder) {
unwrapped := (*Problem)(s)
unwrapped.Encode(e)
}
// Decode decodes RevokeMyOrganizationContactConsentForbidden from json.
func (s *RevokeMyOrganizationContactConsentForbidden) Decode(d *jx.Decoder) error {
if s == nil {
return errors.New("invalid: unable to decode RevokeMyOrganizationContactConsentForbidden to nil")
}
var unwrapped Problem
if err := func() error {
if err := unwrapped.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "alias")
}
*s = RevokeMyOrganizationContactConsentForbidden(unwrapped)
return nil
}
// MarshalJSON implements stdjson.Marshaler.
func (s *RevokeMyOrganizationContactConsentForbidden) MarshalJSON() ([]byte, error) {
e := jx.Encoder{}
s.Encode(&e)
return e.Bytes(), nil
}
// UnmarshalJSON implements stdjson.Unmarshaler.
func (s *RevokeMyOrganizationContactConsentForbidden) UnmarshalJSON(data []byte) error {
d := jx.DecodeBytes(data)
return s.Decode(d)
}
// Encode encodes RevokeMyOrganizationContactConsentUnauthorized as json.
func (s *RevokeMyOrganizationContactConsentUnauthorized) Encode(e *jx.Encoder) {
unwrapped := (*Problem)(s)
unwrapped.Encode(e)
}
// Decode decodes RevokeMyOrganizationContactConsentUnauthorized from json.
func (s *RevokeMyOrganizationContactConsentUnauthorized) Decode(d *jx.Decoder) error {
if s == nil {
return errors.New("invalid: unable to decode RevokeMyOrganizationContactConsentUnauthorized to nil")
}
var unwrapped Problem
if err := func() error {
if err := unwrapped.Decode(d); err != nil {
return err
}
return nil
}(); err != nil {
return errors.Wrap(err, "alias")
}
*s = RevokeMyOrganizationContactConsentUnauthorized(unwrapped)
return nil
}
// MarshalJSON implements stdjson.Marshaler.
func (s *RevokeMyOrganizationContactConsentUnauthorized) MarshalJSON() ([]byte, error) {
e := jx.Encoder{}
s.Encode(&e)
return e.Bytes(), nil
}
// UnmarshalJSON implements stdjson.Unmarshaler.
func (s *RevokeMyOrganizationContactConsentUnauthorized) UnmarshalJSON(data []byte) error {
d := jx.DecodeBytes(data)
return s.Decode(d)
}
// Encode encodes RubAmount as json.
func (s RubAmount) Encode(e *jx.Encoder) {
unwrapped := int64(s)
@@ -6,60 +6,65 @@ package api
type OperationName = string
const (
AcceptMyInvitationOperation OperationName = "AcceptMyInvitation"
CancelMyInvitationOperation OperationName = "CancelMyInvitation"
ConfirmEmailOperation OperationName = "ConfirmEmail"
CreateMyAssessmentAttemptOperation OperationName = "CreateMyAssessmentAttempt"
CreateMySupportCaseOperation OperationName = "CreateMySupportCase"
CreateOrganizationOperation OperationName = "CreateOrganization"
CreateOrganizationInvitationOperation OperationName = "CreateOrganizationInvitation"
CreateOrganizationNeedOperation OperationName = "CreateOrganizationNeed"
DeclineMyInvitationOperation OperationName = "DeclineMyInvitation"
FinalizeMyAssessmentAttemptOperation OperationName = "FinalizeMyAssessmentAttempt"
GetConsentTextOperation OperationName = "GetConsentText"
GetCurrentAccountOperation OperationName = "GetCurrentAccount"
GetCurrentSessionOperation OperationName = "GetCurrentSession"
GetHealthzOperation OperationName = "GetHealthz"
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"
GetOrganizationOperation OperationName = "GetOrganization"
GetOrganizationInvitationOperation OperationName = "GetOrganizationInvitation"
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"
LoginOperation OperationName = "Login"
LogoutOperation OperationName = "Logout"
RaiseOrganizationInvitationSalaryOperation OperationName = "RaiseOrganizationInvitationSalary"
RegisterAccountOperation OperationName = "RegisterAccount"
ResendEmailVerificationOperation OperationName = "ResendEmailVerification"
SaveMyProfileOperation OperationName = "SaveMyProfile"
SaveMyQuestionnaireOperation OperationName = "SaveMyQuestionnaire"
SendOrganizationInvitationOperation OperationName = "SendOrganizationInvitation"
SetMyPublicationOperation OperationName = "SetMyPublication"
SetMySearchStatusOperation OperationName = "SetMySearchStatus"
StartMyAssessmentAttemptSessionOperation OperationName = "StartMyAssessmentAttemptSession"
SubmitMyAssessmentAnswerOperation OperationName = "SubmitMyAssessmentAnswer"
UnhideOrganizationOperation OperationName = "UnhideOrganization"
UpdateOrganizationOperation OperationName = "UpdateOrganization"
UpdateOrganizationInvitationOperation OperationName = "UpdateOrganizationInvitation"
UpdateOrganizationNeedOperation OperationName = "UpdateOrganizationNeed"
ViewMyInvitationOperation OperationName = "ViewMyInvitation"
WithdrawOrganizationInvitationOperation OperationName = "WithdrawOrganizationInvitation"
AcceptMyInvitationOperation OperationName = "AcceptMyInvitation"
CancelMyInvitationOperation OperationName = "CancelMyInvitation"
ConfirmEmailOperation OperationName = "ConfirmEmail"
CreateMyAssessmentAttemptOperation OperationName = "CreateMyAssessmentAttempt"
CreateMySupportCaseOperation OperationName = "CreateMySupportCase"
CreateOrganizationOperation OperationName = "CreateOrganization"
CreateOrganizationInvitationOperation OperationName = "CreateOrganizationInvitation"
CreateOrganizationNeedOperation OperationName = "CreateOrganizationNeed"
DeclineMyInvitationOperation OperationName = "DeclineMyInvitation"
FinalizeMyAssessmentAttemptOperation OperationName = "FinalizeMyAssessmentAttempt"
GetConsentTextOperation OperationName = "GetConsentText"
GetCurrentAccountOperation OperationName = "GetCurrentAccount"
GetCurrentSessionOperation OperationName = "GetCurrentSession"
GetHealthzOperation OperationName = "GetHealthz"
GetMyAssessmentAttemptOperation OperationName = "GetMyAssessmentAttempt"
GetMyAssessmentAvailabilityOperation OperationName = "GetMyAssessmentAvailability"
GetMyAssessmentResultOperation OperationName = "GetMyAssessmentResult"
GetMyCardPreviewOperation OperationName = "GetMyCardPreview"
GetMyConsentTextOperation OperationName = "GetMyConsentText"
GetMyInvitationOperation OperationName = "GetMyInvitation"
GetMyPrivacySettingsOperation OperationName = "GetMyPrivacySettings"
GetMyProfileOperation OperationName = "GetMyProfile"
GetMyQuestionnaireOperation OperationName = "GetMyQuestionnaire"
GetMySupportCaseOperation OperationName = "GetMySupportCase"
GetOrganizationOperation OperationName = "GetOrganization"
GetOrganizationInvitationOperation OperationName = "GetOrganizationInvitation"
GetOrganizationInvitationContactsOperation OperationName = "GetOrganizationInvitationContacts"
GetOrganizationNeedOperation OperationName = "GetOrganizationNeed"
GetSpecializationCatalogOperation OperationName = "GetSpecializationCatalog"
GrantMyConsentOperation OperationName = "GrantMyConsent"
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"
LoginOperation OperationName = "Login"
LogoutOperation OperationName = "Logout"
RaiseOrganizationInvitationSalaryOperation OperationName = "RaiseOrganizationInvitationSalary"
RegisterAccountOperation OperationName = "RegisterAccount"
RequestMyAccountDeletionOperation OperationName = "RequestMyAccountDeletion"
ResendEmailVerificationOperation OperationName = "ResendEmailVerification"
RevokeMyConsentOperation OperationName = "RevokeMyConsent"
RevokeMyOrganizationContactConsentOperation OperationName = "RevokeMyOrganizationContactConsent"
SaveMyProfileOperation OperationName = "SaveMyProfile"
SaveMyQuestionnaireOperation OperationName = "SaveMyQuestionnaire"
SendOrganizationInvitationOperation OperationName = "SendOrganizationInvitation"
SetMyPublicationOperation OperationName = "SetMyPublication"
SetMySearchStatusOperation OperationName = "SetMySearchStatus"
StartMyAssessmentAttemptSessionOperation OperationName = "StartMyAssessmentAttemptSession"
SubmitMyAssessmentAnswerOperation OperationName = "SubmitMyAssessmentAnswer"
UnhideOrganizationOperation OperationName = "UnhideOrganization"
UpdateOrganizationOperation OperationName = "UpdateOrganization"
UpdateOrganizationInvitationOperation OperationName = "UpdateOrganizationInvitation"
UpdateOrganizationNeedOperation OperationName = "UpdateOrganizationNeed"
ViewMyInvitationOperation OperationName = "ViewMyInvitation"
WithdrawOrganizationInvitationOperation OperationName = "WithdrawOrganizationInvitation"
)
@@ -1498,6 +1498,80 @@ func decodeGetMyAssessmentResultParams(args [1]string, argsEscaped bool, r *http
return params, nil
}
// GetMyConsentTextParams is parameters of GetMyConsentText operation.
type GetMyConsentTextParams struct {
// Consent whose current text is requested.
Purpose ConsentSettingsPurpose
}
func unpackGetMyConsentTextParams(packed middleware.Parameters) (params GetMyConsentTextParams) {
{
key := middleware.ParameterKey{
Name: "purpose",
In: "path",
}
params.Purpose = packed[key].(ConsentSettingsPurpose)
}
return params
}
func decodeGetMyConsentTextParams(args [1]string, argsEscaped bool, r *http.Request) (params GetMyConsentTextParams, _ error) {
// Decode path: purpose.
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: "purpose",
Value: param,
Style: uri.PathStyleSimple,
Explode: false,
})
if err := func() error {
val, err := d.DecodeValue()
if err != nil {
return err
}
c, err := conv.ToString(val)
if err != nil {
return err
}
params.Purpose = ConsentSettingsPurpose(c)
return nil
}(); err != nil {
return err
}
if err := func() error {
if err := params.Purpose.Validate(); err != nil {
return err
}
return nil
}(); err != nil {
return err
}
} else {
return validate.ErrFieldRequired
}
return nil
}(); err != nil {
return params, &ogenerrors.DecodeParamError{
Name: "purpose",
In: "path",
Err: err,
}
}
return params, nil
}
// GetMyInvitationParams is parameters of GetMyInvitation operation.
type GetMyInvitationParams struct {
// Identifier of an invitation addressed to the current candidate. A draft, an invitation addressed to
@@ -2074,6 +2148,80 @@ func decodeGetOrganizationNeedParams(args [2]string, argsEscaped bool, r *http.R
return params, nil
}
// GrantMyConsentParams is parameters of GrantMyConsent operation.
type GrantMyConsentParams struct {
// Independent consent being granted. C4 is not available here.
Purpose ConsentSettingsPurpose
}
func unpackGrantMyConsentParams(packed middleware.Parameters) (params GrantMyConsentParams) {
{
key := middleware.ParameterKey{
Name: "purpose",
In: "path",
}
params.Purpose = packed[key].(ConsentSettingsPurpose)
}
return params
}
func decodeGrantMyConsentParams(args [1]string, argsEscaped bool, r *http.Request) (params GrantMyConsentParams, _ error) {
// Decode path: purpose.
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: "purpose",
Value: param,
Style: uri.PathStyleSimple,
Explode: false,
})
if err := func() error {
val, err := d.DecodeValue()
if err != nil {
return err
}
c, err := conv.ToString(val)
if err != nil {
return err
}
params.Purpose = ConsentSettingsPurpose(c)
return nil
}(); err != nil {
return err
}
if err := func() error {
if err := params.Purpose.Validate(); err != nil {
return err
}
return nil
}(); err != nil {
return err
}
} else {
return validate.ErrFieldRequired
}
return nil
}(); err != nil {
return params, &ogenerrors.DecodeParamError{
Name: "purpose",
In: "path",
Err: err,
}
}
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
@@ -4209,6 +4357,147 @@ func decodeRegisterAccountParams(args [0]string, argsEscaped bool, r *http.Reque
return params, nil
}
// RevokeMyConsentParams is parameters of RevokeMyConsent operation.
type RevokeMyConsentParams struct {
// Consent being revoked. C1 has a deletion-request operation and C4 requires an organization scope.
Purpose ConsentSettingsRevokePurpose
}
func unpackRevokeMyConsentParams(packed middleware.Parameters) (params RevokeMyConsentParams) {
{
key := middleware.ParameterKey{
Name: "purpose",
In: "path",
}
params.Purpose = packed[key].(ConsentSettingsRevokePurpose)
}
return params
}
func decodeRevokeMyConsentParams(args [1]string, argsEscaped bool, r *http.Request) (params RevokeMyConsentParams, _ error) {
// Decode path: purpose.
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: "purpose",
Value: param,
Style: uri.PathStyleSimple,
Explode: false,
})
if err := func() error {
val, err := d.DecodeValue()
if err != nil {
return err
}
c, err := conv.ToString(val)
if err != nil {
return err
}
params.Purpose = ConsentSettingsRevokePurpose(c)
return nil
}(); err != nil {
return err
}
if err := func() error {
if err := params.Purpose.Validate(); err != nil {
return err
}
return nil
}(); err != nil {
return err
}
} else {
return validate.ErrFieldRequired
}
return nil
}(); err != nil {
return params, &ogenerrors.DecodeParamError{
Name: "purpose",
In: "path",
Err: err,
}
}
return params, nil
}
// RevokeMyOrganizationContactConsentParams is parameters of RevokeMyOrganizationContactConsent operation.
type RevokeMyOrganizationContactConsentParams struct {
// Organization whose stored C4 grants this account revokes. A well-formed identifier outside the
// account's stored records changes nothing and does not reveal whether that organization exists.
OrgID uuid.UUID
}
func unpackRevokeMyOrganizationContactConsentParams(packed middleware.Parameters) (params RevokeMyOrganizationContactConsentParams) {
{
key := middleware.ParameterKey{
Name: "org_id",
In: "path",
}
params.OrgID = packed[key].(uuid.UUID)
}
return params
}
func decodeRevokeMyOrganizationContactConsentParams(args [1]string, argsEscaped bool, r *http.Request) (params RevokeMyOrganizationContactConsentParams, _ 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
}
// SendOrganizationInvitationParams is parameters of SendOrganizationInvitation operation.
type SendOrganizationInvitationParams struct {
// Identifier of an organization. Access comes only from an active membership of the session account in
@@ -804,6 +804,85 @@ func (s *Server) decodeFinalizeMyAssessmentAttemptRequest(r *http.Request) (
}
}
func (s *Server) decodeGrantMyConsentRequest(r *http.Request) (
req *ConsentSettingsGrantRequest,
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 ConsentSettingsGrantRequest
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) decodeLoginRequest(r *http.Request) (
req *LoginRequest,
rawBody []byte,
@@ -1742,6 +1742,65 @@ func encodeGetMyCardPreviewResponse(response GetMyCardPreviewRes, w http.Respons
}
}
func encodeGetMyConsentTextResponse(response GetMyConsentTextRes, w http.ResponseWriter, span trace.Span) error {
switch response := response.(type) {
case *ConsentTextHeaders:
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 *GetMyConsentTextBadRequest:
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 *GetMyConsentTextUnauthorized:
w.Header().Set("Content-Type", "application/problem+json")
w.WriteHeader(401)
e := new(jx.Encoder)
response.Encode(e)
if _, err := e.WriteTo(w); err != nil {
return errors.Wrap(err, "write")
}
return nil
default:
return errors.Errorf("unexpected response type: %T", response)
}
}
func encodeGetMyInvitationResponse(response GetMyInvitationRes, w http.ResponseWriter, span trace.Span) error {
switch response := response.(type) {
case *CandidateInvitationHeaders:
@@ -2418,6 +2477,77 @@ func encodeGetSpecializationCatalogResponse(response *SpecializationCatalog, w h
return nil
}
func encodeGrantMyConsentResponse(response GrantMyConsentRes, w http.ResponseWriter, span trace.Span) error {
switch response := response.(type) {
case *ConsentRecordHeaders:
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 *GrantMyConsentBadRequest:
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 *GrantMyConsentUnauthorized:
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 *GrantMyConsentForbidden:
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 encodeHideOrganizationResponse(response HideOrganizationRes, w http.ResponseWriter, span trace.Span) error {
switch response := response.(type) {
case *HiddenOrganizationHeaders:
@@ -3620,6 +3750,65 @@ func encodeRegisterAccountResponse(response RegisterAccountRes, w http.ResponseW
}
}
func encodeRequestMyAccountDeletionResponse(response RequestMyAccountDeletionRes, w http.ResponseWriter, span trace.Span) error {
switch response := response.(type) {
case *ConsentDeletionRequestHeaders:
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(202)
e := new(jx.Encoder)
response.Response.Encode(e)
if _, err := e.WriteTo(w); err != nil {
return errors.Wrap(err, "write")
}
return nil
case *RequestMyAccountDeletionUnauthorized:
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 *RequestMyAccountDeletionForbidden:
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 encodeResendEmailVerificationResponse(response ResendEmailVerificationRes, w http.ResponseWriter, span trace.Span) error {
switch response := response.(type) {
case *IdentityRequestAccepted:
@@ -3695,6 +3884,78 @@ func encodeResendEmailVerificationResponse(response ResendEmailVerificationRes,
}
}
func encodeRevokeMyConsentResponse(response RevokeMyConsentRes, w http.ResponseWriter, span trace.Span) error {
switch response := response.(type) {
case *RevokeMyConsentNoContent:
w.WriteHeader(204)
return nil
case *RevokeMyConsentUnauthorized:
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 *RevokeMyConsentForbidden:
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 encodeRevokeMyOrganizationContactConsentResponse(response RevokeMyOrganizationContactConsentRes, w http.ResponseWriter, span trace.Span) error {
switch response := response.(type) {
case *RevokeMyOrganizationContactConsentNoContent:
w.WriteHeader(204)
return nil
case *RevokeMyOrganizationContactConsentUnauthorized:
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 *RevokeMyOrganizationContactConsentForbidden:
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 encodeSaveMyProfileResponse(response SaveMyProfileRes, w http.ResponseWriter, span trace.Span) error {
switch response := response.(type) {
case *CandidateProfileHeaders:
File diff suppressed because it is too large. Load diff
@@ -6261,6 +6261,117 @@ type ConfirmEmailForbidden Problem
func (*ConfirmEmailForbidden) confirmEmailRes() {}
// Durable request to delete the account and its personal data. The request is recorded before
// asynchronous processing starts; it does not mean deletion has completed.
// Ref: #/components/schemas/ConsentDeletionRequest
type ConsentDeletionRequest struct {
// Identifier of the durable deletion request.
ID uuid.UUID `json:"id"`
// Current state of the deletion request.
Status ConsentDeletionRequestStatus `json:"status"`
RequestedAt Timestamp `json:"requested_at"`
}
// GetID returns the value of ID.
func (s *ConsentDeletionRequest) GetID() uuid.UUID {
return s.ID
}
// GetStatus returns the value of Status.
func (s *ConsentDeletionRequest) GetStatus() ConsentDeletionRequestStatus {
return s.Status
}
// GetRequestedAt returns the value of RequestedAt.
func (s *ConsentDeletionRequest) GetRequestedAt() Timestamp {
return s.RequestedAt
}
// SetID sets the value of ID.
func (s *ConsentDeletionRequest) SetID(val uuid.UUID) {
s.ID = val
}
// SetStatus sets the value of Status.
func (s *ConsentDeletionRequest) SetStatus(val ConsentDeletionRequestStatus) {
s.Status = val
}
// SetRequestedAt sets the value of RequestedAt.
func (s *ConsentDeletionRequest) SetRequestedAt(val Timestamp) {
s.RequestedAt = val
}
// ConsentDeletionRequestHeaders wraps ConsentDeletionRequest with response headers.
type ConsentDeletionRequestHeaders struct {
CacheControl CacheControlNoStore
Response ConsentDeletionRequest
}
// GetCacheControl returns the value of CacheControl.
func (s *ConsentDeletionRequestHeaders) GetCacheControl() CacheControlNoStore {
return s.CacheControl
}
// GetResponse returns the value of Response.
func (s *ConsentDeletionRequestHeaders) GetResponse() ConsentDeletionRequest {
return s.Response
}
// SetCacheControl sets the value of CacheControl.
func (s *ConsentDeletionRequestHeaders) SetCacheControl(val CacheControlNoStore) {
s.CacheControl = val
}
// SetResponse sets the value of Response.
func (s *ConsentDeletionRequestHeaders) SetResponse(val ConsentDeletionRequest) {
s.Response = val
}
func (*ConsentDeletionRequestHeaders) requestMyAccountDeletionRes() {}
// Current state of the deletion request.
type ConsentDeletionRequestStatus string
const (
ConsentDeletionRequestStatusRequested ConsentDeletionRequestStatus = "requested"
ConsentDeletionRequestStatusProcessing ConsentDeletionRequestStatus = "processing"
)
// AllValues returns all ConsentDeletionRequestStatus values.
func (ConsentDeletionRequestStatus) AllValues() []ConsentDeletionRequestStatus {
return []ConsentDeletionRequestStatus{
ConsentDeletionRequestStatusRequested,
ConsentDeletionRequestStatusProcessing,
}
}
// MarshalText implements encoding.TextMarshaler.
func (s ConsentDeletionRequestStatus) MarshalText() ([]byte, error) {
switch s {
case ConsentDeletionRequestStatusRequested:
return []byte(s), nil
case ConsentDeletionRequestStatusProcessing:
return []byte(s), nil
default:
return nil, errors.Errorf("invalid value: %q", s)
}
}
// UnmarshalText implements encoding.TextUnmarshaler.
func (s *ConsentDeletionRequestStatus) UnmarshalText(data []byte) error {
switch ConsentDeletionRequestStatus(data) {
case ConsentDeletionRequestStatusRequested:
*s = ConsentDeletionRequestStatusRequested
return nil
case ConsentDeletionRequestStatusProcessing:
*s = ConsentDeletionRequestStatusProcessing
return nil
default:
return errors.Errorf("invalid value: %q", data)
}
}
// Organization of a c4 consent as the consent recorded it. `name` is a snapshot of the name that the
// shown consent text carried at the time of the consent, and the stored text hash proves that text
// with this name; a later rename of the organization does not change it, so it can differ from the
@@ -6559,6 +6670,34 @@ func (s *ConsentRecord) SetInvitationTermsVersion(val NilInvitationTermsVersion)
s.InvitationTermsVersion = val
}
// ConsentRecordHeaders wraps ConsentRecord with response headers.
type ConsentRecordHeaders struct {
CacheControl CacheControlNoStore
Response ConsentRecord
}
// GetCacheControl returns the value of CacheControl.
func (s *ConsentRecordHeaders) GetCacheControl() CacheControlNoStore {
return s.CacheControl
}
// GetResponse returns the value of Response.
func (s *ConsentRecordHeaders) GetResponse() ConsentRecord {
return s.Response
}
// SetCacheControl sets the value of CacheControl.
func (s *ConsentRecordHeaders) SetCacheControl(val CacheControlNoStore) {
s.CacheControl = val
}
// SetResponse sets the value of Response.
func (s *ConsentRecordHeaders) SetResponse(val ConsentRecord) {
s.Response = val
}
func (*ConsentRecordHeaders) grantMyConsentRes() {}
// One page of the consent ledger of the current account, newest grant first.
// Ref: #/components/schemas/ConsentRecordList
type ConsentRecordList struct {
@@ -6662,6 +6801,158 @@ func (s *ConsentRevocationSource) UnmarshalText(data []byte) error {
}
}
// Accept the current published text shown by GetMyConsentText. The server checks its version again
// before recording the grant.
// Ref: #/components/schemas/ConsentSettingsGrantRequest
type ConsentSettingsGrantRequest struct {
TextVersion ConsentTextVersion `json:"text_version"`
// Must be true to record an explicit acceptance.
Accepted ConsentSettingsGrantRequestAccepted `json:"accepted"`
}
// GetTextVersion returns the value of TextVersion.
func (s *ConsentSettingsGrantRequest) GetTextVersion() ConsentTextVersion {
return s.TextVersion
}
// GetAccepted returns the value of Accepted.
func (s *ConsentSettingsGrantRequest) GetAccepted() ConsentSettingsGrantRequestAccepted {
return s.Accepted
}
// SetTextVersion sets the value of TextVersion.
func (s *ConsentSettingsGrantRequest) SetTextVersion(val ConsentTextVersion) {
s.TextVersion = val
}
// SetAccepted sets the value of Accepted.
func (s *ConsentSettingsGrantRequest) SetAccepted(val ConsentSettingsGrantRequestAccepted) {
s.Accepted = val
}
// Must be true to record an explicit acceptance.
type ConsentSettingsGrantRequestAccepted bool
const (
ConsentSettingsGrantRequestAcceptedTrue ConsentSettingsGrantRequestAccepted = true
)
// AllValues returns all ConsentSettingsGrantRequestAccepted values.
func (ConsentSettingsGrantRequestAccepted) AllValues() []ConsentSettingsGrantRequestAccepted {
return []ConsentSettingsGrantRequestAccepted{
ConsentSettingsGrantRequestAcceptedTrue,
}
}
// Consent text that an authenticated account can read and accept in settings. C4 is scoped to an
// invitation and organization, so it is not available through the general settings flow.
// Ref: #/components/schemas/ConsentSettingsPurpose
type ConsentSettingsPurpose string
const (
ConsentSettingsPurposeC1 ConsentSettingsPurpose = "c1"
ConsentSettingsPurposeC2 ConsentSettingsPurpose = "c2"
ConsentSettingsPurposeC3 ConsentSettingsPurpose = "c3"
ConsentSettingsPurposeC5 ConsentSettingsPurpose = "c5"
)
// AllValues returns all ConsentSettingsPurpose values.
func (ConsentSettingsPurpose) AllValues() []ConsentSettingsPurpose {
return []ConsentSettingsPurpose{
ConsentSettingsPurposeC1,
ConsentSettingsPurposeC2,
ConsentSettingsPurposeC3,
ConsentSettingsPurposeC5,
}
}
// MarshalText implements encoding.TextMarshaler.
func (s ConsentSettingsPurpose) MarshalText() ([]byte, error) {
switch s {
case ConsentSettingsPurposeC1:
return []byte(s), nil
case ConsentSettingsPurposeC2:
return []byte(s), nil
case ConsentSettingsPurposeC3:
return []byte(s), nil
case ConsentSettingsPurposeC5:
return []byte(s), nil
default:
return nil, errors.Errorf("invalid value: %q", s)
}
}
// UnmarshalText implements encoding.TextUnmarshaler.
func (s *ConsentSettingsPurpose) UnmarshalText(data []byte) error {
switch ConsentSettingsPurpose(data) {
case ConsentSettingsPurposeC1:
*s = ConsentSettingsPurposeC1
return nil
case ConsentSettingsPurposeC2:
*s = ConsentSettingsPurposeC2
return nil
case ConsentSettingsPurposeC3:
*s = ConsentSettingsPurposeC3
return nil
case ConsentSettingsPurposeC5:
*s = ConsentSettingsPurposeC5
return nil
default:
return errors.Errorf("invalid value: %q", data)
}
}
// Consent that can be revoked through the general settings flow. C1 uses the account deletion request,
// and C4 must be revoked for one organization.
// Ref: #/components/schemas/ConsentSettingsRevokePurpose
type ConsentSettingsRevokePurpose string
const (
ConsentSettingsRevokePurposeC2 ConsentSettingsRevokePurpose = "c2"
ConsentSettingsRevokePurposeC3 ConsentSettingsRevokePurpose = "c3"
ConsentSettingsRevokePurposeC5 ConsentSettingsRevokePurpose = "c5"
)
// AllValues returns all ConsentSettingsRevokePurpose values.
func (ConsentSettingsRevokePurpose) AllValues() []ConsentSettingsRevokePurpose {
return []ConsentSettingsRevokePurpose{
ConsentSettingsRevokePurposeC2,
ConsentSettingsRevokePurposeC3,
ConsentSettingsRevokePurposeC5,
}
}
// MarshalText implements encoding.TextMarshaler.
func (s ConsentSettingsRevokePurpose) MarshalText() ([]byte, error) {
switch s {
case ConsentSettingsRevokePurposeC2:
return []byte(s), nil
case ConsentSettingsRevokePurposeC3:
return []byte(s), nil
case ConsentSettingsRevokePurposeC5:
return []byte(s), nil
default:
return nil, errors.Errorf("invalid value: %q", s)
}
}
// UnmarshalText implements encoding.TextUnmarshaler.
func (s *ConsentSettingsRevokePurpose) UnmarshalText(data []byte) error {
switch ConsentSettingsRevokePurpose(data) {
case ConsentSettingsRevokePurposeC2:
*s = ConsentSettingsRevokePurposeC2
return nil
case ConsentSettingsRevokePurposeC3:
*s = ConsentSettingsRevokePurposeC3
return nil
case ConsentSettingsRevokePurposeC5:
*s = ConsentSettingsRevokePurposeC5
return nil
default:
return errors.Errorf("invalid value: %q", data)
}
}
// Where the subject gave the consent.
//
// - registration: the c1 acceptance of RegisterAccount.
@@ -6780,7 +7071,7 @@ func (s *ConsentState) UnmarshalText(data []byte) error {
// of exactly this text.
// Ref: #/components/schemas/ConsentText
type ConsentText struct {
Purpose ConsentPurpose `json:"purpose"`
Purpose ConsentPurposeCode `json:"purpose"`
TextVersion ConsentTextVersion `json:"text_version"`
// Full consent text in plain UTF-8; paragraphs are separated by an empty line. The client shows it as
// text, never as HTML.
@@ -6789,7 +7080,7 @@ type ConsentText struct {
}
// GetPurpose returns the value of Purpose.
func (s *ConsentText) GetPurpose() ConsentPurpose {
func (s *ConsentText) GetPurpose() ConsentPurposeCode {
return s.Purpose
}
@@ -6809,7 +7100,7 @@ func (s *ConsentText) GetPublishedAt() Timestamp {
}
// SetPurpose sets the value of Purpose.
func (s *ConsentText) SetPurpose(val ConsentPurpose) {
func (s *ConsentText) SetPurpose(val ConsentPurposeCode) {
s.Purpose = val
}
@@ -6830,6 +7121,34 @@ func (s *ConsentText) SetPublishedAt(val Timestamp) {
func (*ConsentText) getConsentTextRes() {}
// ConsentTextHeaders wraps ConsentText with response headers.
type ConsentTextHeaders struct {
CacheControl CacheControlNoStore
Response ConsentText
}
// GetCacheControl returns the value of CacheControl.
func (s *ConsentTextHeaders) GetCacheControl() CacheControlNoStore {
return s.CacheControl
}
// GetResponse returns the value of Response.
func (s *ConsentTextHeaders) GetResponse() ConsentText {
return s.Response
}
// SetCacheControl sets the value of CacheControl.
func (s *ConsentTextHeaders) SetCacheControl(val CacheControlNoStore) {
s.CacheControl = val
}
// SetResponse sets the value of Response.
func (s *ConsentTextHeaders) SetResponse(val ConsentText) {
s.Response = val
}
func (*ConsentTextHeaders) getMyConsentTextRes() {}
type ConsentTextVersion string
// Why an active grant does not allow a read now, shown only to the candidate.
@@ -8046,6 +8365,14 @@ type GetMyCardPreviewUnauthorized Problem
func (*GetMyCardPreviewUnauthorized) getMyCardPreviewRes() {}
type GetMyConsentTextBadRequest Problem
func (*GetMyConsentTextBadRequest) getMyConsentTextRes() {}
type GetMyConsentTextUnauthorized Problem
func (*GetMyConsentTextUnauthorized) getMyConsentTextRes() {}
type GetMyInvitationBadRequest Problem
func (*GetMyInvitationBadRequest) getMyInvitationRes() {}
@@ -8222,6 +8549,18 @@ func (s *GradeCode) UnmarshalText(data []byte) error {
}
}
type GrantMyConsentBadRequest Problem
func (*GrantMyConsentBadRequest) grantMyConsentRes() {}
type GrantMyConsentForbidden Problem
func (*GrantMyConsentForbidden) grantMyConsentRes() {}
type GrantMyConsentUnauthorized Problem
func (*GrantMyConsentUnauthorized) grantMyConsentRes() {}
// Ref: #/components/schemas/HealthResponse
type HealthResponse struct {
Status HealthResponseStatus `json:"status"`
@@ -21991,6 +22330,14 @@ func (s *RegistrationRequest) SetConsentC1(val PersonalDataConsentAcceptance) {
s.ConsentC1 = val
}
type RequestMyAccountDeletionForbidden Problem
func (*RequestMyAccountDeletionForbidden) requestMyAccountDeletionRes() {}
type RequestMyAccountDeletionUnauthorized Problem
func (*RequestMyAccountDeletionUnauthorized) requestMyAccountDeletionRes() {}
type ResendEmailVerificationBadRequest Problem
func (*ResendEmailVerificationBadRequest) resendEmailVerificationRes() {}
@@ -21999,6 +22346,32 @@ type ResendEmailVerificationForbidden Problem
func (*ResendEmailVerificationForbidden) resendEmailVerificationRes() {}
type RevokeMyConsentForbidden Problem
func (*RevokeMyConsentForbidden) revokeMyConsentRes() {}
// RevokeMyConsentNoContent is response for RevokeMyConsent operation.
type RevokeMyConsentNoContent struct{}
func (*RevokeMyConsentNoContent) revokeMyConsentRes() {}
type RevokeMyConsentUnauthorized Problem
func (*RevokeMyConsentUnauthorized) revokeMyConsentRes() {}
type RevokeMyOrganizationContactConsentForbidden Problem
func (*RevokeMyOrganizationContactConsentForbidden) revokeMyOrganizationContactConsentRes() {}
// RevokeMyOrganizationContactConsentNoContent is response for RevokeMyOrganizationContactConsent operation.
type RevokeMyOrganizationContactConsentNoContent struct{}
func (*RevokeMyOrganizationContactConsentNoContent) revokeMyOrganizationContactConsentRes() {}
type RevokeMyOrganizationContactConsentUnauthorized Problem
func (*RevokeMyOrganizationContactConsentUnauthorized) revokeMyOrganizationContactConsentRes() {}
type RubAmount int64
// Pay period of a salary amount. The MVP uses only `month`; adding a value is a contract change.
@@ -56,55 +56,60 @@ func findAuthorization(h http.Header, prefix string) (string, bool) {
// operationRolesSessionCookie is a private map storing roles per operation.
var operationRolesSessionCookie = map[string][]string{
AcceptMyInvitationOperation: []string{},
CancelMyInvitationOperation: []string{},
CreateMyAssessmentAttemptOperation: []string{},
CreateMySupportCaseOperation: []string{},
CreateOrganizationOperation: []string{},
CreateOrganizationInvitationOperation: []string{},
CreateOrganizationNeedOperation: []string{},
DeclineMyInvitationOperation: []string{},
FinalizeMyAssessmentAttemptOperation: []string{},
GetCurrentAccountOperation: []string{},
GetCurrentSessionOperation: []string{},
GetMyAssessmentAttemptOperation: []string{},
GetMyAssessmentAvailabilityOperation: []string{},
GetMyAssessmentResultOperation: []string{},
GetMyCardPreviewOperation: []string{},
GetMyInvitationOperation: []string{},
GetMyPrivacySettingsOperation: []string{},
GetMyProfileOperation: []string{},
GetMyQuestionnaireOperation: []string{},
GetMySupportCaseOperation: []string{},
GetOrganizationOperation: []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{},
LogoutOperation: []string{},
RaiseOrganizationInvitationSalaryOperation: []string{},
SaveMyProfileOperation: []string{},
SaveMyQuestionnaireOperation: []string{},
SendOrganizationInvitationOperation: []string{},
SetMyPublicationOperation: []string{},
SetMySearchStatusOperation: []string{},
StartMyAssessmentAttemptSessionOperation: []string{},
SubmitMyAssessmentAnswerOperation: []string{},
UnhideOrganizationOperation: []string{},
UpdateOrganizationOperation: []string{},
UpdateOrganizationInvitationOperation: []string{},
UpdateOrganizationNeedOperation: []string{},
ViewMyInvitationOperation: []string{},
WithdrawOrganizationInvitationOperation: []string{},
AcceptMyInvitationOperation: []string{},
CancelMyInvitationOperation: []string{},
CreateMyAssessmentAttemptOperation: []string{},
CreateMySupportCaseOperation: []string{},
CreateOrganizationOperation: []string{},
CreateOrganizationInvitationOperation: []string{},
CreateOrganizationNeedOperation: []string{},
DeclineMyInvitationOperation: []string{},
FinalizeMyAssessmentAttemptOperation: []string{},
GetCurrentAccountOperation: []string{},
GetCurrentSessionOperation: []string{},
GetMyAssessmentAttemptOperation: []string{},
GetMyAssessmentAvailabilityOperation: []string{},
GetMyAssessmentResultOperation: []string{},
GetMyCardPreviewOperation: []string{},
GetMyConsentTextOperation: []string{},
GetMyInvitationOperation: []string{},
GetMyPrivacySettingsOperation: []string{},
GetMyProfileOperation: []string{},
GetMyQuestionnaireOperation: []string{},
GetMySupportCaseOperation: []string{},
GetOrganizationOperation: []string{},
GetOrganizationInvitationOperation: []string{},
GetOrganizationInvitationContactsOperation: []string{},
GetOrganizationNeedOperation: []string{},
GrantMyConsentOperation: []string{},
HideOrganizationOperation: []string{},
ListMyCardAccessHistoryOperation: []string{},
ListMyConsentsOperation: []string{},
ListMyHiddenOrganizationsOperation: []string{},
ListMyInvitationsOperation: []string{},
ListMyOrganizationsOperation: []string{},
ListMyPrivacyHistoryOperation: []string{},
ListMySupportCasesOperation: []string{},
ListOrganizationInvitationsOperation: []string{},
ListOrganizationNeedsOperation: []string{},
LogoutOperation: []string{},
RaiseOrganizationInvitationSalaryOperation: []string{},
RequestMyAccountDeletionOperation: []string{},
RevokeMyConsentOperation: []string{},
RevokeMyOrganizationContactConsentOperation: []string{},
SaveMyProfileOperation: []string{},
SaveMyQuestionnaireOperation: []string{},
SendOrganizationInvitationOperation: []string{},
SetMyPublicationOperation: []string{},
SetMySearchStatusOperation: []string{},
StartMyAssessmentAttemptSessionOperation: []string{},
SubmitMyAssessmentAnswerOperation: []string{},
UnhideOrganizationOperation: []string{},
UpdateOrganizationOperation: []string{},
UpdateOrganizationInvitationOperation: []string{},
UpdateOrganizationNeedOperation: []string{},
ViewMyInvitationOperation: []string{},
WithdrawOrganizationInvitationOperation: []string{},
}
// GetRolesForSessionCookie returns the required roles for the given operation.
@@ -130,31 +135,35 @@ func GetRolesForSessionCookie(operation string) []string {
// operationRolesSessionCsrf is a private map storing roles per operation.
var operationRolesSessionCsrf = map[string][]string{
AcceptMyInvitationOperation: []string{},
CancelMyInvitationOperation: []string{},
CreateMyAssessmentAttemptOperation: []string{},
CreateMySupportCaseOperation: []string{},
CreateOrganizationOperation: []string{},
CreateOrganizationInvitationOperation: []string{},
CreateOrganizationNeedOperation: []string{},
DeclineMyInvitationOperation: []string{},
FinalizeMyAssessmentAttemptOperation: []string{},
HideOrganizationOperation: []string{},
LogoutOperation: []string{},
RaiseOrganizationInvitationSalaryOperation: []string{},
SaveMyProfileOperation: []string{},
SaveMyQuestionnaireOperation: []string{},
SendOrganizationInvitationOperation: []string{},
SetMyPublicationOperation: []string{},
SetMySearchStatusOperation: []string{},
StartMyAssessmentAttemptSessionOperation: []string{},
SubmitMyAssessmentAnswerOperation: []string{},
UnhideOrganizationOperation: []string{},
UpdateOrganizationOperation: []string{},
UpdateOrganizationInvitationOperation: []string{},
UpdateOrganizationNeedOperation: []string{},
ViewMyInvitationOperation: []string{},
WithdrawOrganizationInvitationOperation: []string{},
AcceptMyInvitationOperation: []string{},
CancelMyInvitationOperation: []string{},
CreateMyAssessmentAttemptOperation: []string{},
CreateMySupportCaseOperation: []string{},
CreateOrganizationOperation: []string{},
CreateOrganizationInvitationOperation: []string{},
CreateOrganizationNeedOperation: []string{},
DeclineMyInvitationOperation: []string{},
FinalizeMyAssessmentAttemptOperation: []string{},
GrantMyConsentOperation: []string{},
HideOrganizationOperation: []string{},
LogoutOperation: []string{},
RaiseOrganizationInvitationSalaryOperation: []string{},
RequestMyAccountDeletionOperation: []string{},
RevokeMyConsentOperation: []string{},
RevokeMyOrganizationContactConsentOperation: []string{},
SaveMyProfileOperation: []string{},
SaveMyQuestionnaireOperation: []string{},
SendOrganizationInvitationOperation: []string{},
SetMyPublicationOperation: []string{},
SetMySearchStatusOperation: []string{},
StartMyAssessmentAttemptSessionOperation: []string{},
SubmitMyAssessmentAnswerOperation: []string{},
UnhideOrganizationOperation: []string{},
UpdateOrganizationOperation: []string{},
UpdateOrganizationInvitationOperation: []string{},
UpdateOrganizationNeedOperation: []string{},
ViewMyInvitationOperation: []string{},
WithdrawOrganizationInvitationOperation: []string{},
}
// GetRolesForSessionCsrf returns the required roles for the given operation.
@@ -621,6 +621,15 @@ type Handler interface {
//
// GET /api/v1/me/privacy/preview
GetMyCardPreview(ctx context.Context) (GetMyCardPreviewRes, error)
// GetMyConsentText implements GetMyConsentText operation.
//
// Requires a verified session. Returns the current published text and version of c1, c2, c3, or c5 so
// the user can read the exact text before an explicit settings grant. C4 is excluded: its text
// includes an organization snapshot and it is granted only during invitation acceptance. The response
// is private and is not cached.
//
// GET /api/v1/me/consent-texts/{purpose}
GetMyConsentText(ctx context.Context, params GetMyConsentTextParams) (GetMyConsentTextRes, error)
// GetMyInvitation implements GetMyInvitation operation.
//
// Requires the session cookie of a candidate account. The candidate comes from the session; the
@@ -864,6 +873,20 @@ type Handler interface {
//
// GET /api/v1/specializations
GetSpecializationCatalog(ctx context.Context) (*SpecializationCatalog, error)
// GrantMyConsent implements GrantMyConsent operation.
//
// Requires a verified session, its CSRF token in X-CSRF-Token, and the exact configured Origin. The
// subject comes from the session. The body names the current text version the user read and requires
// `accepted: true`; the server verifies that version is still current and stores the hash of the exact
// text. A stale version answers 400 validation_failed at `/text_version`, without writing a grant.
//
// C1 is available to candidate and employer accounts. C2, C3, and C5 are available only to candidate
// accounts. C4 is excluded and can be granted only by accepting an invitation. A repeated grant of the
// same current version returns the existing record; after revocation a grant creates a new record and
// never reopens a publication or restores an older grant.
//
// PUT /api/v1/me/consents/{purpose}
GrantMyConsent(ctx context.Context, req *ConsentSettingsGrantRequest, params GrantMyConsentParams) (GrantMyConsentRes, error)
// HideOrganization implements HideOrganization operation.
//
// Requires the session cookie of a candidate account, the CSRF token of that session in X-CSRF-Token,
@@ -945,8 +968,9 @@ type Handler interface {
// value. A c2 record proves the consent to the publication text; the published field set and its
// changes are evidence of the publication history.
//
// Granting c1, c2, c3, and c5 in the consent settings and revoking any purpose are planned operations
// of this tag; c1 is given at registration and c4 only in AcceptMyInvitation.
// Settings grants of c1, c2, c3, and c5 require the currently published text and an explicit
// acceptance. Revoking c2, c3, or c5 is available in settings; c1 creates a durable account-deletion
// request, and c4 is revoked only for one organization. C4 is granted only in AcceptMyInvitation.
//
// Access: a missing, unknown, expired, or revoked session answers 401 unauthenticated. A malformed
// `limit`, `cursor`, or `state` answers 400 validation_failed.
@@ -1210,6 +1234,16 @@ type Handler interface {
//
// POST /api/v1/identity/registrations
RegisterAccount(ctx context.Context, req *RegistrationRequest, params RegisterAccountParams) (RegisterAccountRes, error)
// RequestMyAccountDeletion implements RequestMyAccountDeletion operation.
//
// Requires a verified session, its CSRF token in X-CSRF-Token, and the exact configured Origin. The
// subject comes from the session. In one transaction, revokes any active C1 record, creates or returns
// the subject's active durable deletion request, and writes the outbox intent. The API does not delete
// the account synchronously. Repeating the request returns the same active request; a later C1 grant
// never cancels it.
//
// POST /api/v1/me/account-deletion-requests
RequestMyAccountDeletion(ctx context.Context) (RequestMyAccountDeletionRes, error)
// ResendEmailVerification implements ResendEmailVerification operation.
//
// Public operation without a session. The answer is the same 202 for an unknown email, a verified
@@ -1226,6 +1260,31 @@ type Handler interface {
//
// POST /api/v1/identity/email-verification-requests
ResendEmailVerification(ctx context.Context, req *EmailVerificationResendRequest) (ResendEmailVerificationRes, error)
// RevokeMyConsent implements RevokeMyConsent operation.
//
// Requires a verified candidate session, its CSRF token in X-CSRF-Token, and the exact configured
// Origin. The subject comes from the session. Revokes every unrevoked record of c2, c3, or c5,
// including superseded records, and never changes another purpose. Repeating a revocation is harmless
// and creates no duplicate event.
//
// Revoking c2 immediately closes the stored publication and records privacy history in the same
// transaction; a downstream revocation intent is written to the outbox. A later c2 grant does not
// reopen publication or restore old grants. Revoking c3 does not block the manual assessment path.
// Revoking c5 makes the consent gate deny further FSP import and writes a durable stop/delete intent;
// an external FSP deletion adapter is not available yet.
//
// DELETE /api/v1/me/consents/{purpose}
RevokeMyConsent(ctx context.Context, params RevokeMyConsentParams) (RevokeMyConsentRes, error)
// RevokeMyOrganizationContactConsent implements RevokeMyOrganizationContactConsent operation.
//
// Requires a verified candidate session, its CSRF token in X-CSRF-Token, and the exact configured
// Origin. The subject comes from the session; `org_id` is the only scope the caller may choose. The
// server revokes every unrevoked C4 record for this subject and organization, using the fields stored
// on those records to request downstream grant revocation. It does not affect another organization.
// Repeating the request is harmless and creates no duplicate event.
//
// DELETE /api/v1/me/consents/c4/organizations/{org_id}
RevokeMyOrganizationContactConsent(ctx context.Context, params RevokeMyOrganizationContactConsentParams) (RevokeMyOrganizationContactConsentRes, error)
// SaveMyProfile implements SaveMyProfile operation.
//
// Requires the session cookie of a candidate account, the CSRF token of that session in X-CSRF-Token,
@@ -680,6 +680,18 @@ func (UnimplementedHandler) GetMyCardPreview(ctx context.Context) (r GetMyCardPr
return r, ht.ErrNotImplemented
}
// GetMyConsentText implements GetMyConsentText operation.
//
// Requires a verified session. Returns the current published text and version of c1, c2, c3, or c5 so
// the user can read the exact text before an explicit settings grant. C4 is excluded: its text
// includes an organization snapshot and it is granted only during invitation acceptance. The response
// is private and is not cached.
//
// GET /api/v1/me/consent-texts/{purpose}
func (UnimplementedHandler) GetMyConsentText(ctx context.Context, params GetMyConsentTextParams) (r GetMyConsentTextRes, _ error) {
return r, ht.ErrNotImplemented
}
// GetMyInvitation implements GetMyInvitation operation.
//
// Requires the session cookie of a candidate account. The candidate comes from the session; the
@@ -953,6 +965,23 @@ func (UnimplementedHandler) GetSpecializationCatalog(ctx context.Context) (r *Sp
return r, ht.ErrNotImplemented
}
// GrantMyConsent implements GrantMyConsent operation.
//
// Requires a verified session, its CSRF token in X-CSRF-Token, and the exact configured Origin. The
// subject comes from the session. The body names the current text version the user read and requires
// `accepted: true`; the server verifies that version is still current and stores the hash of the exact
// text. A stale version answers 400 validation_failed at `/text_version`, without writing a grant.
//
// C1 is available to candidate and employer accounts. C2, C3, and C5 are available only to candidate
// accounts. C4 is excluded and can be granted only by accepting an invitation. A repeated grant of the
// same current version returns the existing record; after revocation a grant creates a new record and
// never reopens a publication or restores an older grant.
//
// PUT /api/v1/me/consents/{purpose}
func (UnimplementedHandler) GrantMyConsent(ctx context.Context, req *ConsentSettingsGrantRequest, params GrantMyConsentParams) (r GrantMyConsentRes, _ error) {
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,
@@ -1040,8 +1069,9 @@ func (UnimplementedHandler) ListMyCardAccessHistory(ctx context.Context, params
// value. A c2 record proves the consent to the publication text; the published field set and its
// changes are evidence of the publication history.
//
// Granting c1, c2, c3, and c5 in the consent settings and revoking any purpose are planned operations
// of this tag; c1 is given at registration and c4 only in AcceptMyInvitation.
// Settings grants of c1, c2, c3, and c5 require the currently published text and an explicit
// acceptance. Revoking c2, c3, or c5 is available in settings; c1 creates a durable account-deletion
// request, and c4 is revoked only for one organization. C4 is granted only in AcceptMyInvitation.
//
// Access: a missing, unknown, expired, or revoked session answers 401 unauthenticated. A malformed
// `limit`, `cursor`, or `state` answers 400 validation_failed.
@@ -1341,6 +1371,19 @@ func (UnimplementedHandler) RegisterAccount(ctx context.Context, req *Registrati
return r, ht.ErrNotImplemented
}
// RequestMyAccountDeletion implements RequestMyAccountDeletion operation.
//
// Requires a verified session, its CSRF token in X-CSRF-Token, and the exact configured Origin. The
// subject comes from the session. In one transaction, revokes any active C1 record, creates or returns
// the subject's active durable deletion request, and writes the outbox intent. The API does not delete
// the account synchronously. Repeating the request returns the same active request; a later C1 grant
// never cancels it.
//
// POST /api/v1/me/account-deletion-requests
func (UnimplementedHandler) RequestMyAccountDeletion(ctx context.Context) (r RequestMyAccountDeletionRes, _ error) {
return r, ht.ErrNotImplemented
}
// ResendEmailVerification implements ResendEmailVerification operation.
//
// Public operation without a session. The answer is the same 202 for an unknown email, a verified
@@ -1360,6 +1403,37 @@ func (UnimplementedHandler) ResendEmailVerification(ctx context.Context, req *Em
return r, ht.ErrNotImplemented
}
// RevokeMyConsent implements RevokeMyConsent operation.
//
// Requires a verified candidate session, its CSRF token in X-CSRF-Token, and the exact configured
// Origin. The subject comes from the session. Revokes every unrevoked record of c2, c3, or c5,
// including superseded records, and never changes another purpose. Repeating a revocation is harmless
// and creates no duplicate event.
//
// Revoking c2 immediately closes the stored publication and records privacy history in the same
// transaction; a downstream revocation intent is written to the outbox. A later c2 grant does not
// reopen publication or restore old grants. Revoking c3 does not block the manual assessment path.
// Revoking c5 makes the consent gate deny further FSP import and writes a durable stop/delete intent;
// an external FSP deletion adapter is not available yet.
//
// DELETE /api/v1/me/consents/{purpose}
func (UnimplementedHandler) RevokeMyConsent(ctx context.Context, params RevokeMyConsentParams) (r RevokeMyConsentRes, _ error) {
return r, ht.ErrNotImplemented
}
// RevokeMyOrganizationContactConsent implements RevokeMyOrganizationContactConsent operation.
//
// Requires a verified candidate session, its CSRF token in X-CSRF-Token, and the exact configured
// Origin. The subject comes from the session; `org_id` is the only scope the caller may choose. The
// server revokes every unrevoked C4 record for this subject and organization, using the fields stored
// on those records to request downstream grant revocation. It does not affect another organization.
// Repeating the request is harmless and creates no duplicate event.
//
// DELETE /api/v1/me/consents/c4/organizations/{org_id}
func (UnimplementedHandler) RevokeMyOrganizationContactConsent(ctx context.Context, params RevokeMyOrganizationContactConsentParams) (r RevokeMyOrganizationContactConsentRes, _ error) {
return r, ht.ErrNotImplemented
}
// SaveMyProfile implements SaveMyProfile operation.
//
// Requires the session cookie of a candidate account, the CSRF token of that session in X-CSRF-Token,
@@ -5934,6 +5934,74 @@ func (s *ConfirmEmailForbidden) Validate() error {
return nil
}
func (s *ConsentDeletionRequest) Validate() error {
if s == nil {
return validate.ErrNilPointer
}
var failures []validate.FieldError
if err := func() error {
if err := s.Status.Validate(); err != nil {
return err
}
return nil
}(); err != nil {
failures = append(failures, validate.FieldError{
Name: "status",
Error: err,
})
}
if len(failures) > 0 {
return &validate.Error{Fields: failures}
}
return nil
}
func (s *ConsentDeletionRequestHeaders) Validate() error {
if s == nil {
return validate.ErrNilPointer
}
var failures []validate.FieldError
if err := func() error {
if err := s.CacheControl.Validate(); err != nil {
return err
}
return nil
}(); err != nil {
failures = append(failures, validate.FieldError{
Name: "CacheControl",
Error: err,
})
}
if err := func() error {
if err := s.Response.Validate(); err != nil {
return err
}
return nil
}(); err != nil {
failures = append(failures, validate.FieldError{
Name: "Response",
Error: err,
})
}
if len(failures) > 0 {
return &validate.Error{Fields: failures}
}
return nil
}
func (s ConsentDeletionRequestStatus) Validate() error {
switch s {
case "requested":
return nil
case "processing":
return nil
default:
return errors.Errorf("invalid value: %v", s)
}
}
func (s *ConsentOrganization) Validate() error {
if s == nil {
return validate.ErrNilPointer
@@ -6144,6 +6212,40 @@ func (s *ConsentRecord) Validate() error {
return nil
}
func (s *ConsentRecordHeaders) Validate() error {
if s == nil {
return validate.ErrNilPointer
}
var failures []validate.FieldError
if err := func() error {
if err := s.CacheControl.Validate(); err != nil {
return err
}
return nil
}(); err != nil {
failures = append(failures, validate.FieldError{
Name: "CacheControl",
Error: err,
})
}
if err := func() error {
if err := s.Response.Validate(); err != nil {
return err
}
return nil
}(); err != nil {
failures = append(failures, validate.FieldError{
Name: "Response",
Error: err,
})
}
if len(failures) > 0 {
return &validate.Error{Fields: failures}
}
return nil
}
func (s *ConsentRecordList) Validate() error {
if s == nil {
return validate.ErrNilPointer
@@ -6248,6 +6350,77 @@ func (s ConsentRevocationSource) Validate() error {
}
}
func (s *ConsentSettingsGrantRequest) Validate() error {
if s == nil {
return validate.ErrNilPointer
}
var failures []validate.FieldError
if err := func() error {
if err := s.TextVersion.Validate(); err != nil {
return err
}
return nil
}(); err != nil {
failures = append(failures, validate.FieldError{
Name: "text_version",
Error: err,
})
}
if err := func() error {
if err := s.Accepted.Validate(); err != nil {
return err
}
return nil
}(); err != nil {
failures = append(failures, validate.FieldError{
Name: "accepted",
Error: err,
})
}
if len(failures) > 0 {
return &validate.Error{Fields: failures}
}
return nil
}
func (s ConsentSettingsGrantRequestAccepted) Validate() error {
switch s {
case true:
return nil
default:
return errors.Errorf("invalid value: %v", s)
}
}
func (s ConsentSettingsPurpose) Validate() error {
switch s {
case "c1":
return nil
case "c2":
return nil
case "c3":
return nil
case "c5":
return nil
default:
return errors.Errorf("invalid value: %v", s)
}
}
func (s ConsentSettingsRevokePurpose) Validate() error {
switch s {
case "c2":
return nil
case "c3":
return nil
case "c5":
return nil
default:
return errors.Errorf("invalid value: %v", s)
}
}
func (s ConsentSource) Validate() error {
switch s {
case "registration":
@@ -6331,6 +6504,40 @@ func (s *ConsentText) Validate() error {
return nil
}
func (s *ConsentTextHeaders) Validate() error {
if s == nil {
return validate.ErrNilPointer
}
var failures []validate.FieldError
if err := func() error {
if err := s.CacheControl.Validate(); err != nil {
return err
}
return nil
}(); err != nil {
failures = append(failures, validate.FieldError{
Name: "CacheControl",
Error: err,
})
}
if err := func() error {
if err := s.Response.Validate(); err != nil {
return err
}
return nil
}(); err != nil {
failures = append(failures, validate.FieldError{
Name: "Response",
Error: err,
})
}
if len(failures) > 0 {
return &validate.Error{Fields: failures}
}
return nil
}
func (s ConsentTextVersion) Validate() error {
alias := (string)(s)
if err := (validate.String{
@@ -7773,6 +7980,22 @@ func (s *GetMyCardPreviewUnauthorized) Validate() error {
return nil
}
func (s *GetMyConsentTextBadRequest) Validate() error {
alias := (*Problem)(s)
if err := alias.Validate(); err != nil {
return err
}
return nil
}
func (s *GetMyConsentTextUnauthorized) Validate() error {
alias := (*Problem)(s)
if err := alias.Validate(); err != nil {
return err
}
return nil
}
func (s *GetMyInvitationBadRequest) Validate() error {
alias := (*Problem)(s)
if err := alias.Validate(); err != nil {
@@ -8020,6 +8243,30 @@ func (s GradeCode) Validate() error {
}
}
func (s *GrantMyConsentBadRequest) Validate() error {
alias := (*Problem)(s)
if err := alias.Validate(); err != nil {
return err
}
return nil
}
func (s *GrantMyConsentForbidden) Validate() error {
alias := (*Problem)(s)
if err := alias.Validate(); err != nil {
return err
}
return nil
}
func (s *GrantMyConsentUnauthorized) Validate() error {
alias := (*Problem)(s)
if err := alias.Validate(); err != nil {
return err
}
return nil
}
func (s *HealthResponse) Validate() error {
if s == nil {
return validate.ErrNilPointer
@@ -17451,6 +17698,22 @@ func (s *RegistrationRequest) Validate() error {
return nil
}
func (s *RequestMyAccountDeletionForbidden) Validate() error {
alias := (*Problem)(s)
if err := alias.Validate(); err != nil {
return err
}
return nil
}
func (s *RequestMyAccountDeletionUnauthorized) Validate() error {
alias := (*Problem)(s)
if err := alias.Validate(); err != nil {
return err
}
return nil
}
func (s *ResendEmailVerificationBadRequest) Validate() error {
alias := (*Problem)(s)
if err := alias.Validate(); err != nil {
@@ -17467,6 +17730,38 @@ func (s *ResendEmailVerificationForbidden) Validate() error {
return nil
}
func (s *RevokeMyConsentForbidden) Validate() error {
alias := (*Problem)(s)
if err := alias.Validate(); err != nil {
return err
}
return nil
}
func (s *RevokeMyConsentUnauthorized) Validate() error {
alias := (*Problem)(s)
if err := alias.Validate(); err != nil {
return err
}
return nil
}
func (s *RevokeMyOrganizationContactConsentForbidden) Validate() error {
alias := (*Problem)(s)
if err := alias.Validate(); err != nil {
return err
}
return nil
}
func (s *RevokeMyOrganizationContactConsentUnauthorized) Validate() error {
alias := (*Problem)(s)
if err := alias.Validate(); err != nil {
return err
}
return nil
}
func (s RubAmount) Validate() error {
alias := (int64)(s)
if err := (validate.Int{