transportation

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	STATUS_CODE_OK                  = 1000
	STATUS_CODE_CLIENT_ERROR        = 2000
	STATUS_CODE_MISSING_PARAMS      = 2001
	STATUS_CODE_NOT_ENOUGH_INFO     = 2002
	STATUS_CODE_UNKNOWN_RESOURCE    = 2003
	STATUS_CODE_SERVER_ERROR        = 3000
	STATUS_CODE_REGISTRATION_ERROR  = 3001
	STATUS_CODE_UNSUPPORTED_VERSION = 3002
	STATUS_CODE_MISSING_ENDPOINTS   = 3003
)

Variables

This section is empty.

Functions

func GetXLimitHeader

func GetXLimitHeader(r *http.Response, defaultXLimit int) int

Types

type HTTPRequester

type HTTPRequester interface {
	Do(req *http.Request) (*http.Response, error)
}

type OcpiRequestHeader

type OcpiRequestHeader struct {
	Authorization *string
	ToCountryCode *string
	ToPartyId     *string
}

func NewOcpiRequestHeader

func NewOcpiRequestHeader(token *string, countryCode *string, partyID *string) OcpiRequestHeader

type OcpiResponse

type OcpiResponse struct {
	Data          interface{}   `json:"data,omitempty"`
	StatusCode    int16         `json:"status_code"`
	StatusMessage string        `json:"status_message"`
	Timestamp     ocpitype.Time `json:"timestamp"`
}

func OcpiClientError

func OcpiClientError(data interface{}, message string) *OcpiResponse

func OcpiErrorMissingParameters

func OcpiErrorMissingParameters(data interface{}) *OcpiResponse

func OcpiErrorNotEnoughInformation

func OcpiErrorNotEnoughInformation(data interface{}) *OcpiResponse

func OcpiErrorUnknownResource

func OcpiErrorUnknownResource(data interface{}) *OcpiResponse

func OcpiMissingEndpoints

func OcpiMissingEndpoints(data interface{}) *OcpiResponse

func OcpiRegistrationError

func OcpiRegistrationError(data interface{}) *OcpiResponse

func OcpiServerError

func OcpiServerError(data interface{}, message string) *OcpiResponse

func OcpiSuccess

func OcpiSuccess(data interface{}) *OcpiResponse

func OcpiUnsupportedVersion

func OcpiUnsupportedVersion(data interface{}) *OcpiResponse

func UnmarshalResponseDto

func UnmarshalResponseDto(body io.ReadCloser) (*OcpiResponse, error)

func (*OcpiResponse) Error

func (response *OcpiResponse) Error() string

func (*OcpiResponse) Render

func (response *OcpiResponse) Render(writer http.ResponseWriter, request *http.Request) error

type OcpiService added in v0.3.1

type OcpiService struct {
	HTTPRequester
}

func NewOcpiService added in v0.3.1

func NewOcpiService() *OcpiService

func (*OcpiService) Do added in v0.3.1

func (r *OcpiService) Do(method, url string, header OcpiRequestHeader, body io.Reader) (*http.Response, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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