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

type oAuthClientSecretServiceListInternal struct {
	*iam.ListOAuthClientSecretsResponse
}

func (r oAuthClientSecretServiceListInternal) Items() []*iam.OAuthClientSecret {
	return r.ListOAuthClientSecretsResponse.OauthClientSecrets
}

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