enum

package
v0.0.0-...-946920c Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBadRequest = &ErrorResponse{
		BaseResponse: BuildBaseResponse(StatusError),
		Message:      "Invalid request format",
	}
	ErrConflict = &ErrorResponse{
		BaseResponse: BuildBaseResponse(StatusError),
		Message:      "Entity already exists",
	}
	ErrForbidden = &ErrorResponse{
		BaseResponse: BuildBaseResponse(StatusError),
		Message:      "Forbidden",
	}
	ErrInternalServer = &ErrorResponse{
		BaseResponse: BuildBaseResponse(StatusError),
		Message:      "Unable to process request",
	}
	ErrInvalidAPIKey = &ErrorResponse{
		BaseResponse: BuildBaseResponse(StatusError),
		Message:      "API key is invaild or expired",
	}
	ErrNotFound = &ErrorResponse{
		BaseResponse: BuildBaseResponse(StatusError),
		Message:      "Resource not found",
	}
	ErrUnauthorized = &ErrorResponse{
		BaseResponse: BuildBaseResponse(StatusError),
		Message:      "Tenant not authorized for this service",
	}
	ErrUnsupportedContentType = &ErrorResponse{
		BaseResponse: BuildBaseResponse(StatusError),
		Message:      "Unsupported Content-Type",
	}
)

Functions

This section is empty.

Types

type BaseResponse

type BaseResponse struct {
	RequestID string `json:"requestId" example:"api_1234567890abcdef"`
	// Status indicates the result of the operation ("success" or "error")
	Status string `json:"status" example:"success"`
}

func BuildBaseResponse

func BuildBaseResponse(status Status) BaseResponse

type ErrorResponse

type ErrorResponse struct {
	BaseResponse
	Message string `json:"message,omitempty"`
}

func (*ErrorResponse) WithMessage

func (e *ErrorResponse) WithMessage(message string) *ErrorResponse

type Status

type Status string
const (
	StatusError          Status = "error"
	StatusPartialSuccess Status = "partial success"
	StatusProcessing     Status = "processing"
	StatusSuccess        Status = "success"
	StatusWarning        Status = "warning"
)

Jump to

Keyboard shortcuts

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