structs

package
v2.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2019 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DetailData

type DetailData struct {
	ID string `json:"id"`
	EN string `json:"en"`
}

DetailData defines details data response

type ErrorData

type ErrorData struct {
	Details DetailData `json:"details"`
}

ErrorData defines error data response

type ErrorResponse

type ErrorResponse struct {
	APICode    string    `json:"api_code"`
	HTTPStatus int       `json:"-"`
	Errors     ErrorData `json:"errors,omitempty"`
}

error Response

var ErrUnauthorized *ErrorResponse = &ErrorResponse{
	APICode:    "000001",
	HTTPStatus: http.StatusUnauthorized,
	Errors: ErrorData{
		Details: DetailData{
			ID: "Anda tidak diijinkan",
			EN: "You are not authorized",
		},
	},
}
var ErrUnknown *ErrorResponse = &ErrorResponse{
	APICode:    "000001",
	HTTPStatus: http.StatusInternalServerError,
	Errors: ErrorData{
		Details: DetailData{
			ID: "Ups ada kesalahan, silahkan coba beberapa saat lagi",
			EN: "Unknown error",
		},
	},
}

func (*ErrorResponse) Error

func (e *ErrorResponse) Error() string

type Meta

type Meta struct {
	Version string `json:"version"`
	Status  string `json:"api_status"`
	APIEnv  string `json:"api_env"`
}

Meta defines meta format format for api format

type Response

type Response struct {
	Resp interface{} `json:"response"`
	Meta Meta        `json:"meta"`
}

type SuccessResponse

type SuccessResponse struct {
	APICode string      `json:"api_code"`
	Next    *string     `json:"next,omitempty"`
	Data    interface{} `json:"data"`
}

Jump to

Keyboard shortcuts

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