Documentation
¶
Overview ¶
Code generated by MockGen. DO NOT EDIT. Source: github.com/devinyf/dashscopego/httpclient (interfaces: IHttpClient)
Generated by this command:
mockgen -destination=http_client_mock.go -package=httpclient . IHttpClient
Package httpclient is a generated GoMock package.
Index ¶
- Variables
- func NetworkStatus() (bool, error)
- type EmptyRequestBodyError
- type HTTPCli
- func (c *HTTPCli) EncodeJSONBody(body interface{}) (*bytes.Buffer, error)
- func (c *HTTPCli) Get(ctx context.Context, urll string, params map[string]string, ...) error
- func (c *HTTPCli) GetImage(ctx context.Context, imgURL string, options ...ReqOption) ([]byte, error)
- func (c *HTTPCli) Post(ctx context.Context, urll string, reqbody interface{}, respbody interface{}, ...) error
- func (c *HTTPCli) PostSSE(ctx context.Context, urll string, reqbody interface{}, options ...ReqOption) (chan string, error)
- func (c *HTTPCli) WithTimeout(timeout time.Duration)
- type HTTPRequestError
- type HeaderMap
- type IHttpClient
- type IWsClient
- type MockIHttpClient
- func (m *MockIHttpClient) EXPECT() *MockIHttpClientMockRecorder
- func (m *MockIHttpClient) Get(arg0 context.Context, arg1 string, arg2 map[string]string, arg3 any, ...) error
- func (m *MockIHttpClient) GetImage(arg0 context.Context, arg1 string, arg2 ...ReqOption) ([]byte, error)
- func (m *MockIHttpClient) Post(arg0 context.Context, arg1 string, arg2, arg3 any, arg4 ...ReqOption) error
- func (m *MockIHttpClient) PostSSE(arg0 context.Context, arg1 string, arg2 any, arg3 ...ReqOption) (chan string, error)
- type MockIHttpClientMockRecorder
- func (mr *MockIHttpClientMockRecorder) Get(arg0, arg1, arg2, arg3 any, arg4 ...any) *gomock.Call
- func (mr *MockIHttpClientMockRecorder) GetImage(arg0, arg1 any, arg2 ...any) *gomock.Call
- func (mr *MockIHttpClientMockRecorder) Post(arg0, arg1, arg2, arg3 any, arg4 ...any) *gomock.Call
- func (mr *MockIHttpClientMockRecorder) PostSSE(arg0, arg1, arg2 any, arg3 ...any) *gomock.Call
- type ReqOption
- type WrapMessageError
- type WsClient
- type WsMessage
Constants ¶
This section is empty.
Variables ¶
var ErrNetwork = errors.New("network error")
Functions ¶
func NetworkStatus ¶
Types ¶
type EmptyRequestBodyError ¶
type EmptyRequestBodyError struct {
Method string
}
func (*EmptyRequestBodyError) Error ¶
func (e *EmptyRequestBodyError) Error() string
type HTTPCli ¶
type HTTPCli struct {
// contains filtered or unexported fields
}
func NewHTTPClient ¶
func NewHTTPClient() *HTTPCli
func (*HTTPCli) EncodeJSONBody ¶
func (*HTTPCli) Post ¶
func (c *HTTPCli) Post(ctx context.Context, urll string, reqbody interface{}, respbody interface{}, options ...ReqOption) error
nolint:lll
func (*HTTPCli) PostSSE ¶
func (c *HTTPCli) PostSSE(ctx context.Context, urll string, reqbody interface{}, options ...ReqOption) (chan string, error)
nolint:lll
func (*HTTPCli) WithTimeout ¶ added in v0.1.2
type HTTPRequestError ¶
func (*HTTPRequestError) Error ¶
func (e *HTTPRequestError) Error() string
type IHttpClient ¶
type IHttpClient interface {
PostSSE(ctx context.Context, urll string, reqbody interface{}, options ...ReqOption) (chan string, error)
Post(ctx context.Context, urll string, reqbody interface{}, resp interface{}, options ...ReqOption) error
Get(ctx context.Context, urll string, params map[string]string, resp interface{}, options ...ReqOption) error
GetImage(ctx context.Context, imgURL string, options ...ReqOption) ([]byte, error)
}
type MockIHttpClient ¶
type MockIHttpClient struct {
// contains filtered or unexported fields
}
MockIHttpClient is a mock of IHttpClient interface.
func NewMockIHttpClient ¶
func NewMockIHttpClient(ctrl *gomock.Controller) *MockIHttpClient
NewMockIHttpClient creates a new mock instance.
func (*MockIHttpClient) EXPECT ¶
func (m *MockIHttpClient) EXPECT() *MockIHttpClientMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockIHttpClient) Get ¶
func (m *MockIHttpClient) Get(arg0 context.Context, arg1 string, arg2 map[string]string, arg3 any, arg4 ...ReqOption) error
Get mocks base method.
func (*MockIHttpClient) GetImage ¶
func (m *MockIHttpClient) GetImage(arg0 context.Context, arg1 string, arg2 ...ReqOption) ([]byte, error)
GetImage mocks base method.
type MockIHttpClientMockRecorder ¶
type MockIHttpClientMockRecorder struct {
// contains filtered or unexported fields
}
MockIHttpClientMockRecorder is the mock recorder for MockIHttpClient.
func (*MockIHttpClientMockRecorder) Get ¶
func (mr *MockIHttpClientMockRecorder) Get(arg0, arg1, arg2, arg3 any, arg4 ...any) *gomock.Call
Get indicates an expected call of Get.
func (*MockIHttpClientMockRecorder) GetImage ¶
func (mr *MockIHttpClientMockRecorder) GetImage(arg0, arg1 any, arg2 ...any) *gomock.Call
GetImage indicates an expected call of GetImage.
type ReqOption ¶ added in v0.1.2
func WithHeader ¶
func WithStream ¶
func WithStream() ReqOption
func WithTokenHeaderOption ¶
type WrapMessageError ¶
func (*WrapMessageError) Error ¶
func (e *WrapMessageError) Error() string
type WsClient ¶
type WsClient struct {
URL string
Headers http.Header
Conn *websocket.Conn
Over bool
CancelFn context.CancelFunc
// contains filtered or unexported fields
}
Client represents a websocket client.
func (*WsClient) CloseClient ¶
func (*WsClient) ConnClient ¶
StartClient starts the client operation.