mirror of
https://github.com/derfenix/webarchive.git
synced 2026-03-11 22:40:58 +03:00
Initial commit
This commit is contained in:
516
api/openapi/oas_schemas_gen.go
Normal file
516
api/openapi/oas_schemas_gen.go
Normal file
@@ -0,0 +1,516 @@
|
||||
// Code generated by ogen, DO NOT EDIT.
|
||||
|
||||
package openapi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/go-faster/errors"
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
func (s *ErrorStatusCode) Error() string {
|
||||
return fmt.Sprintf("code %d: %+v", s.StatusCode, s.Response)
|
||||
}
|
||||
|
||||
type AddPageReq struct {
|
||||
URL string `json:"url"`
|
||||
Description OptString `json:"description"`
|
||||
Formats []Format `json:"formats"`
|
||||
}
|
||||
|
||||
// GetURL returns the value of URL.
|
||||
func (s *AddPageReq) GetURL() string {
|
||||
return s.URL
|
||||
}
|
||||
|
||||
// GetDescription returns the value of Description.
|
||||
func (s *AddPageReq) GetDescription() OptString {
|
||||
return s.Description
|
||||
}
|
||||
|
||||
// GetFormats returns the value of Formats.
|
||||
func (s *AddPageReq) GetFormats() []Format {
|
||||
return s.Formats
|
||||
}
|
||||
|
||||
// SetURL sets the value of URL.
|
||||
func (s *AddPageReq) SetURL(val string) {
|
||||
s.URL = val
|
||||
}
|
||||
|
||||
// SetDescription sets the value of Description.
|
||||
func (s *AddPageReq) SetDescription(val OptString) {
|
||||
s.Description = val
|
||||
}
|
||||
|
||||
// SetFormats sets the value of Formats.
|
||||
func (s *AddPageReq) SetFormats(val []Format) {
|
||||
s.Formats = val
|
||||
}
|
||||
|
||||
// Ref: #/components/schemas/error
|
||||
type Error struct {
|
||||
Message string `json:"message"`
|
||||
Localized OptString `json:"localized"`
|
||||
}
|
||||
|
||||
// GetMessage returns the value of Message.
|
||||
func (s *Error) GetMessage() string {
|
||||
return s.Message
|
||||
}
|
||||
|
||||
// GetLocalized returns the value of Localized.
|
||||
func (s *Error) GetLocalized() OptString {
|
||||
return s.Localized
|
||||
}
|
||||
|
||||
// SetMessage sets the value of Message.
|
||||
func (s *Error) SetMessage(val string) {
|
||||
s.Message = val
|
||||
}
|
||||
|
||||
// SetLocalized sets the value of Localized.
|
||||
func (s *Error) SetLocalized(val OptString) {
|
||||
s.Localized = val
|
||||
}
|
||||
|
||||
// ErrorStatusCode wraps Error with StatusCode.
|
||||
type ErrorStatusCode struct {
|
||||
StatusCode int
|
||||
Response Error
|
||||
}
|
||||
|
||||
// GetStatusCode returns the value of StatusCode.
|
||||
func (s *ErrorStatusCode) GetStatusCode() int {
|
||||
return s.StatusCode
|
||||
}
|
||||
|
||||
// GetResponse returns the value of Response.
|
||||
func (s *ErrorStatusCode) GetResponse() Error {
|
||||
return s.Response
|
||||
}
|
||||
|
||||
// SetStatusCode sets the value of StatusCode.
|
||||
func (s *ErrorStatusCode) SetStatusCode(val int) {
|
||||
s.StatusCode = val
|
||||
}
|
||||
|
||||
// SetResponse sets the value of Response.
|
||||
func (s *ErrorStatusCode) SetResponse(val Error) {
|
||||
s.Response = val
|
||||
}
|
||||
|
||||
// Ref: #/components/schemas/format
|
||||
type Format string
|
||||
|
||||
const (
|
||||
FormatAll Format = "all"
|
||||
FormatPdf Format = "pdf"
|
||||
FormatSinglePage Format = "single_page"
|
||||
FormatHeaders Format = "headers"
|
||||
)
|
||||
|
||||
// MarshalText implements encoding.TextMarshaler.
|
||||
func (s Format) MarshalText() ([]byte, error) {
|
||||
switch s {
|
||||
case FormatAll:
|
||||
return []byte(s), nil
|
||||
case FormatPdf:
|
||||
return []byte(s), nil
|
||||
case FormatSinglePage:
|
||||
return []byte(s), nil
|
||||
case FormatHeaders:
|
||||
return []byte(s), nil
|
||||
default:
|
||||
return nil, errors.Errorf("invalid value: %q", s)
|
||||
}
|
||||
}
|
||||
|
||||
// UnmarshalText implements encoding.TextUnmarshaler.
|
||||
func (s *Format) UnmarshalText(data []byte) error {
|
||||
switch Format(data) {
|
||||
case FormatAll:
|
||||
*s = FormatAll
|
||||
return nil
|
||||
case FormatPdf:
|
||||
*s = FormatPdf
|
||||
return nil
|
||||
case FormatSinglePage:
|
||||
*s = FormatSinglePage
|
||||
return nil
|
||||
case FormatHeaders:
|
||||
*s = FormatHeaders
|
||||
return nil
|
||||
default:
|
||||
return errors.Errorf("invalid value: %q", data)
|
||||
}
|
||||
}
|
||||
|
||||
// GetPageNotFound is response for GetPage operation.
|
||||
type GetPageNotFound struct{}
|
||||
|
||||
func (*GetPageNotFound) getPageRes() {}
|
||||
|
||||
// NewOptAddPageReq returns new OptAddPageReq with value set to v.
|
||||
func NewOptAddPageReq(v AddPageReq) OptAddPageReq {
|
||||
return OptAddPageReq{
|
||||
Value: v,
|
||||
Set: true,
|
||||
}
|
||||
}
|
||||
|
||||
// OptAddPageReq is optional AddPageReq.
|
||||
type OptAddPageReq struct {
|
||||
Value AddPageReq
|
||||
Set bool
|
||||
}
|
||||
|
||||
// IsSet returns true if OptAddPageReq was set.
|
||||
func (o OptAddPageReq) IsSet() bool { return o.Set }
|
||||
|
||||
// Reset unsets value.
|
||||
func (o *OptAddPageReq) Reset() {
|
||||
var v AddPageReq
|
||||
o.Value = v
|
||||
o.Set = false
|
||||
}
|
||||
|
||||
// SetTo sets value to v.
|
||||
func (o *OptAddPageReq) SetTo(v AddPageReq) {
|
||||
o.Set = true
|
||||
o.Value = v
|
||||
}
|
||||
|
||||
// Get returns value and boolean that denotes whether value was set.
|
||||
func (o OptAddPageReq) Get() (v AddPageReq, 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 OptAddPageReq) Or(d AddPageReq) AddPageReq {
|
||||
if v, ok := o.Get(); ok {
|
||||
return v
|
||||
}
|
||||
return d
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
// Ref: #/components/schemas/page
|
||||
type Page struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
URL string `json:"url"`
|
||||
Created time.Time `json:"created"`
|
||||
Formats []Format `json:"formats"`
|
||||
Status Status `json:"status"`
|
||||
}
|
||||
|
||||
// GetID returns the value of ID.
|
||||
func (s *Page) GetID() uuid.UUID {
|
||||
return s.ID
|
||||
}
|
||||
|
||||
// GetURL returns the value of URL.
|
||||
func (s *Page) GetURL() string {
|
||||
return s.URL
|
||||
}
|
||||
|
||||
// GetCreated returns the value of Created.
|
||||
func (s *Page) GetCreated() time.Time {
|
||||
return s.Created
|
||||
}
|
||||
|
||||
// GetFormats returns the value of Formats.
|
||||
func (s *Page) GetFormats() []Format {
|
||||
return s.Formats
|
||||
}
|
||||
|
||||
// GetStatus returns the value of Status.
|
||||
func (s *Page) GetStatus() Status {
|
||||
return s.Status
|
||||
}
|
||||
|
||||
// SetID sets the value of ID.
|
||||
func (s *Page) SetID(val uuid.UUID) {
|
||||
s.ID = val
|
||||
}
|
||||
|
||||
// SetURL sets the value of URL.
|
||||
func (s *Page) SetURL(val string) {
|
||||
s.URL = val
|
||||
}
|
||||
|
||||
// SetCreated sets the value of Created.
|
||||
func (s *Page) SetCreated(val time.Time) {
|
||||
s.Created = val
|
||||
}
|
||||
|
||||
// SetFormats sets the value of Formats.
|
||||
func (s *Page) SetFormats(val []Format) {
|
||||
s.Formats = val
|
||||
}
|
||||
|
||||
// SetStatus sets the value of Status.
|
||||
func (s *Page) SetStatus(val Status) {
|
||||
s.Status = val
|
||||
}
|
||||
|
||||
// Merged schema.
|
||||
// Ref: #/components/schemas/pageWithResults
|
||||
type PageWithResults struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
URL string `json:"url"`
|
||||
Created time.Time `json:"created"`
|
||||
Formats []Format `json:"formats"`
|
||||
Status Status `json:"status"`
|
||||
Results []Result `json:"results"`
|
||||
}
|
||||
|
||||
// GetID returns the value of ID.
|
||||
func (s *PageWithResults) GetID() uuid.UUID {
|
||||
return s.ID
|
||||
}
|
||||
|
||||
// GetURL returns the value of URL.
|
||||
func (s *PageWithResults) GetURL() string {
|
||||
return s.URL
|
||||
}
|
||||
|
||||
// GetCreated returns the value of Created.
|
||||
func (s *PageWithResults) GetCreated() time.Time {
|
||||
return s.Created
|
||||
}
|
||||
|
||||
// GetFormats returns the value of Formats.
|
||||
func (s *PageWithResults) GetFormats() []Format {
|
||||
return s.Formats
|
||||
}
|
||||
|
||||
// GetStatus returns the value of Status.
|
||||
func (s *PageWithResults) GetStatus() Status {
|
||||
return s.Status
|
||||
}
|
||||
|
||||
// GetResults returns the value of Results.
|
||||
func (s *PageWithResults) GetResults() []Result {
|
||||
return s.Results
|
||||
}
|
||||
|
||||
// SetID sets the value of ID.
|
||||
func (s *PageWithResults) SetID(val uuid.UUID) {
|
||||
s.ID = val
|
||||
}
|
||||
|
||||
// SetURL sets the value of URL.
|
||||
func (s *PageWithResults) SetURL(val string) {
|
||||
s.URL = val
|
||||
}
|
||||
|
||||
// SetCreated sets the value of Created.
|
||||
func (s *PageWithResults) SetCreated(val time.Time) {
|
||||
s.Created = val
|
||||
}
|
||||
|
||||
// SetFormats sets the value of Formats.
|
||||
func (s *PageWithResults) SetFormats(val []Format) {
|
||||
s.Formats = val
|
||||
}
|
||||
|
||||
// SetStatus sets the value of Status.
|
||||
func (s *PageWithResults) SetStatus(val Status) {
|
||||
s.Status = val
|
||||
}
|
||||
|
||||
// SetResults sets the value of Results.
|
||||
func (s *PageWithResults) SetResults(val []Result) {
|
||||
s.Results = val
|
||||
}
|
||||
|
||||
func (*PageWithResults) getPageRes() {}
|
||||
|
||||
type Pages []Page
|
||||
|
||||
// Ref: #/components/schemas/result
|
||||
type Result struct {
|
||||
Format Format `json:"format"`
|
||||
Error OptString `json:"error"`
|
||||
Files []ResultFilesItem `json:"files"`
|
||||
}
|
||||
|
||||
// GetFormat returns the value of Format.
|
||||
func (s *Result) GetFormat() Format {
|
||||
return s.Format
|
||||
}
|
||||
|
||||
// GetError returns the value of Error.
|
||||
func (s *Result) GetError() OptString {
|
||||
return s.Error
|
||||
}
|
||||
|
||||
// GetFiles returns the value of Files.
|
||||
func (s *Result) GetFiles() []ResultFilesItem {
|
||||
return s.Files
|
||||
}
|
||||
|
||||
// SetFormat sets the value of Format.
|
||||
func (s *Result) SetFormat(val Format) {
|
||||
s.Format = val
|
||||
}
|
||||
|
||||
// SetError sets the value of Error.
|
||||
func (s *Result) SetError(val OptString) {
|
||||
s.Error = val
|
||||
}
|
||||
|
||||
// SetFiles sets the value of Files.
|
||||
func (s *Result) SetFiles(val []ResultFilesItem) {
|
||||
s.Files = val
|
||||
}
|
||||
|
||||
type ResultFilesItem struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Mimetype string `json:"mimetype"`
|
||||
Size int64 `json:"size"`
|
||||
}
|
||||
|
||||
// GetID returns the value of ID.
|
||||
func (s *ResultFilesItem) GetID() uuid.UUID {
|
||||
return s.ID
|
||||
}
|
||||
|
||||
// GetName returns the value of Name.
|
||||
func (s *ResultFilesItem) GetName() string {
|
||||
return s.Name
|
||||
}
|
||||
|
||||
// GetMimetype returns the value of Mimetype.
|
||||
func (s *ResultFilesItem) GetMimetype() string {
|
||||
return s.Mimetype
|
||||
}
|
||||
|
||||
// GetSize returns the value of Size.
|
||||
func (s *ResultFilesItem) GetSize() int64 {
|
||||
return s.Size
|
||||
}
|
||||
|
||||
// SetID sets the value of ID.
|
||||
func (s *ResultFilesItem) SetID(val uuid.UUID) {
|
||||
s.ID = val
|
||||
}
|
||||
|
||||
// SetName sets the value of Name.
|
||||
func (s *ResultFilesItem) SetName(val string) {
|
||||
s.Name = val
|
||||
}
|
||||
|
||||
// SetMimetype sets the value of Mimetype.
|
||||
func (s *ResultFilesItem) SetMimetype(val string) {
|
||||
s.Mimetype = val
|
||||
}
|
||||
|
||||
// SetSize sets the value of Size.
|
||||
func (s *ResultFilesItem) SetSize(val int64) {
|
||||
s.Size = val
|
||||
}
|
||||
|
||||
// Ref: #/components/schemas/status
|
||||
type Status string
|
||||
|
||||
const (
|
||||
StatusNew Status = "new"
|
||||
StatusProcessing Status = "processing"
|
||||
StatusDone Status = "done"
|
||||
StatusFailed Status = "failed"
|
||||
StatusWithErrors Status = "with_errors"
|
||||
)
|
||||
|
||||
// MarshalText implements encoding.TextMarshaler.
|
||||
func (s Status) MarshalText() ([]byte, error) {
|
||||
switch s {
|
||||
case StatusNew:
|
||||
return []byte(s), nil
|
||||
case StatusProcessing:
|
||||
return []byte(s), nil
|
||||
case StatusDone:
|
||||
return []byte(s), nil
|
||||
case StatusFailed:
|
||||
return []byte(s), nil
|
||||
case StatusWithErrors:
|
||||
return []byte(s), nil
|
||||
default:
|
||||
return nil, errors.Errorf("invalid value: %q", s)
|
||||
}
|
||||
}
|
||||
|
||||
// UnmarshalText implements encoding.TextUnmarshaler.
|
||||
func (s *Status) UnmarshalText(data []byte) error {
|
||||
switch Status(data) {
|
||||
case StatusNew:
|
||||
*s = StatusNew
|
||||
return nil
|
||||
case StatusProcessing:
|
||||
*s = StatusProcessing
|
||||
return nil
|
||||
case StatusDone:
|
||||
*s = StatusDone
|
||||
return nil
|
||||
case StatusFailed:
|
||||
*s = StatusFailed
|
||||
return nil
|
||||
case StatusWithErrors:
|
||||
*s = StatusWithErrors
|
||||
return nil
|
||||
default:
|
||||
return errors.Errorf("invalid value: %q", data)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user