structs

package
v2.31.0 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2021 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 ErrorResponse

type ErrorResponse struct {
	Response
	HttpStatus int `json:"-"`
}

error Response

var ErrInvalidHeader *ErrorResponse = &ErrorResponse{
	Response: Response{
		ResponseCode: "00003",
		ResponseDesc: ResponseDesc{
			ID: "Header tidak valid atau tidak lengkap",
			EN: "Invalid/incomplete header",
		},
	},
	HttpStatus: http.StatusBadRequest,
}
var ErrInvalidHeaderSignature *ErrorResponse = &ErrorResponse{
	Response: Response{
		ResponseCode: "00004",
		ResponseDesc: ResponseDesc{
			ID: "Header signature tidak valid",
			EN: "Invalid header signature",
		},
	},
	HttpStatus: http.StatusBadRequest,
}
var ErrInvalidHeaderTime *ErrorResponse = &ErrorResponse{
	Response: Response{
		ResponseCode: "00005",
		ResponseDesc: ResponseDesc{
			ID: "Request sudah kedaluwarsa",
			EN: "Request already expired",
		},
	},
	HttpStatus: http.StatusBadRequest,
}
var ErrUnauthorized *ErrorResponse = &ErrorResponse{
	Response: Response{
		ResponseCode: "00002",
		ResponseDesc: ResponseDesc{
			ID: "Anda tidak diijinkan",
			EN: "You are not authorized",
		},
	},
	HttpStatus: http.StatusUnauthorized,
}
var ErrUnknown *ErrorResponse = &ErrorResponse{
	Response: Response{
		ResponseCode: "00001",
		ResponseDesc: ResponseDesc{
			ID: "Ups ada kesalahan, silahkan coba beberapa saat lagi",
			EN: "Unknown error",
		},
	},
	HttpStatus: http.StatusInternalServerError,
}

func (*ErrorResponse) Error

func (e *ErrorResponse) Error() string

type Meta

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

Meta defines meta format format for api format

type Response

type Response struct {
	ResponseCode string       `json:"response_code" mapstructure:"response_code"`
	ResponseDesc ResponseDesc `json:"response_desc" mapstructure:"response_desc"`
	Meta         Meta         `json:"meta" mapstructure:"meta"`
}

type ResponseDesc added in v2.6.0

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

ResponseDesc defines details data response

type SuccessResponse

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

Jump to

Keyboard shortcuts

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