Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewHttpClient ¶
func NewHttpClient(o ...HttpClientOption) *http.Client
Types ¶
type APIWeatherClient ¶
type APIWeatherClient struct {
// contains filtered or unexported fields
}
func (*APIWeatherClient) GetByCity ¶
func (api *APIWeatherClient) GetByCity(ctx context.Context, city string) (*dto.WeatherByCity, error)
type AstroAPIClient ¶
type AstroAPIClient struct {
// contains filtered or unexported fields
}
func (*AstroAPIClient) GetByCity ¶
func (api *AstroAPIClient) GetByCity(ctx context.Context, city string) (*dto.AstroByCity, error)
type AstroApiErr ¶
AstroApiErr represents an error response from the OpenWeather API.
func (AstroApiErr) Error ¶
func (w AstroApiErr) Error() string
type AstroClient ¶
type AstroClient interface {
GetByCity(ctx context.Context, city string) (*dto.AstroByCity, error)
}
func NewAstroAPIClient ¶
func NewAstroAPIClient(openWeatherBaseURL, openWeatherApiKey string) AstroClient
type HttpClientOption ¶
func WithTimeout ¶
func WithTimeout(timeout time.Duration) HttpClientOption
type MockAstroClient ¶
type MockAstroClient struct {
Response *dto.AstroByCity
Error error
}
func NewMockAstroClient ¶
func NewMockAstroClient(err error) *MockAstroClient
func (*MockAstroClient) GetByCity ¶
func (m *MockAstroClient) GetByCity(_ context.Context, _ string) (*dto.AstroByCity, error)
type MockWeatherClient ¶
type MockWeatherClient struct {
Response *dto.WeatherByCity
Error error
Delay time.Duration
}
func NewMockWeatherClient ¶
func NewMockWeatherClient(err error, delay time.Duration) *MockWeatherClient
func (*MockWeatherClient) GetByCity ¶
func (m *MockWeatherClient) GetByCity(ctx context.Context, _ string) (*dto.WeatherByCity, error)
type WeatherApiErr ¶
type WeatherApiErr struct {
Err struct {
Code int `json:"code"`
Message string `json:"message"`
} `json:"error"`
}
WeatherApiErr code: 1006 No matching location found
func (WeatherApiErr) Error ¶
func (w WeatherApiErr) Error() string
type WeatherClient ¶
type WeatherClient interface {
GetByCity(ctx context.Context, city string) (*dto.WeatherByCity, error)
}
func NewWeatherAPIClient ¶
func NewWeatherAPIClient(weatherBaseURL, weatherApiKey string) WeatherClient
Click to show internal directories.
Click to hide internal directories.