feat: it works

This commit is contained in:
Anatoly Antonov 2025-03-26 17:14:00 +03:00
parent 6302dd62d6
commit 778d5ef146
25 changed files with 638 additions and 106 deletions

View file

@ -16,13 +16,8 @@ func (s *ErrorStatusCode) Error() string {
// Ref: #/components/schemas/Error
type Error struct {
Code int `json:"code"`
Message string `json:"message"`
}
// GetCode returns the value of Code.
func (s *Error) GetCode() int {
return s.Code
Message string `json:"message"`
Details OptString `json:"details"`
}
// GetMessage returns the value of Message.
@ -30,9 +25,9 @@ func (s *Error) GetMessage() string {
return s.Message
}
// SetCode sets the value of Code.
func (s *Error) SetCode(val int) {
s.Code = val
// GetDetails returns the value of Details.
func (s *Error) GetDetails() OptString {
return s.Details
}
// SetMessage sets the value of Message.
@ -40,6 +35,11 @@ func (s *Error) SetMessage(val string) {
s.Message = val
}
// SetDetails sets the value of Details.
func (s *Error) SetDetails(val OptString) {
s.Details = val
}
// ErrorStatusCode wraps Error with StatusCode.
type ErrorStatusCode struct {
StatusCode int
@ -412,6 +412,52 @@ func (s *GetSubscriptionsOKSubscriptionsItemType) UnmarshalText(data []byte) err
}
}
// NewOptString returns new OptString with value set to v.
func NewOptString(v string) OptString {
return OptString{
Value: v,
Set: true,
}
}
// OptString is optional string.
type OptString struct {
Value string
Set bool
}
// IsSet returns true if OptString was set.
func (o OptString) IsSet() bool { return o.Set }
// Reset unsets value.
func (o *OptString) Reset() {
var v string
o.Value = v
o.Set = false
}
// SetTo sets value to v.
func (o *OptString) SetTo(v string) {
o.Set = true
o.Value = v
}
// Get returns value and boolean that denotes whether value was set.
func (o OptString) Get() (v string, ok bool) {
if !o.Set {
return v, false
}
return o.Value, true
}
// Or returns value if set, or given parameter if does not.
func (o OptString) Or(d string) string {
if v, ok := o.Get(); ok {
return v
}
return d
}
// NewOptUUID returns new OptUUID with value set to v.
func NewOptUUID(v uuid.UUID) OptUUID {
return OptUUID{