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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃毀Improve GitHubClient setup and usage #19

Closed
16 tasks done
CalvinWilkinson opened this issue Sep 25, 2022 · 0 comments 路 Fixed by #20
Closed
16 tasks done

馃毀Improve GitHubClient setup and usage #19

CalvinWilkinson opened this issue Sep 25, 2022 · 0 comments 路 Fixed by #20
Assignees
Labels
high priority High Priority 鉁╪ew feature New feature that does not exist preview Done while in preview

Comments

@CalvinWilkinson
Copy link
Member

CalvinWilkinson commented Sep 25, 2022

Complete The Item Below

  • I have updated the title without removing the 馃毀 emoji.

Description

Improve the GitHubClient setup and usage throughout the project.

Currently, the setup of the GitHubClient is not ideal when trying to make authorized GitHub API requests when running targets that use the GitHub API. To try and solve this issue, the LoadSecrestService was created to load a token to be used for setting up the GitHubClient for authorized requests. This needs to be put into use.

Create a new service called GitHubClientService that is used to create a GitHubClient object that is set up with a token for authorized requests. The new GitHubClientService will inject and use the LoadSecretsService to load the token from the disk.

The GitHubClientService and LoadSecretsService should also be set up with SimpleInjector so they can be easily consumed. The GitHubClientService should be set up in the IoC container as a singleton.

The GitHubClient property will be a readonly property that uses the GitHubClientService every time it is requested. The service will lazy load/create the internal client object/field. Every subsequent request into the service will check if the field is null and if it is not, simply return a reference of the field.

Acceptance Criteria

  • LoadSecretsService changes
    • Create an interface for the service for setup for the IoC container
    • Refactor the main implementation code to be able to use System.IO.Abstractions
    • Create unit tests for the LoadSecretsService class
  • Create new GitHubClientService service
  • Convert the GitHubClient from a private static field to a private property with a getter
    • The getter will call out to the GitHubClientService service to get the client
  • LoadSecretsService name refactored to SecretService
    • Refactor all var and param names to appropriate names
  • If the loaded secret is null or empty, throw an exception

ToDo Items

  • Change type labels added to this issue. Refer to the Change Type Labels section below.
  • Priority label added to this issue. Refer to the Priority Type Labels section below.
  • Issue linked to the correct project (if applicable).
  • Issue linked to the correct milestone (if applicable).
  • Draft pull request created and linked to this issue (only required with code changes).

Issue Dependencies

No response

Related Work

No response

Additional Information:

Change Type Labels

Change Type Label
Bug Fixes 馃悰bug
Breaking Changes 馃Жbreaking changes
New Feature 鉁╪ew feature
Workflow Changes workflow
Code Doc Changes 馃棐锔廳ocumentation/code
Product Doc Changes 馃摑documentation/product

Priority Type Labels

Priority Type Label
Low Priority low priority
Medium Priority medium priority
High Priority high priority

Code of Conduct

  • I agree to follow this project's Code of Conduct.
@CalvinWilkinson CalvinWilkinson added high priority High Priority preview Done while in preview 鉁╪ew feature New feature that does not exist labels Sep 25, 2022
@CalvinWilkinson CalvinWilkinson added this to the v1.0.0-preview.4 milestone Sep 25, 2022
@CalvinWilkinson CalvinWilkinson self-assigned this Sep 25, 2022
CalvinWilkinson added a commit that referenced this issue Sep 25, 2022
@CalvinWilkinson CalvinWilkinson linked a pull request Sep 25, 2022 that will close this issue
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
high priority High Priority 鉁╪ew feature New feature that does not exist preview Done while in preview
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant