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: add interfaces for client structs #342

Merged
merged 1 commit into from
Nov 17, 2023
Merged

Conversation

phm07
Copy link
Contributor

@phm07 phm07 commented Nov 15, 2023

This PR adds auto-generated interfaces for client structs. This allows easier mocking of clients for tests.
The interfaces will have the same name as the corresponding struct, except for beginning with an I. So for example, the interface for ServerClient would be IServerClient.
The SDK itself will not use these new interface types, as most client structs have exported properties and using the interface types would thus be a breaking change.

@phm07 phm07 self-assigned this Nov 15, 2023
@phm07 phm07 requested a review from a team as a code owner November 15, 2023 15:16
Copy link
Member

@apricote apricote left a comment

Choose a reason for hiding this comment

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

Very Nice! Before merging, could you update cli to use these new interfaces and open a draft MR? Just to verify that this works as expected.

@apricote apricote merged commit 4f9390f into main Nov 17, 2023
4 checks passed
@apricote apricote deleted the generate-client-interfaces branch November 17, 2023 08:48
phm07 pushed a commit that referenced this pull request Dec 12, 2023
🤖 I have created a release *beep* *boop*
---


##
[2.5.0](v2.4.0...v2.5.0)
(2023-12-12)


### Features

* add conversion methods from schema to hcloud objects
([#343](#343))
([6feda4d](6feda4d))
* add interfaces for client structs
([#342](#342))
([4f9390f](4f9390f))
* add missing properties
([#349](#349))
([c8a28d0](c8a28d0))
* **error:** include http response in api errors
([#320](#320))
([9558239](9558239))


### Bug Fixes

* make schemas consistent with API
([#348](#348))
([b0d7055](b0d7055))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
phm07 added a commit to hetznercloud/cli that referenced this pull request Dec 13, 2023
Once hetznercloud/hcloud-go#342 is merged,
`hcloud-go` provides its own interfaces for clients. We can thus remove
the ones we generated ourselves and use the provided ones instead. Also,
the `interfacer` tool can be removed.
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.

2 participants