Skip to content
This repository has been archived by the owner on Jun 28, 2024. It is now read-only.

[WIP] feat: Add API service to load an Href #84

Closed
wants to merge 1 commit into from
Closed

[WIP] feat: Add API service to load an Href #84

wants to merge 1 commit into from

Conversation

ctreatma
Copy link
Contributor

This PR demonstrates a way to enable users to hydrate hrefs that come back from the API without using include parameters. It's not clear that we actually want to provide a way to do this, but it's at least a fun exploration of how the generated Go client is wired up.

This hooks into the generated client code in order to read the href path from an object returned by the API, turn that href into a full request URL, send that request to the API, and unmarshall the JSON response as the appropriate model type.

@ctreatma
Copy link
Contributor Author

Things to do if/when we revisit this:

  • Make sure it supports complex models
    • For example:
      • Hydrating a device project involves getting the request path from device.project.href and decoding the response into the device.project object
      • Hydrating a virtual circuit involves getting the request path from virtual_circuit.href.href and decoding the response into the virtual_circuit object
  • Move it to an external (i.e., not generated) package?
    • Might be best to improve it where it is now, and then move it out to see if we're relying on any internal things

@github-actions
Copy link
Contributor

github-actions bot commented Aug 2, 2023

Hey there and thank you for opening this pull request! 👋🏼

We require pull request titles to follow the Conventional Commits specification and it looks like your proposed title needs to be adjusted.

Details:

No release type found in pull request title "[WIP] feat: Add API service to load an Href". Add a prefix to indicate what kind of release this pull request corresponds to. For reference, see https://www.conventionalcommits.org/

Available types:
 - feat: A new feature
 - fix: A bug fix
 - docs: Documentation only changes
 - style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
 - refactor: A code change that neither fixes a bug nor adds a feature
 - perf: A code change that improves performance
 - test: Adding missing tests or correcting existing tests
 - build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
 - ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
 - chore: Other changes that don't modify src or test files
 - revert: Reverts a previous commit

@ctreatma ctreatma changed the title [WIP] Add API service to load an Href [WIP] feat: Add API service to load an Href Aug 2, 2023
@ctreatma ctreatma closed this Jun 28, 2024
@ctreatma ctreatma deleted the hydrate_hrefs branch June 28, 2024 15:22
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant