func (s *IssueServiceV1) ListRepositories(ctx context.Context, r *drghs_v1.ListRepositoriesRequest) (*drghs_v1.ListRepositoriesResponse, error) {
	var pg []*drghs_v1.Repository
	var idx int
	var err error
	nextToken := ""
	if r.PageToken != "" {
		pageToken, err := decodePageToken(r.PageToken)
		if err != nil {
			return nil, err
		}
		ftime, err := ptypes.Timestamp(pageToken.FirstRequestTimeUsec)
		if err != nil {
			return nil, err
		}
		pagesize := getPageSize(int(r.PageSize))
		pg, idx, err = s.rp.GetPage(ftime, pagesize)
		if err != nil {
			return nil, err
		}
		nextToken, err = makeNextPageToken(pageToken, idx)
	} else {
		filteredRepos := make([]*drghs_v1.Repository, 0)
		err = s.corpus.GitHub().ForeachRepo(func(repo *maintner.GitHubRepo) error {
			rpb, err := makeRepoPB(repo)
			if err != nil {
				return err
			}
			should, err := filters.FilterRepository(rpb, r.Filter)
			if err != nil {
				return err
			}
			if should {
				filteredRepos = append(filteredRepos, rpb)
			}
			return nil
		})
		if err != nil {
			return nil, err
		}
		t, err := s.rp.CreatePage(filteredRepos)
		if err != nil {
			return nil, err
		}
		pagesize := getPageSize(int(r.PageSize))
		pg, idx, err = s.rp.GetPage(t, pagesize)
		if err != nil {
			return nil, err
		}
		if idx > 0 {
			nextToken, err = makeFirstPageToken(t, idx)
			if err != nil {
				return nil, err
			}
		}
	}
	resp := drghs_v1.ListRepositoriesResponse{
		Repositories:  pg,
		NextPageToken: nextToken,
	}
	return &resp, err
}
ListRepositories lists the set of repositories tracked by this maintner instance
package v1beta1
import (
	"context"
	"fmt"
	"regexp"
	"strconv"
	"strings"
	"time"
	drghs_v1 "github.com/GoogleCloudPlatform/devrel-services/drghs/v1"
	"github.com/golang/protobuf/ptypes"
	"github.com/GoogleCloudPlatform/devrel-services/drghs-worker/maintnerd/api/filters"
	"github.com/GoogleCloudPlatform/devrel-services/drghs-worker/pkg/googlers"
	"golang.org/x/build/maintner"
	"google.golang.org/grpc/codes"
	healthpb "google.golang.org/grpc/health/grpc_health_v1"
	"google.golang.org/grpc/status"
)
var _ drghs_v1.IssueServiceServer = &IssueServiceV1{}
const defaultFilter = "true"
var issueNumReg = regexp.MustCompile(`^[\w.-]+\/[\w.-]+\/issues/(\d+)$`)
type IssueServiceV1 struct {
	corpus          *maintner.Corpus
	rp              *repoPaginator
	ip              *issuePaginator
	googlerResolver googlers.Resolver
}
func NewIssueServiceV1(corpus *maintner.Corpus, resolver googlers.Resolver) *IssueServiceV1 {
	return &IssueServiceV1{
		corpus: corpus,
		rp: &repoPaginator{
			set: make(map[time.Time]repoPage),
		},
		ip: &issuePaginator{
			set: make(map[time.Time]issuePage),
		},
	}
}