openapi

package
v0.1.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 24, 2023 License: BSD-3-Clause Imports: 29 Imported by: 0

Documentation

Overview

Code generated by ogen, DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithServerURL

func WithServerURL(ctx context.Context, u *url.URL) context.Context

WithServerURL sets context key to override server URL.

Types

type AddPageBadRequest

type AddPageBadRequest struct {
	Field string `json:"field"`
	Error string `json:"error"`
}

func (*AddPageBadRequest) Decode

func (s *AddPageBadRequest) Decode(d *jx.Decoder) error

Decode decodes AddPageBadRequest from json.

func (*AddPageBadRequest) Encode

func (s *AddPageBadRequest) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*AddPageBadRequest) GetError

func (s *AddPageBadRequest) GetError() string

GetError returns the value of Error.

func (*AddPageBadRequest) GetField

func (s *AddPageBadRequest) GetField() string

GetField returns the value of Field.

func (*AddPageBadRequest) MarshalJSON

func (s *AddPageBadRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*AddPageBadRequest) SetError

func (s *AddPageBadRequest) SetError(val string)

SetError sets the value of Error.

func (*AddPageBadRequest) SetField

func (s *AddPageBadRequest) SetField(val string)

SetField sets the value of Field.

func (*AddPageBadRequest) UnmarshalJSON

func (s *AddPageBadRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type AddPageParams

type AddPageParams struct {
	URL         OptString
	Description OptString
	Formats     []Format
}

AddPageParams is parameters of addPage operation.

type AddPageReq

type AddPageReq struct {
	URL         string    `json:"url"`
	Description OptString `json:"description"`
	Formats     []Format  `json:"formats"`
}

func (*AddPageReq) Decode

func (s *AddPageReq) Decode(d *jx.Decoder) error

Decode decodes AddPageReq from json.

func (*AddPageReq) Encode

func (s *AddPageReq) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*AddPageReq) GetDescription

func (s *AddPageReq) GetDescription() OptString

GetDescription returns the value of Description.

func (*AddPageReq) GetFormats

func (s *AddPageReq) GetFormats() []Format

GetFormats returns the value of Formats.

func (*AddPageReq) GetURL

func (s *AddPageReq) GetURL() string

GetURL returns the value of URL.

func (*AddPageReq) MarshalJSON

func (s *AddPageReq) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*AddPageReq) SetDescription

func (s *AddPageReq) SetDescription(val OptString)

SetDescription sets the value of Description.

func (*AddPageReq) SetFormats

func (s *AddPageReq) SetFormats(val []Format)

SetFormats sets the value of Formats.

func (*AddPageReq) SetURL

func (s *AddPageReq) SetURL(val string)

SetURL sets the value of URL.

func (*AddPageReq) UnmarshalJSON

func (s *AddPageReq) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*AddPageReq) Validate

func (s *AddPageReq) Validate() error

type AddPageRes

type AddPageRes interface {
	// contains filtered or unexported methods
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client implements OAS client.

func NewClient

func NewClient(serverURL string, opts ...ClientOption) (*Client, error)

NewClient initializes new Client defined by OAS.

func (*Client) AddPage

func (c *Client) AddPage(ctx context.Context, request OptAddPageReq, params AddPageParams) (AddPageRes, error)

AddPage invokes addPage operation.

Add new page.

POST /pages

func (*Client) GetFile

func (c *Client) GetFile(ctx context.Context, params GetFileParams) (GetFileRes, error)

GetFile invokes getFile operation.

Get file content.

GET /pages/{id}/file/{file_id}

func (*Client) GetPage

func (c *Client) GetPage(ctx context.Context, params GetPageParams) (GetPageRes, error)

GetPage invokes getPage operation.

Get page details.

GET /pages/{id}

func (*Client) GetPages

func (c *Client) GetPages(ctx context.Context) (Pages, error)

GetPages invokes getPages operation.

Get all pages.

GET /pages

type ClientOption

type ClientOption interface {
	// contains filtered or unexported methods
}

ClientOption is client config option.

func WithClient

func WithClient(client ht.Client) ClientOption

WithClient specifies http client to use.

type Error

type Error struct {
	Message   string    `json:"message"`
	Localized OptString `json:"localized"`
}

Ref: #/components/schemas/error

func (*Error) Decode

func (s *Error) Decode(d *jx.Decoder) error

Decode decodes Error from json.

func (*Error) Encode

func (s *Error) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*Error) GetLocalized

func (s *Error) GetLocalized() OptString

GetLocalized returns the value of Localized.

func (*Error) GetMessage

func (s *Error) GetMessage() string

GetMessage returns the value of Message.

func (*Error) MarshalJSON

func (s *Error) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*Error) SetLocalized

func (s *Error) SetLocalized(val OptString)

SetLocalized sets the value of Localized.

func (*Error) SetMessage

func (s *Error) SetMessage(val string)

SetMessage sets the value of Message.

func (*Error) UnmarshalJSON

func (s *Error) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type ErrorHandler

type ErrorHandler = ogenerrors.ErrorHandler

ErrorHandler is error handler.

type ErrorStatusCode

type ErrorStatusCode struct {
	StatusCode int
	Response   Error
}

ErrorStatusCode wraps Error with StatusCode.

func (*ErrorStatusCode) Error

func (s *ErrorStatusCode) Error() string

func (*ErrorStatusCode) GetResponse

func (s *ErrorStatusCode) GetResponse() Error

GetResponse returns the value of Response.

func (*ErrorStatusCode) GetStatusCode

func (s *ErrorStatusCode) GetStatusCode() int

GetStatusCode returns the value of StatusCode.

func (*ErrorStatusCode) SetResponse

func (s *ErrorStatusCode) SetResponse(val Error)

SetResponse sets the value of Response.

func (*ErrorStatusCode) SetStatusCode

func (s *ErrorStatusCode) SetStatusCode(val int)

SetStatusCode sets the value of StatusCode.

type Format

type Format string

Ref: #/components/schemas/format

const (
	FormatAll        Format = "all"
	FormatPdf        Format = "pdf"
	FormatSingleFile Format = "single_file"
	FormatHeaders    Format = "headers"
)

func (Format) AllValues added in v0.1.4

func (Format) AllValues() []Format

AllValues returns all Format values.

func (*Format) Decode

func (s *Format) Decode(d *jx.Decoder) error

Decode decodes Format from json.

func (Format) Encode

func (s Format) Encode(e *jx.Encoder)

Encode encodes Format as json.

func (Format) MarshalJSON

func (s Format) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (Format) MarshalText

func (s Format) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (*Format) UnmarshalJSON

func (s *Format) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*Format) UnmarshalText

func (s *Format) UnmarshalText(data []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

func (Format) Validate

func (s Format) Validate() error

type GetFileNotFound

type GetFileNotFound struct{}

GetFileNotFound is response for GetFile operation.

type GetFileOKApplicationPdf

type GetFileOKApplicationPdf struct {
	Data io.Reader
}

func (GetFileOKApplicationPdf) Read

func (s GetFileOKApplicationPdf) Read(p []byte) (n int, err error)

Read reads data from the Data reader.

Kept to satisfy the io.Reader interface.

type GetFileOKTextHTML

type GetFileOKTextHTML struct {
	Data io.Reader
}

func (GetFileOKTextHTML) Read

func (s GetFileOKTextHTML) Read(p []byte) (n int, err error)

Read reads data from the Data reader.

Kept to satisfy the io.Reader interface.

type GetFileOKTextPlain

type GetFileOKTextPlain struct {
	Data io.Reader
}

func (GetFileOKTextPlain) Read

func (s GetFileOKTextPlain) Read(p []byte) (n int, err error)

Read reads data from the Data reader.

Kept to satisfy the io.Reader interface.

type GetFileParams

type GetFileParams struct {
	ID     uuid.UUID
	FileID uuid.UUID
}

GetFileParams is parameters of getFile operation.

type GetFileRes

type GetFileRes interface {
	// contains filtered or unexported methods
}

type GetPageNotFound

type GetPageNotFound struct{}

GetPageNotFound is response for GetPage operation.

type GetPageParams

type GetPageParams struct {
	ID uuid.UUID
}

GetPageParams is parameters of getPage operation.

type GetPageRes

type GetPageRes interface {
	// contains filtered or unexported methods
}

type Handler

type Handler interface {
	// AddPage implements addPage operation.
	//
	// Add new page.
	//
	// POST /pages
	AddPage(ctx context.Context, req OptAddPageReq, params AddPageParams) (AddPageRes, error)
	// GetFile implements getFile operation.
	//
	// Get file content.
	//
	// GET /pages/{id}/file/{file_id}
	GetFile(ctx context.Context, params GetFileParams) (GetFileRes, error)
	// GetPage implements getPage operation.
	//
	// Get page details.
	//
	// GET /pages/{id}
	GetPage(ctx context.Context, params GetPageParams) (GetPageRes, error)
	// GetPages implements getPages operation.
	//
	// Get all pages.
	//
	// GET /pages
	GetPages(ctx context.Context) (Pages, error)
	// NewError creates *ErrorStatusCode from error returned by handler.
	//
	// Used for common default response.
	NewError(ctx context.Context, err error) *ErrorStatusCode
}

Handler handles operations described by OpenAPI v3 specification.

type Invoker added in v0.1.4

type Invoker interface {
	// AddPage invokes addPage operation.
	//
	// Add new page.
	//
	// POST /pages
	AddPage(ctx context.Context, request OptAddPageReq, params AddPageParams) (AddPageRes, error)
	// GetFile invokes getFile operation.
	//
	// Get file content.
	//
	// GET /pages/{id}/file/{file_id}
	GetFile(ctx context.Context, params GetFileParams) (GetFileRes, error)
	// GetPage invokes getPage operation.
	//
	// Get page details.
	//
	// GET /pages/{id}
	GetPage(ctx context.Context, params GetPageParams) (GetPageRes, error)
	// GetPages invokes getPages operation.
	//
	// Get all pages.
	//
	// GET /pages
	GetPages(ctx context.Context) (Pages, error)
}

Invoker invokes operations described by OpenAPI v3 specification.

type Middleware

type Middleware = middleware.Middleware

Middleware is middleware type.

type OptAddPageReq

type OptAddPageReq struct {
	Value AddPageReq
	Set   bool
}

OptAddPageReq is optional AddPageReq.

func NewOptAddPageReq

func NewOptAddPageReq(v AddPageReq) OptAddPageReq

NewOptAddPageReq returns new OptAddPageReq with value set to v.

func (*OptAddPageReq) Decode

func (o *OptAddPageReq) Decode(d *jx.Decoder) error

Decode decodes AddPageReq from json.

func (OptAddPageReq) Encode

func (o OptAddPageReq) Encode(e *jx.Encoder)

Encode encodes AddPageReq as json.

func (OptAddPageReq) Get

func (o OptAddPageReq) Get() (v AddPageReq, ok bool)

Get returns value and boolean that denotes whether value was set.

func (OptAddPageReq) IsSet

func (o OptAddPageReq) IsSet() bool

IsSet returns true if OptAddPageReq was set.

func (OptAddPageReq) MarshalJSON

func (s OptAddPageReq) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (OptAddPageReq) Or

Or returns value if set, or given parameter if does not.

func (*OptAddPageReq) Reset

func (o *OptAddPageReq) Reset()

Reset unsets value.

func (*OptAddPageReq) SetTo

func (o *OptAddPageReq) SetTo(v AddPageReq)

SetTo sets value to v.

func (*OptAddPageReq) UnmarshalJSON

func (s *OptAddPageReq) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type OptString

type OptString struct {
	Value string
	Set   bool
}

OptString is optional string.

func NewOptString

func NewOptString(v string) OptString

NewOptString returns new OptString with value set to v.

func (*OptString) Decode

func (o *OptString) Decode(d *jx.Decoder) error

Decode decodes string from json.

func (OptString) Encode

func (o OptString) Encode(e *jx.Encoder)

Encode encodes string as json.

func (OptString) Get

func (o OptString) Get() (v string, ok bool)

Get returns value and boolean that denotes whether value was set.

func (OptString) IsSet

func (o OptString) IsSet() bool

IsSet returns true if OptString was set.

func (OptString) MarshalJSON

func (s OptString) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (OptString) Or

func (o OptString) Or(d string) string

Or returns value if set, or given parameter if does not.

func (*OptString) Reset

func (o *OptString) Reset()

Reset unsets value.

func (*OptString) SetTo

func (o *OptString) SetTo(v string)

SetTo sets value to v.

func (*OptString) UnmarshalJSON

func (s *OptString) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type Option

type Option interface {
	ServerOption
	ClientOption
}

Option is config option.

func WithMeterProvider

func WithMeterProvider(provider metric.MeterProvider) Option

WithMeterProvider specifies a meter provider to use for creating a meter.

If none is specified, the otel.GetMeterProvider() is used.

func WithTracerProvider

func WithTracerProvider(provider trace.TracerProvider) Option

WithTracerProvider specifies a tracer provider to use for creating a tracer.

If none is specified, the global provider is used.

type 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"`
	Meta    PageMeta  `json:"meta"`
}

Ref: #/components/schemas/page

func (*Page) Decode

func (s *Page) Decode(d *jx.Decoder) error

Decode decodes Page from json.

func (*Page) Encode

func (s *Page) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*Page) GetCreated

func (s *Page) GetCreated() time.Time

GetCreated returns the value of Created.

func (*Page) GetFormats

func (s *Page) GetFormats() []Format

GetFormats returns the value of Formats.

func (*Page) GetID

func (s *Page) GetID() uuid.UUID

GetID returns the value of ID.

func (*Page) GetMeta added in v0.1.3

func (s *Page) GetMeta() PageMeta

GetMeta returns the value of Meta.

func (*Page) GetStatus

func (s *Page) GetStatus() Status

GetStatus returns the value of Status.

func (*Page) GetURL

func (s *Page) GetURL() string

GetURL returns the value of URL.

func (*Page) MarshalJSON

func (s *Page) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*Page) SetCreated

func (s *Page) SetCreated(val time.Time)

SetCreated sets the value of Created.

func (*Page) SetFormats

func (s *Page) SetFormats(val []Format)

SetFormats sets the value of Formats.

func (*Page) SetID

func (s *Page) SetID(val uuid.UUID)

SetID sets the value of ID.

func (*Page) SetMeta added in v0.1.3

func (s *Page) SetMeta(val PageMeta)

SetMeta sets the value of Meta.

func (*Page) SetStatus

func (s *Page) SetStatus(val Status)

SetStatus sets the value of Status.

func (*Page) SetURL

func (s *Page) SetURL(val string)

SetURL sets the value of URL.

func (*Page) UnmarshalJSON

func (s *Page) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*Page) Validate

func (s *Page) Validate() error

type PageMeta added in v0.1.3

type PageMeta struct {
	Title       string    `json:"title"`
	Description string    `json:"description"`
	Error       OptString `json:"error"`
}

func (*PageMeta) Decode added in v0.1.3

func (s *PageMeta) Decode(d *jx.Decoder) error

Decode decodes PageMeta from json.

func (*PageMeta) Encode added in v0.1.3

func (s *PageMeta) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*PageMeta) GetDescription added in v0.1.3

func (s *PageMeta) GetDescription() string

GetDescription returns the value of Description.

func (*PageMeta) GetError added in v0.1.3

func (s *PageMeta) GetError() OptString

GetError returns the value of Error.

func (*PageMeta) GetTitle added in v0.1.3

func (s *PageMeta) GetTitle() string

GetTitle returns the value of Title.

func (*PageMeta) MarshalJSON added in v0.1.3

func (s *PageMeta) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*PageMeta) SetDescription added in v0.1.3

func (s *PageMeta) SetDescription(val string)

SetDescription sets the value of Description.

func (*PageMeta) SetError added in v0.1.3

func (s *PageMeta) SetError(val OptString)

SetError sets the value of Error.

func (*PageMeta) SetTitle added in v0.1.3

func (s *PageMeta) SetTitle(val string)

SetTitle sets the value of Title.

func (*PageMeta) UnmarshalJSON added in v0.1.3

func (s *PageMeta) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type 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"`
	Meta    PageWithResultsMeta `json:"meta"`
	Results []Result            `json:"results"`
}

Merged schema. Ref: #/components/schemas/pageWithResults

func (*PageWithResults) Decode

func (s *PageWithResults) Decode(d *jx.Decoder) error

Decode decodes PageWithResults from json.

func (*PageWithResults) Encode

func (s *PageWithResults) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*PageWithResults) GetCreated

func (s *PageWithResults) GetCreated() time.Time

GetCreated returns the value of Created.

func (*PageWithResults) GetFormats

func (s *PageWithResults) GetFormats() []Format

GetFormats returns the value of Formats.

func (*PageWithResults) GetID

func (s *PageWithResults) GetID() uuid.UUID

GetID returns the value of ID.

func (*PageWithResults) GetMeta added in v0.1.3

func (s *PageWithResults) GetMeta() PageWithResultsMeta

GetMeta returns the value of Meta.

func (*PageWithResults) GetResults

func (s *PageWithResults) GetResults() []Result

GetResults returns the value of Results.

func (*PageWithResults) GetStatus

func (s *PageWithResults) GetStatus() Status

GetStatus returns the value of Status.

func (*PageWithResults) GetURL

func (s *PageWithResults) GetURL() string

GetURL returns the value of URL.

func (*PageWithResults) MarshalJSON

func (s *PageWithResults) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*PageWithResults) SetCreated

func (s *PageWithResults) SetCreated(val time.Time)

SetCreated sets the value of Created.

func (*PageWithResults) SetFormats

func (s *PageWithResults) SetFormats(val []Format)

SetFormats sets the value of Formats.

func (*PageWithResults) SetID

func (s *PageWithResults) SetID(val uuid.UUID)

SetID sets the value of ID.

func (*PageWithResults) SetMeta added in v0.1.3

func (s *PageWithResults) SetMeta(val PageWithResultsMeta)

SetMeta sets the value of Meta.

func (*PageWithResults) SetResults

func (s *PageWithResults) SetResults(val []Result)

SetResults sets the value of Results.

func (*PageWithResults) SetStatus

func (s *PageWithResults) SetStatus(val Status)

SetStatus sets the value of Status.

func (*PageWithResults) SetURL

func (s *PageWithResults) SetURL(val string)

SetURL sets the value of URL.

func (*PageWithResults) UnmarshalJSON

func (s *PageWithResults) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*PageWithResults) Validate

func (s *PageWithResults) Validate() error

type PageWithResultsMeta added in v0.1.3

type PageWithResultsMeta struct {
	Title       string    `json:"title"`
	Description string    `json:"description"`
	Error       OptString `json:"error"`
}

func (*PageWithResultsMeta) Decode added in v0.1.3

func (s *PageWithResultsMeta) Decode(d *jx.Decoder) error

Decode decodes PageWithResultsMeta from json.

func (*PageWithResultsMeta) Encode added in v0.1.3

func (s *PageWithResultsMeta) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*PageWithResultsMeta) GetDescription added in v0.1.3

func (s *PageWithResultsMeta) GetDescription() string

GetDescription returns the value of Description.

func (*PageWithResultsMeta) GetError added in v0.1.3

func (s *PageWithResultsMeta) GetError() OptString

GetError returns the value of Error.

func (*PageWithResultsMeta) GetTitle added in v0.1.3

func (s *PageWithResultsMeta) GetTitle() string

GetTitle returns the value of Title.

func (*PageWithResultsMeta) MarshalJSON added in v0.1.3

func (s *PageWithResultsMeta) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*PageWithResultsMeta) SetDescription added in v0.1.3

func (s *PageWithResultsMeta) SetDescription(val string)

SetDescription sets the value of Description.

func (*PageWithResultsMeta) SetError added in v0.1.3

func (s *PageWithResultsMeta) SetError(val OptString)

SetError sets the value of Error.

func (*PageWithResultsMeta) SetTitle added in v0.1.3

func (s *PageWithResultsMeta) SetTitle(val string)

SetTitle sets the value of Title.

func (*PageWithResultsMeta) UnmarshalJSON added in v0.1.3

func (s *PageWithResultsMeta) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type Pages

type Pages []Page

func (*Pages) Decode

func (s *Pages) Decode(d *jx.Decoder) error

Decode decodes Pages from json.

func (Pages) Encode

func (s Pages) Encode(e *jx.Encoder)

Encode encodes Pages as json.

func (Pages) MarshalJSON

func (s Pages) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*Pages) UnmarshalJSON

func (s *Pages) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (Pages) Validate

func (s Pages) Validate() error

type Result

type Result struct {
	Format Format            `json:"format"`
	Error  OptString         `json:"error"`
	Files  []ResultFilesItem `json:"files"`
}

Ref: #/components/schemas/result

func (*Result) Decode

func (s *Result) Decode(d *jx.Decoder) error

Decode decodes Result from json.

func (*Result) Encode

func (s *Result) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*Result) GetError

func (s *Result) GetError() OptString

GetError returns the value of Error.

func (*Result) GetFiles

func (s *Result) GetFiles() []ResultFilesItem

GetFiles returns the value of Files.

func (*Result) GetFormat

func (s *Result) GetFormat() Format

GetFormat returns the value of Format.

func (*Result) MarshalJSON

func (s *Result) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*Result) SetError

func (s *Result) SetError(val OptString)

SetError sets the value of Error.

func (*Result) SetFiles

func (s *Result) SetFiles(val []ResultFilesItem)

SetFiles sets the value of Files.

func (*Result) SetFormat

func (s *Result) SetFormat(val Format)

SetFormat sets the value of Format.

func (*Result) UnmarshalJSON

func (s *Result) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*Result) Validate

func (s *Result) Validate() error

type ResultFilesItem

type ResultFilesItem struct {
	ID       uuid.UUID `json:"id"`
	Name     string    `json:"name"`
	Mimetype string    `json:"mimetype"`
	Size     int64     `json:"size"`
}

func (*ResultFilesItem) Decode

func (s *ResultFilesItem) Decode(d *jx.Decoder) error

Decode decodes ResultFilesItem from json.

func (*ResultFilesItem) Encode

func (s *ResultFilesItem) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*ResultFilesItem) GetID

func (s *ResultFilesItem) GetID() uuid.UUID

GetID returns the value of ID.

func (*ResultFilesItem) GetMimetype

func (s *ResultFilesItem) GetMimetype() string

GetMimetype returns the value of Mimetype.

func (*ResultFilesItem) GetName

func (s *ResultFilesItem) GetName() string

GetName returns the value of Name.

func (*ResultFilesItem) GetSize

func (s *ResultFilesItem) GetSize() int64

GetSize returns the value of Size.

func (*ResultFilesItem) MarshalJSON

func (s *ResultFilesItem) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*ResultFilesItem) SetID

func (s *ResultFilesItem) SetID(val uuid.UUID)

SetID sets the value of ID.

func (*ResultFilesItem) SetMimetype

func (s *ResultFilesItem) SetMimetype(val string)

SetMimetype sets the value of Mimetype.

func (*ResultFilesItem) SetName

func (s *ResultFilesItem) SetName(val string)

SetName sets the value of Name.

func (*ResultFilesItem) SetSize

func (s *ResultFilesItem) SetSize(val int64)

SetSize sets the value of Size.

func (*ResultFilesItem) UnmarshalJSON

func (s *ResultFilesItem) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type Route

type Route struct {
	// contains filtered or unexported fields
}

Route is route object.

func (Route) Args

func (r Route) Args() []string

Args returns parsed arguments.

func (Route) Name

func (r Route) Name() string

Name returns ogen operation name.

It is guaranteed to be unique and not empty.

func (Route) OperationID

func (r Route) OperationID() string

OperationID returns OpenAPI operationId.

func (Route) PathPattern

func (r Route) PathPattern() string

PathPattern returns OpenAPI path.

func (Route) Summary added in v0.1.4

func (r Route) Summary() string

Summary returns OpenAPI summary.

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server implements http server based on OpenAPI v3 specification and calls Handler to handle requests.

func NewServer

func NewServer(h Handler, opts ...ServerOption) (*Server, error)

NewServer creates new Server.

func (*Server) FindPath

func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool)

FindPath finds Route for given method and URL.

func (*Server) FindRoute

func (s *Server) FindRoute(method, path string) (Route, bool)

FindRoute finds Route for given method and path.

Note: this method does not unescape path or handle reserved characters in path properly. Use FindPath instead.

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP serves http request as defined by OpenAPI v3 specification, calling handler that matches the path or returning not found error.

type ServerOption

type ServerOption interface {
	// contains filtered or unexported methods
}

ServerOption is server config option.

func WithErrorHandler

func WithErrorHandler(h ErrorHandler) ServerOption

WithErrorHandler specifies error handler to use.

func WithMaxMultipartMemory

func WithMaxMultipartMemory(max int64) ServerOption

WithMaxMultipartMemory specifies limit of memory for storing file parts. File parts which can't be stored in memory will be stored on disk in temporary files.

func WithMethodNotAllowed

func WithMethodNotAllowed(methodNotAllowed func(w http.ResponseWriter, r *http.Request, allowed string)) ServerOption

WithMethodNotAllowed specifies Method Not Allowed handler to use.

func WithMiddleware

func WithMiddleware(m ...Middleware) ServerOption

WithMiddleware specifies middlewares to use.

func WithNotFound

func WithNotFound(notFound http.HandlerFunc) ServerOption

WithNotFound specifies Not Found handler to use.

func WithPathPrefix

func WithPathPrefix(prefix string) ServerOption

WithPathPrefix specifies server path prefix.

type Status

type Status string

Ref: #/components/schemas/status

const (
	StatusNew        Status = "new"
	StatusProcessing Status = "processing"
	StatusDone       Status = "done"
	StatusFailed     Status = "failed"
	StatusWithErrors Status = "with_errors"
)

func (Status) AllValues added in v0.1.4

func (Status) AllValues() []Status

AllValues returns all Status values.

func (*Status) Decode

func (s *Status) Decode(d *jx.Decoder) error

Decode decodes Status from json.

func (Status) Encode

func (s Status) Encode(e *jx.Encoder)

Encode encodes Status as json.

func (Status) MarshalJSON

func (s Status) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (Status) MarshalText

func (s Status) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (*Status) UnmarshalJSON

func (s *Status) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*Status) UnmarshalText

func (s *Status) UnmarshalText(data []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

func (Status) Validate

func (s Status) Validate() error

type UnimplementedHandler

type UnimplementedHandler struct{}

UnimplementedHandler is no-op Handler which returns http.ErrNotImplemented.

func (UnimplementedHandler) AddPage

AddPage implements addPage operation.

Add new page.

POST /pages

func (UnimplementedHandler) GetFile

func (UnimplementedHandler) GetFile(ctx context.Context, params GetFileParams) (r GetFileRes, _ error)

GetFile implements getFile operation.

Get file content.

GET /pages/{id}/file/{file_id}

func (UnimplementedHandler) GetPage

func (UnimplementedHandler) GetPage(ctx context.Context, params GetPageParams) (r GetPageRes, _ error)

GetPage implements getPage operation.

Get page details.

GET /pages/{id}

func (UnimplementedHandler) GetPages

func (UnimplementedHandler) GetPages(ctx context.Context) (r Pages, _ error)

GetPages implements getPages operation.

Get all pages.

GET /pages

func (UnimplementedHandler) NewError

func (UnimplementedHandler) NewError(ctx context.Context, err error) (r *ErrorStatusCode)

NewError creates *ErrorStatusCode from error returned by handler.

Used for common default response.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL