Interface OrcidClient

  • All Known Implementing Classes:
    OrcidClientImpl

    public interface OrcidClient
    Interface for classes that allow to contact ORCID.
    Author:
    Luca Giamminonni (luca.giamminonni at 4science.it)
    • Method Detail

      • getReadPublicAccessToken

        OrcidTokenResponseDTO getReadPublicAccessToken()
        Retrieves an /read-public access token using a client-credentials OAuth flow, or 2-step OAuth.
        Returns:
        the ORCID token
        Throws:
        OrcidClientException - if some error occurs during the exchange
      • getAccessToken

        OrcidTokenResponseDTO getAccessToken​(String code)
        Exchange the authorization code for an ORCID iD and 3-legged access token. The authorization code expires upon use.
        Parameters:
        code - the authorization code
        Returns:
        the ORCID token
        Throws:
        OrcidClientException - if some error occurs during the exchange
      • getPerson

        org.orcid.jaxb.model.v3.release.record.Person getPerson​(String accessToken,
                                                                String orcid)
        Retrieves a summary of the ORCID person related to the given orcid.
        Parameters:
        accessToken - the access token
        orcid - the orcid id of the record to retrieve
        Returns:
        the Person
        Throws:
        OrcidClientException - if some error occurs during the search
      • getWorks

        org.orcid.jaxb.model.v3.release.record.summary.Works getWorks​(String accessToken,
                                                                      String orcid)
        Retrieves all the works related to the given orcid.
        Parameters:
        accessToken - the access token
        orcid - the orcid id related to the works
        Returns:
        the Works
        Throws:
        OrcidClientException - if some error occurs during the search
      • getWorks

        org.orcid.jaxb.model.v3.release.record.summary.Works getWorks​(String orcid)
        Retrieves all the works related to the given orcid.
        Parameters:
        orcid - the orcid id related to the works
        Returns:
        the Works
        Throws:
        OrcidClientException - if some error occurs during the search
      • getWorkBulk

        org.orcid.jaxb.model.v3.release.record.WorkBulk getWorkBulk​(String accessToken,
                                                                    String orcid,
                                                                    List<String> putCodes)
        Retrieves all the works with the given putCodes related to the given orcid
        Parameters:
        accessToken - the access token
        orcid - the orcid id
        putCodes - the putCodes of the works to retrieve
        Returns:
        the Works
        Throws:
        OrcidClientException - if some error occurs during the search
      • getWorkBulk

        org.orcid.jaxb.model.v3.release.record.WorkBulk getWorkBulk​(String orcid,
                                                                    List<String> putCodes)
        Retrieves all the works with the given putCodes related to the given orcid
        Parameters:
        orcid - the orcid id
        putCodes - the putCodes of the works to retrieve
        Returns:
        the Works
        Throws:
        OrcidClientException - if some error occurs during the search
      • getObject

        <T> Optional<T> getObject​(String accessToken,
                                  String orcid,
                                  String putCode,
                                  Class<T> clazz)
        Retrieves an object from ORCID with the given putCode related to the given orcid.
        Parameters:
        accessToken - the access token
        orcid - the orcid id
        putCode - the object's put code
        clazz - the object's class
        Returns:
        the Object, if any
        Throws:
        OrcidClientException - if some error occurs during the search
        IllegalArgumentException - if the given object class is not an valid ORCID object
      • getObject

        <T> Optional<T> getObject​(String orcid,
                                  String putCode,
                                  Class<T> clazz)
        Retrieves an object from ORCID with the given putCode related to the given orcid using the public API.
        Parameters:
        orcid - the orcid id
        putCode - the object's put code
        clazz - the object's class
        Returns:
        the Object, if any
        Throws:
        OrcidClientException - if some error occurs during the search
        IllegalArgumentException - if the given object class is not an valid ORCID object
      • push

        OrcidResponse push​(String accessToken,
                           String orcid,
                           Object object)
        Push the given object to ORCID.
        Parameters:
        accessToken - the access token
        orcid - the orcid id
        object - the orcid object to push
        Returns:
        the orcid response if no error occurs
        Throws:
        OrcidClientException - if some error occurs during the push
        IllegalArgumentException - if the given object is not an valid ORCID object
      • update

        OrcidResponse update​(String accessToken,
                             String orcid,
                             Object object,
                             String putCode)
        Update the object with the given putCode.
        Parameters:
        accessToken - the access token
        orcid - the orcid id
        object - the orcid object to push
        putCode - the put code of the resource to delete
        Returns:
        the orcid response if no error occurs
        Throws:
        OrcidClientException - if some error occurs during the push
        IllegalArgumentException - if the given object is not an valid ORCID object
      • deleteByPutCode

        OrcidResponse deleteByPutCode​(String accessToken,
                                      String orcid,
                                      String putCode,
                                      String path)
        Delete the ORCID object with the given putCode on the given path.
        Parameters:
        accessToken - the access token
        orcid - the orcid id
        putCode - the put code of the resource to delete
        path - the path of the resource to delete
        Returns:
        the orcid response if no error occurs
        Throws:
        OrcidClientException - if some error occurs during the search