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

Added missing background transform to TinyPNG convert call #56

Merged
merged 1 commit into from
May 30, 2024

Conversation

manzanotti
Copy link

No description provided.

@manzanotti
Copy link
Author

This fixes #57

Copy link
Owner

@ctolkien ctolkien left a comment

Choose a reason for hiding this comment

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

Rather than serializing twice in the scenario that we have a background transform, we can just supply the value if we have it. The JSON serializer settings we're using will omit any null values.

        string requestBody = JsonSerializer.Serialize(
            new { 
                convert = new { type = convertOperation }, 
                transform = !string.IsNullOrEmpty(backgroundTransform) ? new { background = backgroundTransform } : null 
            },
            TinyPngClient._jsonOptions);

@manzanotti
Copy link
Author

Rather than serializing twice in the scenario that we have a background transform, we can just supply the value if we have it. The JSON serializer settings we're using will omit any null values.

        string requestBody = JsonSerializer.Serialize(
            new { 
                convert = new { type = convertOperation }, 
                transform = !string.IsNullOrEmpty(backgroundTransform) ? new { background = backgroundTransform } : null 
            },
            TinyPngClient._jsonOptions);

Fair point, done.

@ctolkien ctolkien merged commit 270b429 into ctolkien:main May 30, 2024
1 of 2 checks passed
@manzanotti
Copy link
Author

@ctolkien Any chance this could be released to NuGet?

On that note, are there any other issues you wanted resolving before releasing v4 properly? Happy to help out.

@ctolkien
Copy link
Owner

ctolkien commented Jun 3, 2024

@manzanotti - v4 has gone to NuGet. Thanks for your help in this one!

@ctolkien
Copy link
Owner

ctolkien commented Jun 3, 2024

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

Successfully merging this pull request may close these issues.

None yet

2 participants