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

v0.8.0: Library Rewrite #36

Merged
merged 31 commits into from
Aug 8, 2023
Merged

v0.8.0: Library Rewrite #36

merged 31 commits into from
Aug 8, 2023

Conversation

ewang2002
Copy link
Member

@ewang2002 ewang2002 commented Jun 14, 2023

This PR significantly restructures the library for more flexibility. Some major changes are highlighted below:

  • Users can now use the WebRegWrapperBuilder to build a new WebRegWrapper. You'll need to specify the term and cookies, but everything else (client, timeout, user agent) will assume default values.
  • The WebRegWrapper structure won't directly support making requests to endpoints that require a term. Instead, users will need to call WebRegWrapper::make_request() to create a builder instance, or WebRegWrapper::default_request() to create a new request instance that can be used to create requests to WebReg endpoints.
    • The builder is there so that users can make requests that might require overriding a value (e.g., if the wrapper's default term is FA23 but you want to make a one-time request for SP23, you can now do this without needing to create a new WebRegWrapper object).
    • Currently, you can override the term, cookies, user agent, timeout, and even the client.
  • Separated calling the endpoint from parsing the endpoint's result so we can run tests on the endpoint's result.

Soon

  • Support added for getting raw JSON results from WebReg; this might be useful if, for example, you want to do your own processing on the raw JSON instead of having the library do it for you.

To Be Completed

  • For requests that require a term, separate functions that makes requests with functions that process responses.
  • Add ability to make requests and return the string representation of those requests (i.e., no further processing).
  • Use cargo's feature gate to give users the ability to enable or disable the wrapper (if the wrapper is disabled, make sure they can still access the parse functions and associated types). For a later release.

@ewang2002 ewang2002 linked an issue Jun 14, 2023 that may be closed by this pull request
@ewang2002 ewang2002 marked this pull request as draft June 14, 2023 03:49
@ewang2002 ewang2002 marked this pull request as ready for review August 8, 2023 04:58
@ewang2002 ewang2002 merged commit b1d5ddb into stable Aug 8, 2023
1 check passed
@ewang2002 ewang2002 deleted the v0.8 branch September 11, 2023 04:06
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.

Break functions into two functions for better testing
1 participant