// Code generated by sdkgen-v2. DO NOT EDIT.
package iamsdk

import (
	"context"

	iam "github.com/yandex-cloud/go-genproto/yandex/cloud/iam/v1"
	"github.com/yandex-cloud/go-sdk/v2/pkg/iterator"
	"google.golang.org/grpc"
)

type OAuthClientClientIterator interface {
	Iterator(context.Context, *iam.ListOAuthClientsRequest, ...grpc.CallOption) *iterator.Iterator[*iam.ListOAuthClientsRequest, *iam.OAuthClientListView]
}

type oAuthClientServiceListInternal struct {
	*iam.ListOAuthClientsResponse
}

func (r oAuthClientServiceListInternal) Items() []*iam.OAuthClientListView {
	return r.ListOAuthClientsResponse.OauthClients
}

func (c oAuthClientClient) Iterator(ctx context.Context, req *iam.ListOAuthClientsRequest, opts ...grpc.CallOption) *iterator.Iterator[*iam.ListOAuthClientsRequest, *iam.OAuthClientListView] {
	return iterator.NewIterator[*iam.ListOAuthClientsRequest, *iam.OAuthClientListView](ctx, req,
		func(ctx context.Context, req *iam.ListOAuthClientsRequest, opts ...grpc.CallOption) (iterator.PageResponse[*iam.OAuthClientListView], error) {
			resp, err := c.List(ctx, req, opts...)
			if err != nil {
				return nil, err
			}
			return oAuthClientServiceListInternal{resp}, nil
		})
}
