Documentation
¶
Overview ¶
A simple Golang REST api library.
Index ¶
- Constants
- type Api
- func (t *Api) Body() *string
- func (t *Api) Del() *Api
- func (t *Api) Do() *Api
- func (t *Api) Err() *string
- func (t *Api) Get() *Api
- func (t *Api) New(property *Property) *Api
- func (t *Api) Ok() bool
- func (t *Api) Output() *string
- func (t *Api) Patch() *Api
- func (t *Api) Post() *Api
- func (t *Api) ProcessError() *Api
- func (t *Api) ProcessOutput() *Api
- func (t *Api) ProcessOutputError() *Api
- func (t *Api) Put() *Api
- func (t *Api) SetDel() *Api
- func (t *Api) SetGet() *Api
- func (t *Api) SetPatch() *Api
- func (t *Api) SetPost() *Api
- func (t *Api) SetPut() *Api
- type Err
- type IInfo
- type Property
- type Req
- type Res
Constants ¶
View Source
const (
Version = "v1.0.1"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Api ¶
type Api struct { *Property Req *Req `json:"Req,omitempty"` Res *Res `json:"Res,omitempty"` // contains filtered or unexported fields }
Api
func (*Api) Do ¶
Execute http request using info in Api.Req. Then put response info in Api.Res.
Api.Info, if not nil, will be - auto marshal for send other than "GET" - auto unmarshal from http response body
func (*Api) ProcessError ¶
Print HTTP Body Err into string pointer
func (*Api) ProcessOutputError ¶
Print HTTP Body into string pointer
type Err ¶
type Err struct { Errors string `json:"Errors,omitempty"` // Used by Gitea Message string `json:"Message"` Status string `json:"Status,omitempty"` // Used by Github }
Github uses message and status. Gitea uses message and errors.
type Req ¶
type Req struct { EntryPoint string `json:"Entrypoint"` // Api base url Endpoint string `json:"Endpoint"` // Api endpoint Token string `json:"Token"` // Api auth token Header *http.Header `json:"Header"` // Http request header UrlVal *url.Values `json:"UrlVal"` // Api url values Data string `json:"Data"` // Json marshaled Info }
GitApi http input structure
type Res ¶
type Res struct { Body *[]byte `json:"Body"` Err string `json:"Err"` Header *http.Header `json:"Header"` // Http response header Output *string `json:"Output"` // Api response body in string Status string `json:"Status"` // Http response status Url *url.URL `json:"Url"` // In.Uri + In.Endpoint }
GitApi http output structure
Click to show internal directories.
Click to hide internal directories.