openapi

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2025 License: MIT Imports: 2 Imported by: 1

README

Go API Server for openapi

No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

Overview

This server was generated by the [openapi-generator] (https://openapi-generator.tech) project. By using the OpenAPI-Spec from a remote server, you can easily generate a server stub.

To see how to make this your own, look here:

README

  • API version: 1.1.0
  • Build date: 2025-03-24T10:34:28.523651799+07:00[Asia/Barnaul]
  • Generator version: 7.12.0
Running the server

To run the server, follow these simple steps:

go run main.go

To run the server in a docker container

docker build --network=host -t openapi .

Once the image is built, just run

docker run --rm -it openapi
Known Issue

Endpoints sharing a common path may result in issues. For example, /v2/pet/findByTags and /v2/pet/:petId will result in an issue with the Gin framework. For more information about this known limitation, please refer to gin-gonic/gin#388 for more information.

A workaround is to manually update the path and handler. Please refer to gin-gonic/gin/issues/205#issuecomment-296155497 for more information.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultHandleFunc

func DefaultHandleFunc(c *gin.Context)

Default handler for not yet implemented routes

func NewRouter

func NewRouter(handleFunctions ApiHandleFunctions) *gin.Engine

NewRouter returns a new router.

func NewRouterWithGinEngine

func NewRouterWithGinEngine(router *gin.Engine, handleFunctions ApiHandleFunctions) *gin.Engine

NewRouter add routes to existing gin engine.

Types

type ApiHandleFunctions

type ApiHandleFunctions struct {

	// Routes for the DefaultAPI part of the API
	DefaultAPI DefaultAPI
}

type Attachment

type Attachment struct {
	Id string `json:"id,omitempty"`

	Type string `json:"type,omitempty"`

	Url string `json:"url,omitempty"`

	Size int32 `json:"size,omitempty"`

	MimeType string `json:"mimeType,omitempty"`

	Inline bool `json:"inline,omitempty"`
}

type AuthRequest

type AuthRequest struct {
	Username string `json:"username,omitempty"`

	Password string `json:"password,omitempty"`
}

type AuthResponse

type AuthResponse struct {
	AccessToken string `json:"accessToken,omitempty"`

	AccessExpiresIn int32 `json:"accessExpiresIn,omitempty"`

	RefreshToken string `json:"refreshToken,omitempty"`

	RefreshExpiresIn int32 `json:"refreshExpiresIn,omitempty"`

	Type string `json:"type,omitempty"`
}

type Chat

type Chat struct {
	Id string `json:"id,omitempty"`

	Name string `json:"name"`

	Type string `json:"type"`

	Participants []string `json:"participants,omitempty"`
}

type DefaultAPI

type DefaultAPI interface {

	// CreateChat Post /chats
	CreateChat(c *gin.Context)

	// CreateMessage Post /chats/:chatId/messages
	CreateMessage(c *gin.Context)

	// DeleteChat Delete /chats/:chatId
	DeleteChat(c *gin.Context)

	// GetChat Get /chats/:chatId
	GetChat(c *gin.Context)

	// GetChats Get /chats
	GetChats(c *gin.Context)

	// GetMe Get /users/me
	GetMe(c *gin.Context)

	// GetMessage Get /chats/:chatId/messages/:messageId
	GetMessage(c *gin.Context)

	// GetMessages Get /chats/:chatId/messages
	GetMessages(c *gin.Context)

	// GetUsersList Get /users
	GetUsersList(c *gin.Context)

	// LoginUser Post /auth/login
	LoginUser(c *gin.Context)

	// RegisterUser Post /auth/register
	RegisterUser(c *gin.Context)

	// UpdateChat Put /chats/:chatId
	UpdateChat(c *gin.Context)

	// UpdateMessage Put /chats/:chatId/messages/:messageId
	UpdateMessage(c *gin.Context)
}

type ErrorResponse

type ErrorResponse struct {
	Error string `json:"error,omitempty"`
}

type Message

type Message struct {
	Id string `json:"id,omitempty"`

	SenderId string `json:"senderId,omitempty"`

	ChatId string `json:"chatId,omitempty"`

	EncryptedContent string `json:"encryptedContent,omitempty"`

	Timestamp string `json:"timestamp,omitempty"`

	Status string `json:"status,omitempty"`
}

type Route

type Route struct {
	// Name is the name of this Route.
	Name string
	// Method is the string for the HTTP method. ex) GET, POST etc..
	Method string
	// Pattern is the pattern of the URI.
	Pattern string
	// HandlerFunc is the handler function of this route.
	HandlerFunc gin.HandlerFunc
}

Route is the information for every URI.

type User

type User struct {
	Id string `json:"id,omitempty"`

	Username string `json:"username,omitempty"`

	DisplayName string `json:"displayName,omitempty"`

	AvatarUrl string `json:"avatarUrl,omitempty"`

	Status string `json:"status,omitempty"`

	LastSeen string `json:"lastSeen,omitempty"`
}

Jump to

Keyboard shortcuts

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