api

package
v0.0.0-...-e3c39ba Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package api provides primitives to interact with the openapi HTTP API.

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.4.1 DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handler

func Handler(si ServerInterface) http.Handler

Handler creates http.Handler with routing matching OpenAPI spec.

func HandlerFromMux

func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler

HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux.

func HandlerFromMuxWithBaseURL

func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler

func HandlerWithOptions

func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler

HandlerWithOptions creates http.Handler with additional options

Types

type AddLink struct {
	// Describe Description of the link.
	Describe *string `json:"describe,omitempty"`

	// Url The URL of the link.
	Url string `json:"url"`
}

AddLink defines model for AddLink.

type AddLinkJSONRequestBody

type AddLinkJSONRequestBody = AddLink

AddLinkJSONRequestBody defines body for AddLink for application/json ContentType.

type AddLinkRequest

type AddLinkRequest = AddLink

AddLinkRequest defines model for AddLinkRequest.

type AddSitemap200Response

type AddSitemap200Response struct {
	// Message A confirmation message.
	Message *string `json:"message,omitempty"`
}

AddSitemap200Response defines model for addSitemap_200_response.

type AddSitemapJSONRequestBody

type AddSitemapJSONRequestBody = AddSitemapRequest

AddSitemapJSONRequestBody defines body for AddSitemap for application/json ContentType.

type AddSitemapRequest

type AddSitemapRequest struct {
	// Url The URL of the sitemap.
	Url string `json:"url"`
}

AddSitemapRequest defines model for addSitemap_request.

type ChiServerOptions

type ChiServerOptions struct {
	BaseURL          string
	BaseRouter       chi.Router
	Middlewares      []MiddlewareFunc
	ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}

type ErrorResponse

type ErrorResponse struct {
	// Messages An array of human-readable messages providing more details about the error.
	Messages *[]string `json:"messages,omitempty"`
}

ErrorResponse defines model for ErrorResponse.

type GetLinks200Response

type GetLinks200Response struct {
	Links []Link `json:"links"`

	// NextCursor A cursor to be used to fetch the next page of results.
	NextCursor string `json:"next_cursor"`
}

GetLinks200Response defines model for getLinks_200_response.

type GetLinksParams

type GetLinksParams struct {
	// Limit The number of items to return per page.
	Limit *int `form:"limit,omitempty" json:"limit,omitempty"`

	// Cursor A cursor for use in pagination. This is the ID of the last item in the previous page.
	Cursor *string     `form:"cursor,omitempty" json:"cursor,omitempty"`
	Filter *LinkFilter `form:"filter,omitempty" json:"filter,omitempty"`
}

GetLinksParams defines parameters for GetLinks.

type InvalidParamFormatError

type InvalidParamFormatError struct {
	ParamName string
	Err       error
}

func (*InvalidParamFormatError) Error

func (e *InvalidParamFormatError) Error() string

func (*InvalidParamFormatError) Unwrap

func (e *InvalidParamFormatError) Unwrap() error
type Link struct {
	// CreatedAt Timestamp when the link was created.
	CreatedAt time.Time `json:"created_at"`

	// Describe Description of the link.
	Describe string `json:"describe"`

	// Hash Unique hash, used as the short link.
	Hash string `json:"hash"`

	// UpdatedAt Timestamp when the link was last updated.
	UpdatedAt time.Time `json:"updated_at"`

	// Url The URL of the link.
	Url string `json:"url"`
}

Link defines model for Link.

type LinkFilter

type LinkFilter struct {
	// Id Unique identifier of the link. Use this to update a specific link.
	Id *openapi_types.UUID `json:"id,omitempty"`

	// UrlContains Filter links that contain this text in their URL.
	UrlContains *string `json:"urlContains,omitempty"`
}

LinkFilter defines model for LinkFilter.

type MiddlewareFunc

type MiddlewareFunc func(http.Handler) http.Handler

type RequiredHeaderError

type RequiredHeaderError struct {
	ParamName string
	Err       error
}

func (*RequiredHeaderError) Error

func (e *RequiredHeaderError) Error() string

func (*RequiredHeaderError) Unwrap

func (e *RequiredHeaderError) Unwrap() error

type RequiredParamError

type RequiredParamError struct {
	ParamName string
}

func (*RequiredParamError) Error

func (e *RequiredParamError) Error() string

type ServerInterface

type ServerInterface interface {
	// List links
	// (GET /links)
	GetLinks(w http.ResponseWriter, r *http.Request, params GetLinksParams)
	// Add link
	// (POST /links)
	AddLink(w http.ResponseWriter, r *http.Request)
	// Update links
	// (PUT /links)
	UpdateLinks(w http.ResponseWriter, r *http.Request)
	// Delete link
	// (DELETE /links/{hash})
	DeleteLink(w http.ResponseWriter, r *http.Request, hash string)
	// Get link
	// (GET /links/{hash})
	GetLink(w http.ResponseWriter, r *http.Request, hash string)
	// Add Sitemap
	// (POST /sitemap)
	AddSitemap(w http.ResponseWriter, r *http.Request)
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler            ServerInterface
	HandlerMiddlewares []MiddlewareFunc
	ErrorHandlerFunc   func(w http.ResponseWriter, r *http.Request, err error)
}

ServerInterfaceWrapper converts contexts to parameters.

AddLink operation middleware

func (*ServerInterfaceWrapper) AddSitemap

func (siw *ServerInterfaceWrapper) AddSitemap(w http.ResponseWriter, r *http.Request)

AddSitemap operation middleware

func (siw *ServerInterfaceWrapper) DeleteLink(w http.ResponseWriter, r *http.Request)

DeleteLink operation middleware

GetLink operation middleware

func (siw *ServerInterfaceWrapper) GetLinks(w http.ResponseWriter, r *http.Request)

GetLinks operation middleware

func (siw *ServerInterfaceWrapper) UpdateLinks(w http.ResponseWriter, r *http.Request)

UpdateLinks operation middleware

type SitemapRequest

type SitemapRequest = AddSitemapRequest

SitemapRequest defines model for SitemapRequest.

type TooManyValuesForParamError

type TooManyValuesForParamError struct {
	ParamName string
	Count     int
}

func (*TooManyValuesForParamError) Error

type UnescapedCookieParamError

type UnescapedCookieParamError struct {
	ParamName string
	Err       error
}

func (*UnescapedCookieParamError) Error

func (e *UnescapedCookieParamError) Error() string

func (*UnescapedCookieParamError) Unwrap

func (e *UnescapedCookieParamError) Unwrap() error

type Unimplemented

type Unimplemented struct{}
func (_ Unimplemented) AddLink(w http.ResponseWriter, r *http.Request)

Add link (POST /links)

func (Unimplemented) AddSitemap

func (_ Unimplemented) AddSitemap(w http.ResponseWriter, r *http.Request)

Add Sitemap (POST /sitemap)

func (_ Unimplemented) DeleteLink(w http.ResponseWriter, r *http.Request, hash string)

Delete link (DELETE /links/{hash})

func (_ Unimplemented) GetLink(w http.ResponseWriter, r *http.Request, hash string)

Get link (GET /links/{hash})

func (_ Unimplemented) GetLinks(w http.ResponseWriter, r *http.Request, params GetLinksParams)

List links (GET /links)

func (_ Unimplemented) UpdateLinks(w http.ResponseWriter, r *http.Request)

Update links (PUT /links)

type UnmarshalingParamError

type UnmarshalingParamError struct {
	ParamName string
	Err       error
}

func (*UnmarshalingParamError) Error

func (e *UnmarshalingParamError) Error() string

func (*UnmarshalingParamError) Unwrap

func (e *UnmarshalingParamError) Unwrap() error

type UpdateLinkRequest

type UpdateLinkRequest = UpdateLinksRequest

UpdateLinkRequest defines model for UpdateLinkRequest.

type UpdateLinks200Response

type UpdateLinks200Response struct {
	// UpdatedCount The number of links updated.
	UpdatedCount *int `json:"updatedCount,omitempty"`
}

UpdateLinks200Response defines model for updateLinks_200_response.

type UpdateLinksJSONRequestBody

type UpdateLinksJSONRequestBody = UpdateLinksRequest

UpdateLinksJSONRequestBody defines body for UpdateLinks for application/json ContentType.

type UpdateLinksRequest

type UpdateLinksRequest struct {
	Filter *LinkFilter `json:"filter,omitempty"`
	Link   *Link       `json:"link,omitempty"`
}

UpdateLinksRequest defines model for updateLinks_request.

Jump to

Keyboard shortcuts

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