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 ...HTTPOption) ([]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 ...HTTPOption) (chan string, error)
- type HTTPOption
- 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 ...HTTPOption) ([]byte, error)
- func (m *MockIHttpClient) Post(arg0 context.Context, arg1 string, arg2, arg3 any, arg4 ...HTTPOption) error
- func (m *MockIHttpClient) PostSSE(arg0 context.Context, arg1 string, arg2 any, arg3 ...HTTPOption) (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 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 ¶
type HTTPOption ¶
type HTTPOption func(c *HTTPCli)
func WithHeader ¶
func WithHeader(header HeaderMap) HTTPOption
func WithStream ¶
func WithStream() HTTPOption
func WithTimeout ¶
func WithTimeout(timeout time.Duration) HTTPOption
func WithTokenHeaderOption ¶
func WithTokenHeaderOption(token string) HTTPOption
type HTTPRequestError ¶
func (*HTTPRequestError) Error ¶
func (e *HTTPRequestError) Error() string
type IHttpClient ¶
type IHttpClient interface { PostSSE(ctx context.Context, urll string, reqbody interface{}, options ...HTTPOption) (chan string, error) Post(ctx context.Context, urll string, reqbody interface{}, resp interface{}, options ...HTTPOption) error Get(ctx context.Context, urll string, params map[string]string, resp interface{}, options ...HTTPOption) error GetImage(ctx context.Context, imgURL string, options ...HTTPOption) ([]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 ...HTTPOption) error
Get mocks base method.
func (*MockIHttpClient) GetImage ¶
func (m *MockIHttpClient) GetImage(arg0 context.Context, arg1 string, arg2 ...HTTPOption) ([]byte, error)
GetImage mocks base method.
func (*MockIHttpClient) Post ¶
func (m *MockIHttpClient) Post(arg0 context.Context, arg1 string, arg2, arg3 any, arg4 ...HTTPOption) error
Post mocks base method.
func (*MockIHttpClient) PostSSE ¶
func (m *MockIHttpClient) PostSSE(arg0 context.Context, arg1 string, arg2 any, arg3 ...HTTPOption) (chan string, error)
PostSSE 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 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.