oapi

package
v0.0.0-...-4e06884 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package oapi 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.

Package oapi 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.

Package oapi 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

View Source
const (
	ApikeyAuthScopes = "ApikeyAuth.Scopes"
	BearerAuthScopes = "BearerAuth.Scopes"
	OAuthScopes      = "OAuth.Scopes"
	OpenIDScopes     = "OpenID.Scopes"
)

Variables

This section is empty.

Functions

func Assets

func Assets() embed.FS

func GetSwagger

func GetSwagger() (swagger *openapi3.T, err error)

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 PathToRawSpec

func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)

Constructs a synthetic filesystem for resolving external references when loading openapi specifications.

func RegisterHandlers

func RegisterHandlers(router EchoRouter, si ServerInterface)

RegisterHandlers adds each server route to the EchoRouter.

func RegisterHandlersWithBaseURL

func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string)

Registers handlers, and prepends BaseURL to the paths, so that the paths can be served under a prefix.

Types

type After

type After = string

After defines model for after.

type AuthRequest

type AuthRequest struct {
	// Password The password of the user.
	Password string `json:"password" validate:"required"`

	// Username The username of the user.
	Username string `json:"username" validate:"required"`
}

AuthRequest defines model for AuthRequest.

type Before

type Before = string

Before defines model for before.

type DelayRequest

type DelayRequest struct {
	// Delay Delay duration
	Delay string `json:"delay"`
}

DelayRequest defines model for DelayRequest.

type EchoRouter

type EchoRouter interface {
	CONNECT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	DELETE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	GET(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	HEAD(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	OPTIONS(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	PATCH(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	POST(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	PUT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	TRACE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
}

This is a simple interface which specifies echo.Route addition functions which are present on both echo.Echo and echo.Group, since we want to allow using either of them for path registration

type Error

type Error struct {
	// DetailedError The detailed error description.
	DetailedError *string `json:"detailed_error,omitempty"`

	// Location The location of the error.
	Location *string `json:"location,omitempty"`

	// Message The error message.
	Message string `json:"message"`

	// StatusCode The status code of the error.
	StatusCode string `json:"status_code"`
}

Error defines model for Error.

type Fields

type Fields = string

Fields defines model for fields.

type Filters

type Filters map[string]string

Filters defines model for filters.

type Includes

type Includes = []string

Includes defines model for includes.

type Limit

type Limit = int

Limit defines model for limit.

type ListProfilesParams

type ListProfilesParams struct {
	// Before The cursor for retrieving the previous page.
	Before *Before `form:"before,omitempty" json:"before,omitempty"`

	// After The cursor for retrieving the next page.
	After *After `form:"after,omitempty" json:"after,omitempty"`

	// Page The page number to retrieve.
	Page *Page `form:"page,omitempty" json:"page,omitempty"`

	// Q The default query parameter.
	Q *Query `form:"q,omitempty" json:"q,omitempty"`

	// Limit The maximum number of items to return.
	Limit *Limit `form:"limit,omitempty" json:"limit,omitempty"`

	// Includes Additional relationships to include.
	Includes *Includes `form:"includes,omitempty" json:"includes,omitempty"`

	// Filters Additional filters for querying.
	Filters *Filters `form:"filters,omitempty" json:"filters,omitempty"`

	// Fields Comma-separated list of fields to return in the response. Not implemented yet.
	Fields *Fields `form:"fields,omitempty" json:"fields,omitempty"`

	// Sort Comma-separated list of fields to specify the sort order. Use + or - as a prefix. Not implemented yet.
	Sort *Sort `form:"sort,omitempty" json:"sort,omitempty"`
}

ListProfilesParams defines parameters for ListProfiles.

type LiveCheckParams

type LiveCheckParams struct {
	// Verbose Flag to enable verbose response.
	Verbose *Verbose `form:"verbose,omitempty" json:"verbose,omitempty"`
}

LiveCheckParams defines parameters for LiveCheck.

type LoginJSONRequestBody

type LoginJSONRequestBody = AuthRequest

LoginJSONRequestBody defines body for Login for application/json ContentType.

type Model

type Model struct {
	// CreatedAt The creation timestamp of the model.
	CreatedAt string `json:"created_at"`

	// ID The unique identifier of the model.
	ID int64 `json:"id"`

	// UpdatedAt The last update timestamp of the model.
	UpdatedAt string `json:"updated_at"`
}

Model defines model for Model.

type Page

type Page = int

Page defines model for page.

type Pagination

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

Pagination defines model for Pagination.

func (Pagination) AsPaginationCursor

func (t Pagination) AsPaginationCursor() (PaginationCursor, error)

AsPaginationCursor returns the union data inside the Pagination as a PaginationCursor

func (Pagination) AsPaginationPage

func (t Pagination) AsPaginationPage() (PaginationPage, error)

AsPaginationPage returns the union data inside the Pagination as a PaginationPage

func (*Pagination) FromPaginationCursor

func (t *Pagination) FromPaginationCursor(v PaginationCursor) error

FromPaginationCursor overwrites any union data inside the Pagination as the provided PaginationCursor

func (*Pagination) FromPaginationPage

func (t *Pagination) FromPaginationPage(v PaginationPage) error

FromPaginationPage overwrites any union data inside the Pagination as the provided PaginationPage

func (Pagination) MarshalJSON

func (t Pagination) MarshalJSON() ([]byte, error)

func (*Pagination) MergePaginationCursor

func (t *Pagination) MergePaginationCursor(v PaginationCursor) error

MergePaginationCursor performs a merge with any union data inside the Pagination, using the provided PaginationCursor

func (*Pagination) MergePaginationPage

func (t *Pagination) MergePaginationPage(v PaginationPage) error

MergePaginationPage performs a merge with any union data inside the Pagination, using the provided PaginationPage

func (*Pagination) UnmarshalJSON

func (t *Pagination) UnmarshalJSON(b []byte) error

type PaginationCursor

type PaginationCursor struct {
	// NextCursor The cursor for the next page of results.
	NextCursor string `json:"next_cursor"`

	// PrevCursor The cursor for the previous page of results.
	PrevCursor string `json:"prev_cursor"`
	Type       string `json:"type"`
}

PaginationCursor defines model for PaginationCursor.

type PaginationPage

type PaginationPage struct {
	// CurrentPage The current page number.
	CurrentPage int `json:"current_page"`

	// MaxPage The maximum page number.
	MaxPage int `json:"max_page"`

	// RecordsPerPage The number of records per page.
	RecordsPerPage int `json:"records_per_page"`

	// TotalRecords The total number of records.
	TotalRecords int    `json:"total_records"`
	Type         string `json:"type"`
}

PaginationPage defines model for PaginationPage.

type PaginationType

type PaginationType struct {
	Type string `json:"type"`
}

PaginationType defines model for PaginationType.

type ProcessBackgroundJSONRequestBody

type ProcessBackgroundJSONRequestBody = DelayRequest

ProcessBackgroundJSONRequestBody defines body for ProcessBackground for application/json ContentType.

type Profile

type Profile struct {
	// CreatedAt The creation timestamp of the model.
	CreatedAt string `json:"created_at"`

	// Email The email address of the profile owner.
	Email string `json:"email"`

	// FirstName The first name of the profile owner.
	FirstName string `json:"first_name"`

	// ID The unique identifier of the model.
	ID int64 `json:"id"`

	// LastName The last name of the profile owner.
	LastName string `json:"last_name"`

	// UpdatedAt The last update timestamp of the model.
	UpdatedAt string `json:"updated_at"`
}

Profile defines model for Profile.

type ProfileId

type ProfileId = int64

ProfileId defines model for profileId.

type ProfileList

type ProfileList struct {
	Items      []Profile  `json:"items"`
	Pagination Pagination `json:"pagination"`
}

ProfileList defines model for ProfileList.

type ProfileRequest

type ProfileRequest struct {
	// Email The email address of the profile owner.
	Email string `json:"email"`

	// FirstName The first name of the profile owner.
	FirstName string `json:"first_name"`

	// LastName The last name of the profile owner.
	LastName string `json:"last_name"`
}

ProfileRequest defines model for ProfileRequest.

type Query

type Query = string

Query defines model for query.

type QueueName

type QueueName = string

QueueName defines model for queueName.

type ReadyCheckParams

type ReadyCheckParams struct {
	// Verbose Flag to enable verbose response.
	Verbose *Verbose `form:"verbose,omitempty" json:"verbose,omitempty"`
}

ReadyCheckParams defines parameters for ReadyCheck.

type SaveProfileJSONRequestBody

type SaveProfileJSONRequestBody = ProfileRequest

SaveProfileJSONRequestBody defines body for SaveProfile for application/json ContentType.

type ServerInterface

type ServerInterface interface {

	// (POST /auth/login)
	Login(ctx echo.Context) error

	// (GET /auth/oauth/callback)
	OAuthCallback(ctx echo.Context) error

	// (GET /auth/oauth/login)
	OAuthLogin(ctx echo.Context) error

	// (POST /auth/refresh)
	OAuthRefresh(ctx echo.Context) error
	// Create a new delay job request
	// (POST /background/delay)
	ProcessBackground(ctx echo.Context) error
	// Check if the app is started
	// (GET /health/live)
	LiveCheck(ctx echo.Context, params LiveCheckParams) error
	// Check if the app is ready to accept connections
	// (GET /health/ready)
	ReadyCheck(ctx echo.Context, params ReadyCheckParams) error
	// Retrieve a list of profiles
	// (GET /profiles)
	ListProfiles(ctx echo.Context, params ListProfilesParams) error
	// Create a new profile
	// (POST /profiles)
	SaveProfile(ctx echo.Context) error
	// Delete a profile by ID
	// (DELETE /profiles/{id})
	RemoveProfile(ctx echo.Context, id ProfileId) error
	// Get a profile by ID
	// (GET /profiles/{id})
	GetProfile(ctx echo.Context, id ProfileId) error
	// Update a profile by ID
	// (PATCH /profiles/{id})
	UpdateProfile(ctx echo.Context, id ProfileId) error

	// (GET /queues/{name}/tasks/{id})
	GetTask(ctx echo.Context, name QueueName, id TaskId) error

	// (GET /queues/{name}/tasks/{id}/response)
	GetTaskResponse(ctx echo.Context, name QueueName, id TaskId) error
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler ServerInterface
}

ServerInterfaceWrapper converts echo contexts to parameters.

func (*ServerInterfaceWrapper) GetProfile

func (w *ServerInterfaceWrapper) GetProfile(ctx echo.Context) error

GetProfile converts echo context to params.

func (*ServerInterfaceWrapper) GetTask

func (w *ServerInterfaceWrapper) GetTask(ctx echo.Context) error

GetTask converts echo context to params.

func (*ServerInterfaceWrapper) GetTaskResponse

func (w *ServerInterfaceWrapper) GetTaskResponse(ctx echo.Context) error

GetTaskResponse converts echo context to params.

func (*ServerInterfaceWrapper) ListProfiles

func (w *ServerInterfaceWrapper) ListProfiles(ctx echo.Context) error

ListProfiles converts echo context to params.

func (*ServerInterfaceWrapper) LiveCheck

func (w *ServerInterfaceWrapper) LiveCheck(ctx echo.Context) error

LiveCheck converts echo context to params.

func (*ServerInterfaceWrapper) Login

func (w *ServerInterfaceWrapper) Login(ctx echo.Context) error

Login converts echo context to params.

func (*ServerInterfaceWrapper) OAuthCallback

func (w *ServerInterfaceWrapper) OAuthCallback(ctx echo.Context) error

OAuthCallback converts echo context to params.

func (*ServerInterfaceWrapper) OAuthLogin

func (w *ServerInterfaceWrapper) OAuthLogin(ctx echo.Context) error

OAuthLogin converts echo context to params.

func (*ServerInterfaceWrapper) OAuthRefresh

func (w *ServerInterfaceWrapper) OAuthRefresh(ctx echo.Context) error

OAuthRefresh converts echo context to params.

func (*ServerInterfaceWrapper) ProcessBackground

func (w *ServerInterfaceWrapper) ProcessBackground(ctx echo.Context) error

ProcessBackground converts echo context to params.

func (*ServerInterfaceWrapper) ReadyCheck

func (w *ServerInterfaceWrapper) ReadyCheck(ctx echo.Context) error

ReadyCheck converts echo context to params.

func (*ServerInterfaceWrapper) RemoveProfile

func (w *ServerInterfaceWrapper) RemoveProfile(ctx echo.Context) error

RemoveProfile converts echo context to params.

func (*ServerInterfaceWrapper) SaveProfile

func (w *ServerInterfaceWrapper) SaveProfile(ctx echo.Context) error

SaveProfile converts echo context to params.

func (*ServerInterfaceWrapper) UpdateProfile

func (w *ServerInterfaceWrapper) UpdateProfile(ctx echo.Context) error

UpdateProfile converts echo context to params.

type Sort

type Sort = string

Sort defines model for sort.

type Task

type Task struct {
	Error *struct {
		Code    string                  `json:"code"`
		Details *map[string]interface{} `json:"details,omitempty"`
		Message string                  `json:"message"`
	} `json:"error,omitempty"`

	// State Task status
	State TaskState `json:"state"`

	// TaskId Task identifier
	TaskId string `json:"task_id"`
}

Task defines model for Task.

type TaskCreationResponse

type TaskCreationResponse struct {
	// Location URL to check for task updates
	Location string `json:"location"`

	// TaskId Task identifier
	TaskId string `json:"task_id"`
}

TaskCreationResponse defines model for TaskCreationResponse.

type TaskId

type TaskId = string

TaskId defines model for taskId.

type TaskState

type TaskState string

TaskState Task status

const (
	Failed    TaskState = "failed"
	Pending   TaskState = "pending"
	Retry     TaskState = "retry"
	Running   TaskState = "running"
	Succeeded TaskState = "succeeded"
)

Defines values for TaskState.

type Token

type Token struct {
	// Token The JWT token for authentication.
	Token string `json:"token"`
}

Token defines model for Token.

type UnexpectedError

type UnexpectedError = Error

UnexpectedError defines model for UnexpectedError.

type UpdateProfileJSONRequestBody

type UpdateProfileJSONRequestBody = ProfileRequest

UpdateProfileJSONRequestBody defines body for UpdateProfile for application/json ContentType.

type Verbose

type Verbose = bool

Verbose defines model for verbose.

Jump to

Keyboard shortcuts

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