func (it *ProjectIterator) PageInfo() *iterator.PageInfo {
	return it.pageInfo
}
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
package gapic
import (
	"context"
	"fmt"
	"math"
	"net/url"
	rpcpb "github.com/apigee/registry/rpc"
	gax "github.com/googleapis/gax-go/v2"
	"google.golang.org/api/iterator"
	"google.golang.org/api/option"
	"google.golang.org/api/option/internaloption"
	gtransport "google.golang.org/api/transport/grpc"
	"google.golang.org/grpc"
	"google.golang.org/grpc/metadata"
	"google.golang.org/protobuf/proto"
	emptypb "google.golang.org/protobuf/types/known/emptypb"
)
var newAdminClientHook clientHook
type AdminCallOptions struct {
	GetStatus []gax.CallOption
	ListProjects []gax.CallOption
	GetProject []gax.CallOption
	CreateProject []gax.CallOption
	UpdateProject []gax.CallOption
	DeleteProject []gax.CallOption
}
func defaultAdminGRPCClientOptions() []option.ClientOption {
	return []option.ClientOption{
		internaloption.WithDefaultEndpoint("apigeeregistry.googleapis.com:443"),
		internaloption.WithDefaultMTLSEndpoint("apigeeregistry.mtls.googleapis.com:443"),
		internaloption.WithDefaultAudience("https://apigeeregistry.googleapis.com/"),
		internaloption.WithDefaultScopes(DefaultAuthScopes()...),
		internaloption.EnableJwtWithScope(),
		option.WithGRPCDialOption(grpc.WithDisableServiceConfig()),
		option.WithGRPCDialOption(grpc.WithDefaultCallOptions(
		grpc.MaxCallRecvMsgSize(math.MaxInt32))),
	}
}
func defaultAdminCallOptions() *AdminCallOptions {
	return &AdminCallOptions{
		GetStatus: []gax.CallOption{
		},
		ListProjects: []gax.CallOption{
		},
		GetProject: []gax.CallOption{
		},
		CreateProject: []gax.CallOption{
		},
		UpdateProject: []gax.CallOption{
		},
		DeleteProject: []gax.CallOption{
		},
	}
}
type internalAdminClient interface {
	Close() error
	setGoogleClientInfo(...string)
	Connection() *grpc.ClientConn
	GetStatus(context.Context, *emptypb.Empty, ...gax.CallOption) (*rpcpb.Status, error)
	ListProjects(context.Context, *rpcpb.ListProjectsRequest, ...gax.CallOption) *ProjectIterator
	GetProject(context.Context, *rpcpb.GetProjectRequest, ...gax.CallOption) (*rpcpb.Project, error)
	CreateProject(context.Context, *rpcpb.CreateProjectRequest, ...gax.CallOption) (*rpcpb.Project, error)
	UpdateProject(context.Context, *rpcpb.UpdateProjectRequest, ...gax.CallOption) (*rpcpb.Project, error)
	DeleteProject(context.Context, *rpcpb.DeleteProjectRequest, ...gax.CallOption) error
}
type AdminClient struct {
	internalClient internalAdminClient
	CallOptions *AdminCallOptions
}
func (c *AdminClient) Close() error {
	return c.internalClient.Close()
}
func (c *AdminClient) setGoogleClientInfo(keyval ...string) {
	c.internalClient.setGoogleClientInfo(keyval...)
}
func (c *AdminClient) Connection() *grpc.ClientConn {
	return c.internalClient.Connection()
}
func (c *AdminClient) GetStatus(ctx context.Context, req *emptypb.Empty, opts ...gax.CallOption) (*rpcpb.Status, error) {
	return c.internalClient.GetStatus(ctx, req, opts...)
}
func (c *AdminClient) ListProjects(ctx context.Context, req *rpcpb.ListProjectsRequest, opts ...gax.CallOption) *ProjectIterator {
	return c.internalClient.ListProjects(ctx, req, opts...)
}
func (c *AdminClient) GetProject(ctx context.Context, req *rpcpb.GetProjectRequest, opts ...gax.CallOption) (*rpcpb.Project, error) {
	return c.internalClient.GetProject(ctx, req, opts...)
}
func (c *AdminClient) CreateProject(ctx context.Context, req *rpcpb.CreateProjectRequest, opts ...gax.CallOption) (*rpcpb.Project, error) {
	return c.internalClient.CreateProject(ctx, req, opts...)
}
func (c *AdminClient) UpdateProject(ctx context.Context, req *rpcpb.UpdateProjectRequest, opts ...gax.CallOption) (*rpcpb.Project, error) {
	return c.internalClient.UpdateProject(ctx, req, opts...)
}
func (c *AdminClient) DeleteProject(ctx context.Context, req *rpcpb.DeleteProjectRequest, opts ...gax.CallOption) error {
	return c.internalClient.DeleteProject(ctx, req, opts...)
}
type adminGRPCClient struct {
	connPool gtransport.ConnPool
	disableDeadlines bool
	CallOptions **AdminCallOptions
	adminClient rpcpb.AdminClient
	xGoogMetadata metadata.MD
}
func NewAdminClient(ctx context.Context, opts ...option.ClientOption) (*AdminClient, error) {
	clientOpts := defaultAdminGRPCClientOptions()
	if newAdminClientHook != nil {
		hookOpts, err := newAdminClientHook(ctx, clientHookParams{})
		if err != nil {
			return nil, err
		}
		clientOpts = append(clientOpts, hookOpts...)
	}
	disableDeadlines, err := checkDisableDeadlines()
	if err != nil {
		return nil, err
	}
	connPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...)
	if err != nil {
		return nil, err
	}
	client := AdminClient{CallOptions: defaultAdminCallOptions()}
	c := &adminGRPCClient{
		connPool:    connPool,
		disableDeadlines: disableDeadlines,
		adminClient: rpcpb.NewAdminClient(connPool),
		CallOptions: &client.CallOptions,
	}
	c.setGoogleClientInfo()
	client.internalClient = c
	return &client, nil
}
func (c *adminGRPCClient) Connection() *grpc.ClientConn {
	return c.connPool.Conn()
}
func (c *adminGRPCClient) setGoogleClientInfo(keyval ...string) {
	kv := append([]string{"gl-go", versionGo()}, keyval...)
	kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version)
	c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...))
}
func (c *adminGRPCClient) Close() error {
	return c.connPool.Close()
}
func (c *adminGRPCClient) GetStatus(ctx context.Context, req *emptypb.Empty, opts ...gax.CallOption) (*rpcpb.Status, error) {
	ctx = insertMetadata(ctx, c.xGoogMetadata)
	opts = append((*c.CallOptions).GetStatus[0:len((*c.CallOptions).GetStatus):len((*c.CallOptions).GetStatus)], opts...)
	var resp *rpcpb.Status
	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
		var err error
		resp, err = c.adminClient.GetStatus(ctx, req, settings.GRPC...)
		return err
	}, opts...)
	if err != nil {
		return nil, err
	}
	return resp, nil
}
func (c *adminGRPCClient) ListProjects(ctx context.Context, req *rpcpb.ListProjectsRequest, opts ...gax.CallOption) *ProjectIterator {
	ctx = insertMetadata(ctx, c.xGoogMetadata)
	opts = append((*c.CallOptions).ListProjects[0:len((*c.CallOptions).ListProjects):len((*c.CallOptions).ListProjects)], opts...)
	it := &ProjectIterator{}
	req = proto.Clone(req).(*rpcpb.ListProjectsRequest)
	it.InternalFetch = func(pageSize int, pageToken string) ([]*rpcpb.Project, string, error) {
		resp := &rpcpb.ListProjectsResponse{}
		if pageToken != "" {
			req.PageToken = pageToken
		}
		if pageSize > math.MaxInt32 {
			req.PageSize = math.MaxInt32
		} else if pageSize != 0 {
			req.PageSize = int32(pageSize)
		}
		err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
			var err error
			resp, err = c.adminClient.ListProjects(ctx, req, settings.GRPC...)
			return err
		}, opts...)
		if err != nil {
			return nil, "", err
		}
		it.Response = resp
		return resp.GetProjects(), resp.GetNextPageToken(), nil
	}
	fetch := func(pageSize int, pageToken string) (string, error) {
		items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
		if err != nil {
			return "", err
		}
		it.items = append(it.items, items...)
		return nextPageToken, nil
	}
	it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
	it.pageInfo.MaxSize = int(req.GetPageSize())
	it.pageInfo.Token = req.GetPageToken()
	return it
}
func (c *adminGRPCClient) GetProject(ctx context.Context, req *rpcpb.GetProjectRequest, opts ...gax.CallOption) (*rpcpb.Project, error) {
	md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName())))
	ctx = insertMetadata(ctx, c.xGoogMetadata, md)
	opts = append((*c.CallOptions).GetProject[0:len((*c.CallOptions).GetProject):len((*c.CallOptions).GetProject)], opts...)
	var resp *rpcpb.Project
	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
		var err error
		resp, err = c.adminClient.GetProject(ctx, req, settings.GRPC...)
		return err
	}, opts...)
	if err != nil {
		return nil, err
	}
	return resp, nil
}
func (c *adminGRPCClient) CreateProject(ctx context.Context, req *rpcpb.CreateProjectRequest, opts ...gax.CallOption) (*rpcpb.Project, error) {
	ctx = insertMetadata(ctx, c.xGoogMetadata)
	opts = append((*c.CallOptions).CreateProject[0:len((*c.CallOptions).CreateProject):len((*c.CallOptions).CreateProject)], opts...)
	var resp *rpcpb.Project
	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
		var err error
		resp, err = c.adminClient.CreateProject(ctx, req, settings.GRPC...)
		return err
	}, opts...)
	if err != nil {
		return nil, err
	}
	return resp, nil
}
func (c *adminGRPCClient) UpdateProject(ctx context.Context, req *rpcpb.UpdateProjectRequest, opts ...gax.CallOption) (*rpcpb.Project, error) {
	md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "project.name", url.QueryEscape(req.GetProject().GetName())))
	ctx = insertMetadata(ctx, c.xGoogMetadata, md)
	opts = append((*c.CallOptions).UpdateProject[0:len((*c.CallOptions).UpdateProject):len((*c.CallOptions).UpdateProject)], opts...)
	var resp *rpcpb.Project
	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
		var err error
		resp, err = c.adminClient.UpdateProject(ctx, req, settings.GRPC...)
		return err
	}, opts...)
	if err != nil {
		return nil, err
	}
	return resp, nil
}
func (c *adminGRPCClient) DeleteProject(ctx context.Context, req *rpcpb.DeleteProjectRequest, opts ...gax.CallOption) error {
	md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName())))
	ctx = insertMetadata(ctx, c.xGoogMetadata, md)
	opts = append((*c.CallOptions).DeleteProject[0:len((*c.CallOptions).DeleteProject):len((*c.CallOptions).DeleteProject)], opts...)
	err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
		var err error
		_, err = c.adminClient.DeleteProject(ctx, req, settings.GRPC...)
		return err
	}, opts...)
	return err
}
type ProjectIterator struct {
	items    []*rpcpb.Project
	pageInfo *iterator.PageInfo
	nextFunc func() error
	Response interface{}
	InternalFetch func(pageSize int, pageToken string) (results []*rpcpb.Project, nextPageToken string, err error)
}