Documentation
¶
Overview ¶
Package api provides primitives to interact with the openapi HTTP API.
Code generated by github.com/discord-gophers/goapi-gen version v0.3.0 DO NOT EDIT.
Index ¶
- func GetSwagger() (swagger *openapi3.T, err error)
- func Handler(si ServerInterface, opts ...ServerOption) http.Handler
- func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)
- type ConnectParams
- type Error
- type InvalidParamFormatError
- type ParameterError
- type RequiredHeaderError
- type RequiredParamError
- type Response
- func (resp *Response) ContentType(contentType string) *Response
- func (resp *Response) MarshalJSON() ([]byte, error)
- func (resp *Response) MarshalXML(e *xml.Encoder, start xml.StartElement) error
- func (resp *Response) Render(w http.ResponseWriter, r *http.Request) error
- func (resp *Response) Status(code int) *Response
- type ServerInterface
- type ServerInterfaceWrapper
- func (siw *ServerInterfaceWrapper) Connect(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetEvents(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetHomePage(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) ImportSTIX(w http.ResponseWriter, r *http.Request)
- type ServerOption
- type ServerOptions
- type TooManyValuesForParamError
- type UnescapedCookieParamError
- type UnmarshalingParamError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetSwagger ¶
GetSwagger returns the Swagger specification corresponding to the generated code in this file. The external references of Swagger specification are resolved. The logic of resolving external references is tightly connected to "import-mapping" feature. Externally referenced files must be embedded in the corresponding golang packages. Urls can be supported but this task was out of the scope.
func Handler ¶
func Handler(si ServerInterface, opts ...ServerOption) http.Handler
Handler creates http.Handler with routing matching OpenAPI spec.
Types ¶
type ConnectParams ¶
type ConnectParams struct { // The temporary oauth grant code Code *string `json:"code,omitempty"` // The error message Error *string `json:"error,omitempty"` }
ConnectParams defines parameters for Connect.
type InvalidParamFormatError ¶
type InvalidParamFormatError struct {
// contains filtered or unexported fields
}
func (InvalidParamFormatError) Error ¶
func (err InvalidParamFormatError) Error() string
Error implements error.
func (InvalidParamFormatError) ParamName ¶
func (err InvalidParamFormatError) ParamName() string
func (InvalidParamFormatError) Unwrap ¶
func (err InvalidParamFormatError) Unwrap() error
type ParameterError ¶
type ParameterError interface { error // ParamName is the name of the parameter that the error is referring to. ParamName() string }
ParameterName is an interface that is implemented by error types that are relevant to a specific parameter.
type RequiredHeaderError ¶
type RequiredHeaderError struct {
// contains filtered or unexported fields
}
func (RequiredHeaderError) Error ¶
func (err RequiredHeaderError) Error() string
Error implements error.
func (RequiredHeaderError) ParamName ¶
func (err RequiredHeaderError) ParamName() string
type RequiredParamError ¶
type RequiredParamError struct {
// contains filtered or unexported fields
}
func (RequiredParamError) Error ¶
func (err RequiredParamError) Error() string
Error implements error.
func (RequiredParamError) ParamName ¶
func (err RequiredParamError) ParamName() string
func (RequiredParamError) Unwrap ¶
func (err RequiredParamError) Unwrap() error
type Response ¶
type Response struct { Code int // contains filtered or unexported fields }
Response is a common response struct for all the API calls. A Response object may be instantiated via functions for specific operation responses. It may also be instantiated directly, for the purpose of responding with a single status code.
func ConnectJSON500Response ¶
ConnectJSON500Response is a constructor method for a Connect response. A *Response is returned with the configured status code and content type from the spec.
func ImportSTIXJSON500Response ¶
ImportSTIXJSON500Response is a constructor method for a ImportSTIX response. A *Response is returned with the configured status code and content type from the spec.
func (*Response) ContentType ¶
ContentType is a builder method to override the default content type for a response.
func (*Response) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface. This is used to only marshal the body of the response.
func (*Response) MarshalXML ¶
MarshalXML implements the xml.Marshaler interface. This is used to only marshal the body of the response.
type ServerInterface ¶
type ServerInterface interface { // Get homepage // (GET /) GetHomePage(w http.ResponseWriter, r *http.Request) *Response // (GET /api/events) GetEvents(w http.ResponseWriter, r *http.Request) *Response // Import STIX data into Notion // (GET /api/import) ImportSTIX(w http.ResponseWriter, r *http.Request) *Response // Connect the Notion STIX Integration // (GET /auth/notion/callback) Connect(w http.ResponseWriter, r *http.Request, params ConnectParams) *Response }
ServerInterface represents all server handlers.
type ServerInterfaceWrapper ¶
type ServerInterfaceWrapper struct { Handler ServerInterface ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) }
ServerInterfaceWrapper converts contexts to parameters.
func (*ServerInterfaceWrapper) Connect ¶
func (siw *ServerInterfaceWrapper) Connect(w http.ResponseWriter, r *http.Request)
Connect operation middleware
func (*ServerInterfaceWrapper) GetEvents ¶
func (siw *ServerInterfaceWrapper) GetEvents(w http.ResponseWriter, r *http.Request)
GetEvents operation middleware
func (*ServerInterfaceWrapper) GetHomePage ¶
func (siw *ServerInterfaceWrapper) GetHomePage(w http.ResponseWriter, r *http.Request)
GetHomePage operation middleware
func (*ServerInterfaceWrapper) ImportSTIX ¶
func (siw *ServerInterfaceWrapper) ImportSTIX(w http.ResponseWriter, r *http.Request)
ImportSTIX operation middleware
type ServerOption ¶
type ServerOption func(*ServerOptions)
func WithErrorHandler ¶
func WithErrorHandler(handler func(w http.ResponseWriter, r *http.Request, err error)) ServerOption
func WithRouter ¶
func WithRouter(r chi.Router) ServerOption
func WithServerBaseURL ¶
func WithServerBaseURL(url string) ServerOption
type ServerOptions ¶
type TooManyValuesForParamError ¶
type TooManyValuesForParamError struct { NumValues int // contains filtered or unexported fields }
func (TooManyValuesForParamError) Error ¶
func (err TooManyValuesForParamError) Error() string
Error implements error.
func (TooManyValuesForParamError) ParamName ¶
func (err TooManyValuesForParamError) ParamName() string
type UnescapedCookieParamError ¶
type UnescapedCookieParamError struct {
// contains filtered or unexported fields
}
func (UnescapedCookieParamError) Error ¶
func (err UnescapedCookieParamError) Error() string
Error implements error.
func (UnescapedCookieParamError) ParamName ¶
func (err UnescapedCookieParamError) ParamName() string
func (UnescapedCookieParamError) Unwrap ¶
func (err UnescapedCookieParamError) Unwrap() error
type UnmarshalingParamError ¶
type UnmarshalingParamError struct {
// contains filtered or unexported fields
}
func (UnmarshalingParamError) Error ¶
func (err UnmarshalingParamError) Error() string
Error implements error.
func (UnmarshalingParamError) ParamName ¶
func (err UnmarshalingParamError) ParamName() string
func (UnmarshalingParamError) Unwrap ¶
func (err UnmarshalingParamError) Unwrap() error