mardi 15 décembre 2020

Strategy pattern to consume REST API

I have to consume two different REST API providers about VoIP. Both API do the same with different endpoints and parameters. I'm modeling classes as strategy pattern and the problem that i have encountered is the parameters of each method strategy because are different.

    public interface VoIPRequests
    {
        string ApiKey { get; set; }

        string GetExtensionsList();
        string TriggerCall();
        string DropCall();
        string RedirectCall();
    }

How can i change parameters for each of this methods depend on the implementation?. It's good idea use strategy pattern for this case? There is another pattern that suits better? Thank you.

Aucun commentaire:

Enregistrer un commentaire