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

chore(iss-1)!: version 2.0.0 overhaul #2

Merged
merged 93 commits into from
Jan 22, 2025
Merged

chore(iss-1)!: version 2.0.0 overhaul #2

merged 93 commits into from
Jan 22, 2025

Conversation

AJCJ1
Copy link
Collaborator

@AJCJ1 AJCJ1 commented Oct 14, 2024

This is a major overhaul of the SDK as it stands, and intends to serve as an example for the other Urlbox SDK's going forward.

The changes made in this PR are as follows:

Updates dotnet package from 2.0 to 6.0

The package has been update to target dotnet 6.0. This is to support the various security, performance, and language enhancements to c# and .NET. It has not been updated to 8.0 due to the current LTS for 6.0. It is presumed that a large number of users may not have upgraded their .NET projects to 8.0 just yet.

Refactors components to be typed class

The Urlbox options are now a class, with typed properties based on the Urlbox documentation. With this, any metadata, errors, exceptions, and general responses have also been turned into convenient types.

The options class has also been given a builder as a fluent interface for users to call.

Implements new methods:

A number of helper methods like TakePdf and TakeScreenshotWithMetadata have been implemented for common use cases.

Additionally, the sync and async strategies for rendering a screenshot have had methods written, where any common use case method will use async with polling by default.

All methods that already existed should be backward compatible, now requiring the UrlboxOptions argument, but with overloads which accept the same IDictionary arguments as in v1.0.

Methods for generating different kinds of render links have been added.

Methods for verifying webhook signatures, and getting the status of a render have been addded.

Enums

A number of enums have been added, which simplify the experience for a user.

Implementation of quicktype

Quicktype has been written into a branch of the Urlbox repo in order to create the UrlboxOptions class based on our zod schema. It has also been automated so that if we change that schema and merge, it triggers an action that regenerates the class for our SDK's, and makes a PR on this repo to update it.

Actions on merge

This also implements a deploy github action with use of release-please, that automatically versions the SDK when a merge to master is made, running the tests beforehand.

Once a release PR is made by release please, a developer needs to sign off on the changes. Once this Release PR is signed off and merged, then the deploy action will run again, release-please will detect this, and create a new release. The deploy step will recognise this too, and push the package to Nuget.

Nice To haves:

  • Eventually upgrade to Dotnet 8.0 when LTS runs out, and take advantage of new features like the deserialisation policy for snake casing instead of a custom policy.

Tests:

The tests have been written into the MsTest project, and are setup to run on push.

Mocking has been used where appropriate to test up to the point of the network request, ensuring that options etc are as expected, and the SDK responds gracefully to errors/exceptions.

@AJCJ1 AJCJ1 requested a review from cjroebuck October 14, 2024 15:30
@AJCJ1 AJCJ1 linked an issue Oct 14, 2024 that may be closed by this pull request
@AJCJ1 AJCJ1 changed the title Migration of .io to .com WIP Migration of .io to .com + sync/async/webhook methods Oct 16, 2024
@AJCJ1 AJCJ1 changed the title WIP Migration of .io to .com + sync/async/webhook methods Migration of .io to .com + sync/async/webhook methods Oct 18, 2024
@AJCJ1 AJCJ1 changed the title Migration of .io to .com + sync/async/webhook methods WIP - Migration of .io to .com + sync/async/webhook methods Oct 18, 2024
@AJCJ1 AJCJ1 changed the title WIP - Migration of .io to .com + sync/async/webhook methods Migration of .io to .com + sync/async/webhook methods Oct 22, 2024
@AJCJ1 AJCJ1 changed the title Migration of .io to .com + sync/async/webhook methods WIP - Migration of .io to .com + sync/async/webhook methods Dec 3, 2024
AJCJ1 added 21 commits January 21, 2025 15:06
fix(repo): clarify code comments

feat(repo): add docbblocks to methods
…ss and failure cases

fix(repo): fix blockUrls to be arr
refactor(repo): update urlboxoptions types

refactor(repo): split classes into their own files
…er method

refactor(repo): make global usings and organise resources and policies into dirs
…test

refactor(readme): update readme with new usage examples including new methods

refactor(repo): update readme with static fromcredentials example, fix test warnings
refactor(repo): move urlboxoptions tests to own file
… resource tests and test for deserializer in render()
chore(repo): remove unused imports

add test to urlboxoptions

fix(repo): seal urlbox class

make urlbox values readonly private, remove unused webhookSecret which only gets consumed in UrlboxWebhookValidator

Implement getUrlboxErrorMessage, which extracts from err message in headers

chore(tests): cleanup tests

chore(repo): place classes into file namespaces

refactor(repo): implement abstract urlbox response
chore(repo): capitalise verifywebhooksignature method

chore(repo): reorder methods into categories with public/private
AJCJ1 and others added 19 commits January 21, 2025 16:27
…please-test

chore(release-please-test): release 1.2.0
…please-test

chore(release-please-test): release 1.3.0
…please-test

chore(release-please-test): release 1.4.0
…please-test

chore(release-please-test): release 1.5.0
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@AJCJ1 AJCJ1 changed the title WIP - Migration of .io to .com + sync/async/webhook methods chore(iss-1)!: version 2.0.0 overhaul Jan 22, 2025
@AJCJ1 AJCJ1 merged commit 1d641be into master Jan 22, 2025
1 check passed
@urlbox urlbox deleted a comment from AJCJ1 Jan 22, 2025
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.

Migration of .io to .com + Missing webhook/sync/async methods
1 participant