Skip to content

Commit 35b15f6

Browse files
committed
refactor: rename ListResourceResponse to ListResourceStream
1 parent d7f3133 commit 35b15f6

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

list/list_resource.go

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ type ListResource interface {
3636

3737
// ListResource is called when the provider must list instances of a
3838
// managed resource type that satisfy a user-provided request.
39-
ListResource(context.Context, ListResourceRequest, *ListResourceResponse)
39+
ListResource(context.Context, ListResourceRequest, *ListResourceStream)
4040
}
4141

4242
// ListResourceWithConfigure is an interface type that extends ListResource to include a method
@@ -105,11 +105,16 @@ type ListResourceRequest struct {
105105
// ClientCapabilities ReadClientCapabilities
106106
}
107107

108-
// ListResourceResponse represents a response to a ListResourceRequest. An
109-
// instance of this response struct is supplied as an argument to the
110-
// provider's ListResource function implementation function. The provider
111-
// should set an iterator function on the response struct.
112-
type ListResourceResponse struct {
108+
// ListResourceStream represents a streaming response to a ListResourceRequest.
109+
// An instance of this struct is supplied as an argument to the provider's
110+
// ListResource function implementation function. The provider should set an
111+
// iterator function on the response struct.
112+
//
113+
// For convenience, a provider implementation may choose to convert a slice of
114+
// results into an iterator using [slices.All].
115+
//
116+
// [slices.All]: https://pkg.go.dev/iter/slices#All
117+
type ListResourceStream struct {
113118
// Results is a function that emits ListResourceEvent values via its yield
114119
// function argument.
115120
Results iter.Seq[ListResourceEvent]

list/no_op_list_resource_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ type NoOpListResource struct{}
1414
func (*NoOpListResource) ListResourceConfigSchema(_ context.Context, _ list.ListResourceSchemaRequest, _ *list.ListResourceSchemaResponse) {
1515
}
1616

17-
func (*NoOpListResource) ListResource(_ context.Context, _ list.ListResourceRequest, _ *list.ListResourceResponse) {
17+
func (*NoOpListResource) ListResource(_ context.Context, _ list.ListResourceRequest, _ *list.ListResourceStream) {
1818
}

0 commit comments

Comments
 (0)