-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexternal_identifier.go
55 lines (47 loc) · 1.96 KB
/
external_identifier.go
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package orcid
import (
"fmt"
"net/http"
)
type ExternalIdentifier struct {
CreatedDate *TimeValue `json:"created-date,omitempty"`
DisplayIndex int `json:"display-index,omitempty"`
// swagger docs mistakenly say object
ExternalID
LastModifiedDate *TimeValue `json:"last-modified-date,omitempty"`
Path string `json:"path,omitempty"`
PutCode int `json:"put-code,omitempty"`
Source *Source `json:"source,omitempty"`
Visibility string `json:"visibility,omitempty"`
}
type ExternalIdentifiers struct {
ExternalIdentifier []ExternalIdentifier `json:"external-identifier,omitempty"`
LastModifiedDate *TimeValue `json:"last-modified-date,omitempty"`
Path string `json:"path,omitempty"`
}
func (c *Client) ExternalIdentifiers(orcid string) (*ExternalIdentifiers, *http.Response, error) {
data := &ExternalIdentifiers{}
path := fmt.Sprintf("%s/external-identifiers", orcid)
res, err := c.get(path, data)
return data, res, err
}
func (c *Client) ExternalIdentifier(orcid string, putCode int) (*ExternalIdentifier, *http.Response, error) {
data := &ExternalIdentifier{}
path := fmt.Sprintf("%s/external-identifiers/%d", orcid, putCode)
res, err := c.get(path, data)
return data, res, err
}
func (c *MemberClient) AddExternalIdentifier(orcid string, body *ExternalIdentifier) (int, *http.Response, error) {
path := fmt.Sprintf("%s/external-identifiers", orcid)
return c.add(path, body)
}
func (c *MemberClient) UpdateExternalIdentifier(orcid string, body *ExternalIdentifier) (*ExternalIdentifier, *http.Response, error) {
data := &ExternalIdentifier{}
path := fmt.Sprintf("%s/external-identifiers/%d", orcid, body.PutCode)
res, err := c.update(path, body, data)
return data, res, err
}
func (c *MemberClient) DeleteExternalIdentifier(orcid string, putCode int) (bool, *http.Response, error) {
path := fmt.Sprintf("%s/external-identifiers/%d", orcid, putCode)
return c.delete(path)
}