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

[feat]: SDKs for ActionsArtifacts APIs #2782

Merged
merged 16 commits into from
Sep 25, 2023

Conversation

thomhurst
Copy link
Contributor

@thomhurst thomhurst commented Sep 23, 2023

Resolves #2780


Before the change?

  • The artifacts client isn't usable currently - There are no methods

After the change?

Methods to interact with the APIs listed here: https://docs.github.com/en/rest/actions/artifacts

Pull request checklist

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)

Does this introduce a breaking change?

Please see our docs on breaking changes to help!

  • Yes
  • No

I couldn't add integration tests as there isn't any API to create artifacts or anything. But I've added a deserialization test. And then I've hooked into the existing HTTP functionality which should already be thoroughly tested.

I also slightly reworked the internal HTTP sending to receive binary file responses as Streams, rather than raw byte arrays. Artifacts could potentially be large file sizes, and loading these directly into a byte array may not be ideal for memory. So by utilising streams instead, we can reduce memory and write to the disk as we receive data.

@nickfloyd nickfloyd added the Type: Feature New feature or request label Sep 25, 2023
Copy link
Contributor

@nickfloyd nickfloyd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great @thomhurst, just a little nit about some code doc clarity... it's definitely not super important, but it would be some nice cleanup.

This looks fantastic otherwaise, thank you for the effort here! ❤️

.Any(item => item.Equals(contentType, StringComparison.OrdinalIgnoreCase))))
{
responseBody = await responseMessage.Content.ReadAsByteArrayAsync().ConfigureAwait(false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with the preference of using Stream instead of ByteArray here. Given that this has changed would you mind updating the related code docs around the Response implementation as well, just for clarity sake.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated :)

@nickfloyd nickfloyd changed the title Methods for interacting with artifacts for ActionsArtifactsClient.cs [feat]: SDKs for ActionsArtifacts APIs Sep 25, 2023
@nickfloyd nickfloyd merged commit 958bc5f into octokit:main Sep 25, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature New feature or request
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

[Feature]: IActionsArtifactsClient is empty and has no methods available to call
2 participants