Пример #1
0
func (s *RPCService) GetMostPopular(ctx context.Context, r *MostPopularRequest) (*MostPopularResponse, error) {
	var (
		err error
		res []*nyt.MostPopularResult
	)
	defer server.MonitorRPCRequest()(ctx, "GetMostPopular", err)

	res, err = s.client.GetMostPopular(r.ResourceType, r.Section, uint(r.TimePeriodDays))
	if err != nil {
		return nil, err
	}
	return &MostPopularResponse{res}, nil
}
Пример #2
0
func (s *RPCService) GetCats(ctx context.Context, r *CatsRequest) (*CatsResponse, error) {
	var (
		err error
		res []*nyt.SemanticConceptArticle
	)
	defer server.MonitorRPCRequest()(ctx, "GetCats", err)

	res, err = s.client.SemanticConceptSearch("des", "cats")
	if err != nil {
		return nil, err
	}

	return &CatsResponse{res}, nil
}