Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve and refactor Github client #1318

Open
mpgxvii opened this issue Jul 8, 2021 · 1 comment
Open

Improve and refactor Github client #1318

mpgxvii opened this issue Jul 8, 2021 · 1 comment

Comments

@mpgxvii
Copy link
Member

mpgxvii commented Jul 8, 2021

Currently, we have 2 Github fetch strategies from Github:

  1. Default (pulling directly from Github through an unauthenticated HTTP request) and
  2. App Server (making a request to the Appserver which will make an authenticated HTTP request to Github)

However, the current implementation is simple and not easily extensible. In order to have more structure and flexibility, we can:

  1. Have a base class QuestionnaireFetchStrategy with abstract functions getRaw() or just get() and getContent() and any other you think will be useful. Then the concrete classes can be GithubQuestionnaireFetchStrategy and AppSeverQuestionnaireFetchStrategy. So if later we use app-config, you can just add a new class extending this strategy base class. Also, instead of GithubClient, it can be called QuestionnaireFetcher or something like that.

  2. An alternative approach would be to make it specific based on protocol and definitions. So then you can change how each is pulled, then the base class QuestionnaireFetchStrategy can have abstract functions getDefinitions() and getProtocols(). But this will be a bigger refactor.

@mpgxvii
Copy link
Member Author

mpgxvii commented Jul 8, 2021

Personally, I prefer the second approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant