response

package
v0.0.0-...-1c0d007 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BadRequest = &ErrorResponse{
		StatusCode: http.StatusBadRequest,
		Message:    "不正なパラメータが入力されています。",
	}

	Unauthorized = &ErrorResponse{
		StatusCode:       http.StatusUnauthorized,
		Message:          "認証に必要な情報がありません。",
		ValidationErrors: nil,
	}

	Forbidden = &ErrorResponse{
		StatusCode:       http.StatusForbidden,
		Message:          "その操作を実行する権限がありません。",
		ValidationErrors: nil,
	}

	NotFound = &ErrorResponse{
		StatusCode:       http.StatusNotFound,
		Message:          "指定の情報が見つかりません。",
		ValidationErrors: nil,
	}

	AlreadyExists = &ErrorResponse{
		StatusCode: http.StatusConflict,
		Message:    "不正なパラメータが入力されています。",
	}

	InternalServerError = &ErrorResponse{
		StatusCode:       http.StatusInternalServerError,
		Message:          "異常な処理が検出されました。",
		ValidationErrors: nil,
	}
)

ステータスコードを付与したエラーレスポンス

Functions

This section is empty.

Types

type ErrorResponse

type ErrorResponse struct {
	StatusCode       int                `json:"status"`
	ErrorCode        domain.ErrorCode   `json:"code"`
	Message          string             `json:"message"`
	ValidationErrors []*ValidationError `json:"errors,omitempty"`
}

ErrorResponse - エラーのレスポンス

type Group

type Group struct {
	ID            string    `json:"id"`
	Name          string    `json:"name"`
	UserIDs       []string  `json:"userIds"`
	BoardIDs      []string  `json:"boardIds"`
	InvitedEmails []string  `json:"invitedEmails"`
	Description   string    `json:"description"`
	CreatedAt     time.Time `firestore:"createdAt"`
	UpdatedAt     time.Time `firestore:"updatedAt"`
}

Group - グループのレスポンス

type Groups

type Groups struct {
	Groups []*Group `json:"groups"`
}

Groups - グループ一覧のレスポンス

type ValidationError

type ValidationError struct {
	Field   string `json:"field"`
	Message string `json:"message"`
}

ValidationError - バリデーションエラーのレスポンス

Jump to

Keyboard shortcuts

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