github.com/uvalib/orcid-access-ws@v0.0.0-20250612130209-7d062dbabf9d/orcidaccessws/orcid/public_protocol.go (about)

     1  package orcid
     2  
     3  //
     4  // v2.0 response structure
     5  //
     6  
     7  // a person query contains a person response
     8  type orcidPersonResponse struct {
     9  	Name      orcidName      `json:"name,omitempty"`
    10  	Biography orcidBiography `json:"biography,omitempty"`
    11  }
    12  
    13  type orcidName struct {
    14  	GivenName   stringValueField `json:"given-names,omitempty"`
    15  	FamilyName  stringValueField `json:"family-name,omitempty"`
    16  	DisplayName stringValueField `json:"credit-name,omitempty"`
    17  	Path        string           `json:"path,omitempty`
    18  }
    19  
    20  type orcidBiography struct {
    21  	Content string `json:"content,omitempty"`
    22  }
    23  
    24  //
    25  // v1.2 response structure
    26  //
    27  
    28  const publicProtocolVersion = "1.2"
    29  
    30  // all responses have these attributes
    31  type orcidCommonResponse struct {
    32  	Version string           `json:"message-version,omitempty"`
    33  	Error   stringValueField `json:"error-desc,omitempty"`
    34  }
    35  
    36  // a profile query contains a profile response
    37  type orcidProfileResponse struct {
    38  	Profile orcidProfile `json:"orcid-profile,omitempty"`
    39  }
    40  
    41  // a search contains a profile response
    42  type orcidSearchResponse struct {
    43  	SearchResults orcidResults `json:"orcid-search-results,omitempty"`
    44  }
    45  
    46  //
    47  // structures within the ORCID protocol
    48  //
    49  
    50  type orcidProfile struct {
    51  	ID  orcidID  `json:"orcid-identifier,omitempty"`
    52  	Bio orcidBio `json:"orcid-bio,omitempty"`
    53  }
    54  
    55  type orcidID struct {
    56  	URI string `json:"uri,omitempty"`
    57  	ID  string `json:"path,omitempty"`
    58  }
    59  
    60  type orcidResults struct {
    61  	Results    []orcidResult `json:"orcid-search-result,omitempty"`
    62  	TotalFound int           `json:"num-found,omitempty"`
    63  }
    64  
    65  type orcidResult struct {
    66  	Relevancy floatValueField `json:"relevancy-score,omitempty"`
    67  	Profile   orcidProfile    `json:"orcid-profile,omitempty"`
    68  }
    69  
    70  type orcidBio struct {
    71  	PersonalDetails orcidPersonalDetails `json:"personal-details,omitempty"`
    72  	Biography       stringValueField     `json:"biography,omitempty"`
    73  	Urls            orcidUrls            `json:"researcher-urls,omitempty"`
    74  	Keywords        orcidKeywords        `json:"keywords,omitempty"`
    75  }
    76  
    77  type orcidPersonalDetails struct {
    78  	GivenName  stringValueField `json:"given-names,omitempty"`
    79  	FamilyName stringValueField `json:"family-name,omitempty"`
    80  	CreditName stringValueField `json:"credit-name,omitempty"`
    81  }
    82  
    83  type orcidKeywords struct {
    84  	Keywords []stringValueField `json:"keyword,omitempty"`
    85  }
    86  
    87  type orcidUrls struct {
    88  	Urls []orcidURL `json:"researcher-url,omitempty"`
    89  }
    90  
    91  type orcidURL struct {
    92  	Name stringValueField `json:"url-name,omitempty"`
    93  	URL  stringValueField `json:"url,omitempty"`
    94  }
    95  
    96  type stringValueField struct {
    97  	Value string `json:"value,omitempty"`
    98  }
    99  
   100  type floatValueField struct {
   101  	Value float64 `json:"value,omitempty"`
   102  }