Documentation ¶
Overview ¶
Code generated by protoc-gen-go-httpsdk. DO NOT EDIT.
Code generated by protoc-gen-go-httpsdk. DO NOT EDIT.
Code generated by protoc-gen-go-httpsdk. DO NOT EDIT.
Index ¶
- type Interface
- type Opt
- func WithAddr(addr string) Opt
- func WithClient(client *http.Client) Opt
- func WithGatewayPrefix(prefix string) Opt
- func WithHeaders(headers http.Header) Opt
- func WithPort(port string) Opt
- func WithProtocol(protocol string) Opt
- func WithRetryDelay(time time.Duration) Opt
- func WithRetryTimes(times int) Opt
- type PathParam
- type QueryParam
- type RESTClient
- type Request
- func (r *Request) Body(obj interface{}) *Request
- func (r *Request) Do(ctx context.Context) Result
- func (r *Request) DoUpload(ctx context.Context, fieldName string, filename string, filedata []byte) Result
- func (r *Request) Params(args ...QueryParam) *Request
- func (r *Request) Stream(ctx context.Context) (io.ReadCloser, error)
- func (r *Request) SubPath(subPath string, args ...PathParam) *Request
- func (r *Request) Verb(verb string) *Request
- func (r *Request) WsConn(ctx context.Context) (*websocket.Conn, *http.Response, error)
- type Result
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Opt ¶
type Opt func(client *RESTClient) error
func WithClient ¶
func WithGatewayPrefix ¶
func WithHeaders ¶
func WithProtocol ¶
func WithRetryDelay ¶
func WithRetryTimes ¶
type QueryParam ¶
type QueryParam struct { Name string Value interface{} }
type RESTClient ¶
type RESTClient struct {
// contains filtered or unexported fields
}
func RESTClientFor ¶
func RESTClientFor(config *RESTClient) (*RESTClient, error)
func (*RESTClient) Get ¶
func (r *RESTClient) Get() *Request
func (*RESTClient) Post ¶
func (r *RESTClient) Post() *Request
func (*RESTClient) Verb ¶
func (r *RESTClient) Verb(verb string) *Request
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
Request allows for building up a request to a server in a chained fashion. Any errors are stored until the end of your call, so you only have to check once.
func NewRequest ¶
func NewRequest(c *RESTClient) *Request
func (*Request) Body ¶
Body makes the request use obj as the body. Optional. If obj is a string, try to read a file of that name. If obj is a []byte, send it directly. default marshal it
func (*Request) Do ¶
Do format and executes the request. Returns a Result object for easy response processing.
Error type:
- http.Client.Do errors are returned directly.
func (*Request) DoUpload ¶
func (r *Request) DoUpload(ctx context.Context, fieldName string, filename string, filedata []byte) Result
DoUpload format and executes the upload request. Returns a Result object for easy response processing.
Error type:
- http.Client.Do errors are returned directly.
func (*Request) Params ¶
func (r *Request) Params(args ...QueryParam) *Request
type Result ¶
type Result struct {
// contains filtered or unexported fields
}
Result contains the result of calling Request.Do().
func (Result) RawResponse ¶
func (Result) StatusCode ¶
StatusCode returns the HTTP status code of the request. (Only valid if no error was returned.)