// 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 RefreshTokenClientIterator interface {
	Iterator(context.Context, *iam.ListRefreshTokensRequest, ...grpc.CallOption) *iterator.Iterator[*iam.ListRefreshTokensRequest, *iam.RefreshToken]
}

type refreshTokenServiceListInternal struct {
	*iam.ListRefreshTokensResponse
}

func (r refreshTokenServiceListInternal) Items() []*iam.RefreshToken {
	return r.ListRefreshTokensResponse.RefreshTokens
}

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