response

package
v0.0.0-...-e6240ef Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const ACCESS_DENIED = "ACCESS_DENIED"
View Source
const AUTH_FAILED = "AUTH_FAILED"
View Source
const INVALID_REQUEST = "INVALID_REQUEST"

Variables

This section is empty.

Functions

func APIAccessDeniedError

func APIAccessDeniedError(w http.ResponseWriter, r *http.Request, message string, details string)

func APIAuthError

func APIAuthError(w http.ResponseWriter, r *http.Request, message string)

func APIDomainErrorResponse

func APIDomainErrorResponse(w http.ResponseWriter, r *http.Request, err *domain.Error, code ...int)

func APIGenericErrorResponse

func APIGenericErrorResponse(w http.ResponseWriter, r *http.Request, key string, err error, code ...int)

func APISuccessResponse

func APISuccessResponse(w http.ResponseWriter, r *http.Request, data interface{}, code ...int)

func GetReqID

func GetReqID(ctx context.Context) string

func InvalidRequestError

func InvalidRequestError(w http.ResponseWriter, r *http.Request, err error, code ...int)

Types

type CreateNoteResponse

type CreateNoteResponse struct {
	ID string `json:"id"`
}

type Error

type Error struct {
	Code    int64          `json:"code" example:"4000"`
	Key     string         `json:"key" example:"VALIDATION_ERROR"`
	TraceID string         `json:"trace_id" example:"1a7b11aa-8abb-40a9-a369-74bdc23971e8"`
	Details []ErrorDetails `json:"details"`
}

type ErrorDetails

type ErrorDetails struct {
	Message  string      `json:"message"`
	Details  string      `json:"details"`
	Metadata interface{} `json:"metadata"`
}

type ErrorResponse

type ErrorResponse struct {
	Err            error `json:"-"`
	HTTPStatusCode int   `json:"-"`

	Error `json:"error"`
}

type GetNoteResponse

type GetNoteResponse struct {
	Note Note `json:"note"`
}

type GetNotesResponse

type GetNotesResponse struct {
	Notes []Note `json:"notes"`
}

type LoginResponse

type LoginResponse struct {
	AccessToken string `json:"access_token"`
}

type Note

type Note struct {
	UUID         string    `json:"note_id"`
	Title        string    `json:"title"`
	Content      string    `json:"content"`
	Archived     bool      `json:"archived"`
	UserEmail    string    `json:"user_email"`
	CreatedTime  time.Time `json:"created_time"`
	ModifiedTime time.Time `json:"modified_time"`
}

Jump to

Keyboard shortcuts

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