-
Notifications
You must be signed in to change notification settings - Fork 3
feature: Define and implement Provider interface for providers package #5
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or request
Description
feature: Define and implement Provider interface for providers package
Summary:
Implement Provider interface in the providers package. This interface will provide methods for interacting with various weather data providers.
Package providers must offer an interface and a factory method for weather data providers. This package is designed to facilitate the integration of various weather data providers by defining a common interface that each provider must implement. It may include a factory method to instantiate the appropriate provider based on a given name.
The main components of this package would be(Preemptively. This may change):
- Provider interface: Defines the methods that each provider must implement.
- NewProvider function: A factory method that returns the appropriate provider based on the name.
Expected usage:
provider, err := providers.NewProvider("open-meteo")
if err != nil {
log.Fatal(err)
}
data, err := provider.FetchData(queryParams)
if err != nil {
log.Fatal(err)
}Details:
-
Interface Description:
Providerinterface:package providers type Provider interface { FetchData(queryParams map[string]string) (*plumber.BaseData, error) }
-
Package Description:
- This package will include methods to retrieve data from different weather data providers.
-
Outcome:
- Provide a standardized way to interact with various weather data providers.
- Facilitate easier integration and swapping of different providers in the future.
- Seamlessly merge API response from multiple providers to realize the required set of plumber.BaseData fields.
-
Dependencies:
- No external dependencies apart from the obvious third party API providers
- Ensure compatibility with existing packages that interact with weather data providers.
-
Acceptance Criteria:
- Implement the
FetchDatamethod in the new package. More may be added as necessary. - Update documentation to include usage examples and integration guidelines.
- Write unit tests to verify the functionality of the new package. [deferring this for this package til testing modules are implemented for other simpler packages]
- Implement the
-
Additional Information:
- Consider future extensions to support additional weather data providers.
- Establish the essential meteo parameters that aren't yet included in plumber.BaseData that's pulled from various providers
- Ensure the package is designed to be easily extensible for new provider implementations.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request