Skip to content

Commit

Permalink
following protobuf conventions
Browse files Browse the repository at this point in the history
  • Loading branch information
jprobinson committed Dec 21, 2015
1 parent 719690a commit fcd5e32
Show file tree
Hide file tree
Showing 8 changed files with 86 additions and 86 deletions.
6 changes: 3 additions & 3 deletions examples/nyt/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (c *ClientImpl) GetMostPopular(resourceType string, section string, timePer
}

err = json.Unmarshal(rawRes, &res)
return res.Results, err
return res.Result, err
}

func (c *ClientImpl) SemanticConceptSearch(conceptType, concept string) ([]*SemanticConceptArticle, error) {
Expand All @@ -58,11 +58,11 @@ func (c *ClientImpl) SemanticConceptSearch(conceptType, concept string) ([]*Sema
}

err = json.Unmarshal(rawRes, &res)
if len(res.Results) == 0 {
if len(res.Result) == 0 {
return nil, errors.New("no results")
}

return res.Results[0].ArticleList.Results, nil
return res.Result[0].ArticleList.Result, nil
}

func (c *ClientImpl) do(uri string) (body []byte, err error) {
Expand Down
56 changes: 28 additions & 28 deletions examples/nyt/mostpopular.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/nyt/mostpopular.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ message MostPopularResponse {
string status = 1;
string copyright = 2;
uint32 num_results = 3;
repeated MostPopularResult results = 4;
repeated MostPopularResult result = 4;
}

message MostPopularResult {
Expand Down
44 changes: 22 additions & 22 deletions examples/nyt/semanticconcept.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions examples/nyt/semanticconcept.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ message SemanticConceptResponse {
string status = 1;
string copyright = 2;
uint32 num_results = 3;
repeated SemanticConceptResult results = 4;
repeated SemanticConceptResult result = 4;
}

message SemanticConceptResult {
SemanticConceptArticleList article_list = 1;
}

message SemanticConceptArticleList {
repeated SemanticConceptArticle results = 1;
repeated SemanticConceptArticle result = 1;
uint32 total = 2;
}

Expand Down
2 changes: 1 addition & 1 deletion examples/servers/rpc/service/mostpopular.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ func (s *RPCService) GetMostPopularJSON(r *http.Request) (int, interface{}, erro
if err != nil {
return http.StatusInternalServerError, nil, err
}
return http.StatusOK, res.Results, nil
return http.StatusOK, res.Result, nil
}
56 changes: 28 additions & 28 deletions examples/servers/rpc/service/nyt-proxy.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/servers/rpc/service/nyt-proxy.proto
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ message MostPopularRequest {
}

message MostPopularResponse {
repeated nyt.MostPopularResult results = 1;
repeated nyt.MostPopularResult result = 1;
}

message CatsRequest {
Expand Down

0 comments on commit fcd5e32

Please sign in to comment.