Skip to content

Commit e1f0e2b

Browse files
committed
fix!: rename files and types to match the original code in Python
BREAKING CHANGE: - PaperListResult -> PaperList - PaperListResultItem -> Paper
1 parent 4825127 commit e1f0e2b

File tree

6 files changed

+12
-12
lines changed

6 files changed

+12
-12
lines changed
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
package models
22

3-
// PaperListResult is the result of PaperListResult() function.
4-
type PaperListResult struct {
5-
Count int64 `json:"count"`
6-
Next *string `json:"next"`
7-
Previous *string `json:"previous"`
8-
Results []PaperListResultItem `json:"results"`
3+
// PaperList is the result of PaperList() function.
4+
type PaperList struct {
5+
Count int64 `json:"count"`
6+
Next *string `json:"next"`
7+
Previous *string `json:"previous"`
8+
Results []Paper `json:"results"`
99
}
1010

11-
type PaperListResultItem struct {
11+
type Paper struct {
1212
ID string `json:"id"`
1313
ArxivID *string `json:"arxiv_id"`
1414
NipsID *string `json:"nips_id"`
@@ -22,4 +22,4 @@ type PaperListResultItem struct {
2222
ConferenceURLAbs *string `json:"conference_url_abs"`
2323
ConferenceURLPDF *string `json:"conference_url_pdf"`
2424
Proceeding *string `json:"proceeding"`
25-
}
25+
}
File renamed without changes.
File renamed without changes.

paper_get.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ import (
88
)
99

1010
// PaperGet returns a single paper. Note that paperID is hyphen cased (e.g., generative-adversarial-networks).
11-
func (c *Client) PaperGet(paperID string) (*models.PaperListResultItem, error) {
11+
func (c *Client) PaperGet(paperID string) (*models.Paper, error) {
1212
paperGetURL := fmt.Sprintf("%s/papers/%s/", c.BaseURL, url.QueryEscape(paperID))
1313
response, err := c.HTTPClient.Get(paperGetURL)
1414
if err != nil {
1515
return nil, err
1616
}
1717

18-
var paperGetResult models.PaperListResultItem
18+
var paperGetResult models.Paper
1919
err = json.NewDecoder(response.Body).Decode(&paperGetResult)
2020
if err != nil {
2121
return nil, err

paperlist.go renamed to paper_list.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ import (
77
"net/url"
88
)
99

10-
func (c *Client) PaperList(params PaperListParams) (*models.PaperListResult, error) {
10+
func (c *Client) PaperList(params PaperListParams) (*models.PaperList, error) {
1111
papersListURL := c.BaseURL + "/papers?" + params.Build()
1212

1313
response, err := c.HTTPClient.Get(papersListURL)
1414
if err != nil {
1515
return nil, err
1616
}
1717

18-
var paperListResult models.PaperListResult
18+
var paperListResult models.PaperList
1919

2020
err = json.NewDecoder(response.Body).Decode(&paperListResult)
2121
if err != nil {
File renamed without changes.

0 commit comments

Comments
 (0)