Skip to content

feature: Define and implement Provider interface for providers package #5

@raamsri

Description

@raamsri

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:

  1. Interface Description:
    Provider interface:

    package providers
    
    type Provider interface {
         FetchData(queryParams map[string]string) (*plumber.BaseData, error)
    }
  2. Package Description:

    • This package will include methods to retrieve data from different weather data providers.
  3. 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.
  4. Dependencies:

    • No external dependencies apart from the obvious third party API providers
    • Ensure compatibility with existing packages that interact with weather data providers.
  5. Acceptance Criteria:

    • Implement the FetchData method 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]
  6. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions