Documentation ¶
Index ¶
- type DeleteNoteNoContent
- type DeleteNoteParams
- type DraftMultipart
- func (s *DraftMultipart) GetAttachment() []ht.MultipartFile
- func (s *DraftMultipart) GetAuthor() OptString
- func (s *DraftMultipart) GetHideAttachments() OptBool
- func (s *DraftMultipart) GetText() string
- func (s *DraftMultipart) GetTitle() string
- func (s *DraftMultipart) SetAttachment(val []ht.MultipartFile)
- func (s *DraftMultipart) SetAuthor(val OptString)
- func (s *DraftMultipart) SetHideAttachments(val OptBool)
- func (s *DraftMultipart) SetText(val string)
- func (s *DraftMultipart) SetTitle(val string)
- type ErrorHandler
- type Handler
- type HeaderAuth
- type ID
- type Middleware
- type Note
- func (s *Note) Decode(d *jx.Decoder) error
- func (s *Note) Encode(e *jx.Encoder)
- func (s *Note) GetID() ID
- func (s *Note) GetPublicURL() string
- func (s *Note) MarshalJSON() ([]byte, error)
- func (s *Note) SetID(val ID)
- func (s *Note) SetPublicURL(val string)
- func (s *Note) UnmarshalJSON(data []byte) error
- func (s *Note) Validate() error
- type OptBool
- type OptString
- type Option
- type QueryAuth
- type Route
- type SecurityHandler
- type Server
- type ServerOption
- func WithErrorHandler(h ErrorHandler) ServerOption
- func WithMaxMultipartMemory(max int64) ServerOption
- func WithMethodNotAllowed(methodNotAllowed func(w http.ResponseWriter, r *http.Request, allowed string)) ServerOption
- func WithMiddleware(m ...Middleware) ServerOption
- func WithNotFound(notFound http.HandlerFunc) ServerOption
- func WithPathPrefix(prefix string) ServerOption
- type UnimplementedHandler
- func (UnimplementedHandler) CreateNote(ctx context.Context, req *DraftMultipart) (r *Note, _ error)
- func (UnimplementedHandler) DeleteNote(ctx context.Context, params DeleteNoteParams) error
- func (UnimplementedHandler) UpdateNote(ctx context.Context, req *DraftMultipart, params UpdateNoteParams) error
- type UpdateNoteNoContent
- type UpdateNoteParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DeleteNoteNoContent ¶
type DeleteNoteNoContent struct{}
DeleteNoteNoContent is response for DeleteNote operation.
type DeleteNoteParams ¶
type DeleteNoteParams struct { // Note ID. ID ID }
DeleteNoteParams is parameters of deleteNote operation.
type DraftMultipart ¶
type DraftMultipart struct { // Note title. Title string `json:"title"` // Note body. Text string `json:"text"` // Optional (and not verifiable) author of note. Author OptString `json:"author"` // Do not make list of attachments. HideAttachments OptBool `json:"hide_attachments"` // File attachment. Attachment []ht.MultipartFile `json:"attachment"` }
Ref: #/components/schemas/draft
func (*DraftMultipart) GetAttachment ¶
func (s *DraftMultipart) GetAttachment() []ht.MultipartFile
GetAttachment returns the value of Attachment.
func (*DraftMultipart) GetAuthor ¶
func (s *DraftMultipart) GetAuthor() OptString
GetAuthor returns the value of Author.
func (*DraftMultipart) GetHideAttachments ¶
func (s *DraftMultipart) GetHideAttachments() OptBool
GetHideAttachments returns the value of HideAttachments.
func (*DraftMultipart) GetText ¶
func (s *DraftMultipart) GetText() string
GetText returns the value of Text.
func (*DraftMultipart) GetTitle ¶
func (s *DraftMultipart) GetTitle() string
GetTitle returns the value of Title.
func (*DraftMultipart) SetAttachment ¶
func (s *DraftMultipart) SetAttachment(val []ht.MultipartFile)
SetAttachment sets the value of Attachment.
func (*DraftMultipart) SetAuthor ¶
func (s *DraftMultipart) SetAuthor(val OptString)
SetAuthor sets the value of Author.
func (*DraftMultipart) SetHideAttachments ¶
func (s *DraftMultipart) SetHideAttachments(val OptBool)
SetHideAttachments sets the value of HideAttachments.
func (*DraftMultipart) SetText ¶
func (s *DraftMultipart) SetText(val string)
SetText sets the value of Text.
func (*DraftMultipart) SetTitle ¶
func (s *DraftMultipart) SetTitle(val string)
SetTitle sets the value of Title.
type Handler ¶
type Handler interface { // CreateNote implements createNote operation. // // Create new note from draft with (optional) attachments. // Returns public URL and unique ID. // Consumer should not make any assumptions about ID and treat it as // arbitrary string with variable reasonable length. // Attachments with name index.html will be ignored. // Note can use relative reference to attachments as-is. // // POST /notes CreateNote(ctx context.Context, req *DraftMultipart) (*Note, error) // DeleteNote implements deleteNote operation. // // Remove existent note and all attachments. // // DELETE /note/{id} DeleteNote(ctx context.Context, params DeleteNoteParams) error // UpdateNote implements updateNote operation. // // Update existent note by ID. // Old attachments may not be removed, but could be replaced. // // PUT /note/{id} UpdateNote(ctx context.Context, req *DraftMultipart, params UpdateNoteParams) error }
Handler handles operations described by OpenAPI v3 specification.
type HeaderAuth ¶
type HeaderAuth struct {
APIKey string
}
func (*HeaderAuth) GetAPIKey ¶
func (s *HeaderAuth) GetAPIKey() string
GetAPIKey returns the value of APIKey.
func (*HeaderAuth) SetAPIKey ¶
func (s *HeaderAuth) SetAPIKey(val string)
SetAPIKey sets the value of APIKey.
type ID ¶
type ID string
func (ID) MarshalJSON ¶
MarshalJSON implements stdjson.Marshaler.
func (*ID) UnmarshalJSON ¶
UnmarshalJSON implements stdjson.Unmarshaler.
type Note ¶
Ref: #/components/schemas/note
func (*Note) GetPublicURL ¶
GetPublicURL returns the value of PublicURL.
func (*Note) MarshalJSON ¶
MarshalJSON implements stdjson.Marshaler.
func (*Note) SetPublicURL ¶
SetPublicURL sets the value of PublicURL.
func (*Note) UnmarshalJSON ¶
UnmarshalJSON implements stdjson.Unmarshaler.
type OptBool ¶
OptBool is optional bool.
func NewOptBool ¶
NewOptBool returns new OptBool with value set to v.
type OptString ¶
OptString is optional string.
func NewOptString ¶
NewOptString returns new OptString with value set to v.
type Option ¶
type Option interface { ServerOption }
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 QueryAuth ¶
type QueryAuth struct {
APIKey string
}
type Route ¶
type Route struct {
// contains filtered or unexported fields
}
Route is route object.
func (Route) OperationID ¶
OperationID returns OpenAPI operationId.
type SecurityHandler ¶
type SecurityHandler interface { // HandleHeaderAuth handles HeaderAuth security. HandleHeaderAuth(ctx context.Context, operationName string, t HeaderAuth) (context.Context, error) // HandleQueryAuth handles QueryAuth security. HandleQueryAuth(ctx context.Context, operationName string, t QueryAuth) (context.Context, error) }
SecurityHandler is handler for security parameters.
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, sec SecurityHandler, opts ...ServerOption) (*Server, error)
NewServer creates new Server.
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 UnimplementedHandler ¶
type UnimplementedHandler struct{}
UnimplementedHandler is no-op Handler which returns http.ErrNotImplemented.
func (UnimplementedHandler) CreateNote ¶
func (UnimplementedHandler) CreateNote(ctx context.Context, req *DraftMultipart) (r *Note, _ error)
CreateNote implements createNote operation.
Create new note from draft with (optional) attachments. Returns public URL and unique ID. Consumer should not make any assumptions about ID and treat it as arbitrary string with variable reasonable length. Attachments with name index.html will be ignored. Note can use relative reference to attachments as-is.
POST /notes
func (UnimplementedHandler) DeleteNote ¶
func (UnimplementedHandler) DeleteNote(ctx context.Context, params DeleteNoteParams) error
DeleteNote implements deleteNote operation.
Remove existent note and all attachments.
DELETE /note/{id}
func (UnimplementedHandler) UpdateNote ¶
func (UnimplementedHandler) UpdateNote(ctx context.Context, req *DraftMultipart, params UpdateNoteParams) error
UpdateNote implements updateNote operation.
Update existent note by ID. Old attachments may not be removed, but could be replaced.
PUT /note/{id}
type UpdateNoteNoContent ¶
type UpdateNoteNoContent struct{}
UpdateNoteNoContent is response for UpdateNote operation.
type UpdateNoteParams ¶
type UpdateNoteParams struct { // Note ID. ID ID }
UpdateNoteParams is parameters of updateNote operation.