openapi

package module
v0.0.0-...-9d3578c Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2024 License: MIT Imports: 12 Imported by: 1

Documentation

Overview

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

Code generated by github.com/deepmap/oapi-codegen version v1.13.0 DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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 gin.IRouter, si ServerInterface)

RegisterHandlers creates http.Handler with routing matching OpenAPI spec.

func RegisterHandlersWithOptions

func RegisterHandlersWithOptions(router gin.IRouter, si ServerInterface, options GinServerOptions)

RegisterHandlersWithOptions creates http.Handler with additional options

Types

type Following

type Following struct {
	// DisplayName 表示名
	DisplayName *string `json:"display_name,omitempty"`

	// Id ユーザー ID
	Id openapi_types.UUID `json:"id"`

	// ImgUrl アイコン画像の URL
	ImgUrl *string `json:"img_url,omitempty"`

	// Username 相手のユーザー名
	Username string `json:"username"`
}

Following フォローしてるユーザーの情報

type GetMessagesParams

type GetMessagesParams struct {
	LastReadAt *LastReadAt `form:"last_read_at,omitempty" json:"last_read_at,omitempty"`
}

GetMessagesParams defines parameters for GetMessages.

type GinServerOptions

type GinServerOptions struct {
	BaseURL      string
	Middlewares  []MiddlewareFunc
	ErrorHandler func(*gin.Context, error, int)
}

GinServerOptions provides options for the Gin server.

type LastReadAt

type LastReadAt = string

LastReadAt そのルームの内容を最後に確認した日時(ISO 8601 形式)

type LoginBody

type LoginBody struct {
	// Token Firebase Auth API から受け取った ID トークン。
	Token string `json:"token"`
}

LoginBody defines model for login-body.

type Me

type Me struct {
	// Email ログインアカウントに紐づいたメールアドレス
	Email string `json:"email"`

	// Id ユーザー ID
	Id openapi_types.UUID `json:"id"`

	// ImgUrl アイコン画像の URL
	ImgUrl *string `json:"img_url,omitempty"`

	// Username 表示名
	Username string `json:"username"`
}

Me defines model for me.

type MiddlewareFunc

type MiddlewareFunc func(c *gin.Context)

type N400BadRequest

type N400BadRequest struct {
	Code    *string `json:"code,omitempty"`
	Message *string `json:"message,omitempty"`
}

N400BadRequest defines model for 400-BadRequest.

type N401Unauthenticated

type N401Unauthenticated struct {
	Code    *string `json:"code,omitempty"`
	Message *string `json:"message,omitempty"`
}

N401Unauthenticated defines model for 401-Unauthenticated.

type PatchFollowingBody

type PatchFollowingBody struct {
	// DisplayName 友達の表示名
	DisplayName *string `json:"display_name,omitempty"`
}

PatchFollowingBody 更新対象のフィールドのみを含む json オブジェクト。

type PatchFollowingJSONRequestBody

type PatchFollowingJSONRequestBody = PatchFollowingBody

PatchFollowingJSONRequestBody defines body for PatchFollowing for application/json ContentType.

type PatchRoomJSONRequestBody

type PatchRoomJSONRequestBody = PostRoomBody

PatchRoomJSONRequestBody defines body for PatchRoom for application/json ContentType.

type PostLoginJSONRequestBody

type PostLoginJSONRequestBody = LoginBody

PostLoginJSONRequestBody defines body for PostLogin for application/json ContentType.

type PostMeBody

type PostMeBody struct {
	ImgUrl *string `json:"img_url,omitempty"`

	// Username 表示名
	Username *string `json:"username,omitempty"`
}

PostMeBody 更新対象のフィールドのみを含む json オブジェクト。

type PostMeJSONRequestBody

type PostMeJSONRequestBody = PostMeBody

PostMeJSONRequestBody defines body for PostMe for application/json ContentType.

type PostMessageBody

type PostMessageBody struct {
	// Content メッセージの内容。バイナリデータは base64 エンコードする。
	Content string `json:"content"`

	// Type メッセージの種類
	Type string `json:"type"`

	// UserId 作成するユーザーの ID
	UserId openapi_types.UUID `json:"user_id"`
}

PostMessageBody 新規メッセージを作成をするための request body。

type PostMessageJSONRequestBody

type PostMessageJSONRequestBody = PostMessageBody

PostMessageJSONRequestBody defines body for PostMessage for application/json ContentType.

type PostRoomBody

type PostRoomBody struct {
	// Name ルーム名
	Name *string `json:"name,omitempty"`

	// UserId 作成するユーザー ID
	UserId openapi_types.UUID `json:"user_id"`
}

PostRoomBody 新規ルーム作成をするための request body。

type PostRoomJSONRequestBody

type PostRoomJSONRequestBody = PostRoomBody

PostRoomJSONRequestBody defines body for PostRoom for application/json ContentType.

type Room

type Room struct {
	// Count メッセージの未読数
	Count *int `json:"count,omitempty"`

	// Id ルーム ID
	Id openapi_types.UUID `json:"id"`

	// LatestMessage 最新のメッセージ(1件)を表示する
	LatestMessage *struct {
		// Content メッセージの内容
		Content *string `json:"content,omitempty"`

		// Timestamp メッセージの作成日時(ISO 8601 形式)
		Timestamp *string `json:"timestamp,omitempty"`
	} `json:"latest_message,omitempty"`

	// Name ルームの表示名
	Name *string `json:"name,omitempty"`
}

Room トークルームの情報

type RoomMessage

type RoomMessage struct {
	// Content メッセージの内容
	Content string `json:"content"`

	// Id メッセージ ID
	Id openapi_types.UUID `json:"id"`

	// Timestamp メッセージの投稿日時(ISO 8601 形式)
	Timestamp string `json:"timestamp"`

	// Type メッセージの種類
	Type string `json:"type"`

	// UserId 投稿者のユーザー ID
	UserId openapi_types.UUID `json:"user_id"`
}

RoomMessage ルームに投稿されたメッセージ情報

type RoomMessages

type RoomMessages struct {
	// Messages ルームでのメッセージ一覧
	Messages *[]RoomMessage `json:"messages,omitempty"`
}

RoomMessages defines model for room-messages.

type RoomUser

type RoomUser struct {
	// Id ユーザー ID
	Id openapi_types.UUID `json:"id"`

	// ImgUrl アイコン画像の URL
	ImgUrl *string `json:"img_url,omitempty"`

	// LastReadAt そのルームの内容を最後に確認した日時(ISO 8601 形式)
	LastReadAt *string `json:"last_read_at,omitempty"`

	// Username 表示名
	Username string `json:"username"`
}

RoomUser ユーザー(他者)の情報

type RoomUsers

type RoomUsers struct {
	// Users ルームに所属するユーザー一覧
	Users *[]RoomUser `json:"users,omitempty"`
}

RoomUsers defines model for room-users.

type Rooms

type Rooms struct {
	// Rooms ルーム一覧
	Rooms *[]Room `json:"rooms,omitempty"`
}

Rooms defines model for rooms.

type ServerInterface

type ServerInterface interface {
	// ログイン処理。
	// (POST /api/login)
	PostLogin(c *gin.Context)
	// 自分が参加しているルーム一覧。
	// (GET /api/rooms)
	GetRooms(c *gin.Context)
	// ルーム情報を更新する。
	// (PATCH /api/rooms)
	PatchRoom(c *gin.Context)
	// ルームを新規作成する。
	// (POST /api/rooms)
	PostRoom(c *gin.Context)
	// 指定したルームでの未読メッセージ一覧を取得する。
	// (GET /api/rooms/:roomID/messages)
	GetMessages(c *gin.Context, params GetMessagesParams)
	// 指定したルームに新着メッセージを投稿する。
	// (POST /api/rooms/:roomID/messages)
	PostMessage(c *gin.Context)
	// 指定したルームに所属するユーザー一覧。
	// (GET /api/rooms/:roomID/users)
	GetRoomUsers(c *gin.Context)
	// 友達追加されてるが、自分からは追加していないユーザー一覧。
	// (GET /api/users/followers)
	GetFollowers(c *gin.Context)
	// 自分が友達追加しているユーザー一覧。
	// (GET /api/users/following)
	GetFollowing(c *gin.Context)
	// 友達の情報を更新する。
	// (PATCH /api/users/following/{user_id})
	PatchFollowing(c *gin.Context, userId UserIdPath)
	// 他人のユーザーアカウントを友達に追加する。
	// (POST /api/users/following/{user_id})
	PostFollowing(c *gin.Context, userId UserIdPath)
	// ログインしている(セッションを発行した)ユーザーの情報を取得する。
	// (GET /api/users/me)
	GetMe(c *gin.Context)
	// ログインしている(セッションを発行した)ユーザーの情報を変更する。
	// (PATCH /api/users/me)
	PostMe(c *gin.Context)
	// 他人を友達追加するための検索(ユーザー ID を使用)。
	// (GET /api/users/{user_id})
	GetUserByID(c *gin.Context, userId UserIdPath)
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler            ServerInterface
	HandlerMiddlewares []MiddlewareFunc
	ErrorHandler       func(*gin.Context, error, int)
}

ServerInterfaceWrapper converts contexts to parameters.

func (*ServerInterfaceWrapper) GetFollowers

func (siw *ServerInterfaceWrapper) GetFollowers(c *gin.Context)

GetFollowers operation middleware

func (*ServerInterfaceWrapper) GetFollowing

func (siw *ServerInterfaceWrapper) GetFollowing(c *gin.Context)

GetFollowing operation middleware

func (*ServerInterfaceWrapper) GetMe

func (siw *ServerInterfaceWrapper) GetMe(c *gin.Context)

GetMe operation middleware

func (*ServerInterfaceWrapper) GetMessages

func (siw *ServerInterfaceWrapper) GetMessages(c *gin.Context)

GetMessages operation middleware

func (*ServerInterfaceWrapper) GetRoomUsers

func (siw *ServerInterfaceWrapper) GetRoomUsers(c *gin.Context)

GetRoomUsers operation middleware

func (*ServerInterfaceWrapper) GetRooms

func (siw *ServerInterfaceWrapper) GetRooms(c *gin.Context)

GetRooms operation middleware

func (*ServerInterfaceWrapper) GetUserByID

func (siw *ServerInterfaceWrapper) GetUserByID(c *gin.Context)

GetUserByID operation middleware

func (*ServerInterfaceWrapper) PatchFollowing

func (siw *ServerInterfaceWrapper) PatchFollowing(c *gin.Context)

PatchFollowing operation middleware

func (*ServerInterfaceWrapper) PatchRoom

func (siw *ServerInterfaceWrapper) PatchRoom(c *gin.Context)

PatchRoom operation middleware

func (*ServerInterfaceWrapper) PostFollowing

func (siw *ServerInterfaceWrapper) PostFollowing(c *gin.Context)

PostFollowing operation middleware

func (*ServerInterfaceWrapper) PostLogin

func (siw *ServerInterfaceWrapper) PostLogin(c *gin.Context)

PostLogin operation middleware

func (*ServerInterfaceWrapper) PostMe

func (siw *ServerInterfaceWrapper) PostMe(c *gin.Context)

PostMe operation middleware

func (*ServerInterfaceWrapper) PostMessage

func (siw *ServerInterfaceWrapper) PostMessage(c *gin.Context)

PostMessage operation middleware

func (*ServerInterfaceWrapper) PostRoom

func (siw *ServerInterfaceWrapper) PostRoom(c *gin.Context)

PostRoom operation middleware

type User

type User struct {
	// Id ユーザー ID
	Id openapi_types.UUID `json:"id"`

	// ImgUrl アイコン画像の URL
	ImgUrl *string `json:"img_url,omitempty"`

	// Username 表示名
	Username string `json:"username"`
}

User ユーザー(他者)の情報

type UserIdPath

type UserIdPath = openapi_types.UUID

UserIdPath ユーザー ID

type Users

type Users struct {
	// Users ユーザーの配列
	Users *[]User `json:"users,omitempty"`
}

Users defines model for users.

Jump to

Keyboard shortcuts

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