-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathisbn.go
More file actions
28 lines (23 loc) · 526 Bytes
/
isbn.go
File metadata and controls
28 lines (23 loc) · 526 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package openlibrary
import "path"
type ISBNAPI struct {
openlibraryClient *Client
isbn string
}
func (c *Client) ISBN(isbn string) *ISBNAPI {
api := ISBNAPI{
openlibraryClient: c,
isbn: isbn,
}
return &api
}
func (api *ISBNAPI) Get() (resp *Edition, err error) {
_, err = api.openlibraryClient.httpClient.R().
SetHeader("Accept", "application/json").
SetResult(&resp).
Get(path.Join("isbn", api.isbn) + ".json")
if err != nil {
return
}
return
}