Skip to content

Commit dbc621e

Browse files
committed
chore: rename to noopActionSupporter
1 parent 5f14cb0 commit dbc621e

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

hcloud/action.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,9 @@ func (a *Action) Error() error {
8484
return nil
8585
}
8686

87-
type nilResource struct{}
88-
89-
func (nilResource) pathID() (string, error) {
90-
return "", nil
91-
}
92-
9387
// ActionClient is a client for the actions API.
9488
type ActionClient struct {
95-
action *ResourceActionClient[nilResource]
89+
action *ResourceActionClient[noopActionSupporter]
9690
}
9791

9892
// GetByID retrieves an action by its ID. If the action does not exist, nil is returned.
@@ -212,6 +206,12 @@ type actionSupporter interface {
212206
pathID() (string, error)
213207
}
214208

209+
// noopActionSupporter is used by the [ActionClient] to satisfy its underlying
210+
// [ResourceActionClient] generic type.
211+
type noopActionSupporter struct{}
212+
213+
func (noopActionSupporter) pathID() (string, error) { return "", nil }
214+
215215
// ListFor returns a paginated list of actions for the given Resource.
216216
//
217217
// Please note that filters specified in opts are not taken into account

hcloud/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ func NewClient(options ...ClientOption) *Client {
291291
client.handler = assembleHandlerChain(client)
292292

293293
// Cloud API
294-
client.Action = ActionClient{action: &ResourceActionClient[nilResource]{client: client}}
294+
client.Action = ActionClient{action: &ResourceActionClient[noopActionSupporter]{client: client}}
295295
client.Datacenter = DatacenterClient{client: client}
296296
client.FloatingIP = FloatingIPClient{client: client, Action: &ResourceActionClient[*FloatingIP]{client: client, resource: "floating_ips"}}
297297
client.Image = ImageClient{client: client, Action: &ResourceActionClient[*Image]{client: client, resource: "images"}}

0 commit comments

Comments
 (0)