2022-02-04 10:12:15 +01:00
package eu.dnetlib.openaire.community ;
2022-08-19 15:21:40 +02:00
import static eu.dnetlib.openaire.common.ExporterConstants.C ;
import static eu.dnetlib.openaire.common.ExporterConstants.C_CP ;
import static eu.dnetlib.openaire.common.ExporterConstants.C_O ;
import static eu.dnetlib.openaire.common.ExporterConstants.C_PJ ;
import static eu.dnetlib.openaire.common.ExporterConstants.C_ZC ;
import static eu.dnetlib.openaire.common.ExporterConstants.R ;
import static eu.dnetlib.openaire.common.ExporterConstants.W ;
2022-02-04 10:12:15 +01:00
import java.util.List ;
2022-09-26 19:06:51 +02:00
import eu.dnetlib.openaire.community.selectioncriteria.SelectionCriteria ;
2022-02-04 10:12:15 +01:00
import org.springframework.beans.factory.annotation.Autowired ;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty ;
2022-08-19 15:21:40 +02:00
import org.springframework.web.bind.annotation.CrossOrigin ;
import org.springframework.web.bind.annotation.PathVariable ;
import org.springframework.web.bind.annotation.RequestBody ;
import org.springframework.web.bind.annotation.RequestMapping ;
import org.springframework.web.bind.annotation.RequestMethod ;
import org.springframework.web.bind.annotation.RestController ;
import io.swagger.v3.oas.annotations.Operation ;
import io.swagger.v3.oas.annotations.responses.ApiResponse ;
import io.swagger.v3.oas.annotations.responses.ApiResponses ;
import io.swagger.v3.oas.annotations.tags.Tag ;
2022-02-04 10:12:15 +01:00
@RestController
2022-08-19 15:21:40 +02:00
@CrossOrigin ( origins = {
" * "
} )
2022-02-04 10:12:15 +01:00
@ConditionalOnProperty ( value = " openaire.exporter.enable.community " , havingValue = " true " )
2022-08-19 15:21:40 +02:00
@Tag ( name = " OpenAIRE Communities API " , description = " the OpenAIRE Community API " )
2022-02-04 10:12:15 +01:00
public class CommunityApiController {
@Autowired
private CommunityApiCore communityApiCore ;
2022-08-19 15:21:40 +02:00
@RequestMapping ( value = " /community/communities " , produces = {
" application/json "
} , method = RequestMethod . GET )
@Operation ( summary = " get all community profiles " , description = " get all community profiles " , tags = {
C , R
} )
2022-02-04 10:12:15 +01:00
@ApiResponses ( value = {
2022-08-19 15:21:40 +02:00
@ApiResponse ( responseCode = " 200 " , description = " OK " ) ,
@ApiResponse ( responseCode = " 500 " , description = " unexpected error " )
} )
2022-02-04 10:12:15 +01:00
public List < CommunitySummary > listCommunities ( ) throws CommunityException {
return communityApiCore . listCommunities ( ) ;
}
2022-08-19 15:21:40 +02:00
@RequestMapping ( value = " /community/{id} " , produces = {
" application/json "
} , method = RequestMethod . GET )
@Operation ( summary = " get community profile " , description = " get community profile " , tags = {
C , R
} )
2022-02-04 10:12:15 +01:00
@ApiResponses ( value = {
2022-08-19 15:21:40 +02:00
@ApiResponse ( responseCode = " 200 " , description = " OK " ) ,
@ApiResponse ( responseCode = " 404 " , description = " not found " ) ,
@ApiResponse ( responseCode = " 500 " , description = " unexpected error " )
} )
2022-02-04 10:12:15 +01:00
public CommunityDetails getCommunity ( @PathVariable final String id ) throws CommunityException , CommunityNotFoundException {
return communityApiCore . getCommunity ( id ) ;
}
2022-08-19 15:21:40 +02:00
@RequestMapping ( value = " /community/{id} " , produces = {
" application/json "
} , method = RequestMethod . POST )
@Operation ( summary = " update community details " , description = " update community details " , tags = {
C , R
} )
2022-02-04 10:12:15 +01:00
@ApiResponses ( value = {
2022-08-19 15:21:40 +02:00
@ApiResponse ( responseCode = " 200 " , description = " OK " ) ,
@ApiResponse ( responseCode = " 404 " , description = " not found " ) ,
@ApiResponse ( responseCode = " 500 " , description = " unexpected error " )
} )
2022-02-04 10:12:15 +01:00
public void setCommunity (
2022-08-19 15:21:40 +02:00
@PathVariable final String id ,
@RequestBody final CommunityWritableProperties properties ) throws CommunityException , CommunityNotFoundException {
2022-02-04 10:12:15 +01:00
communityApiCore . setCommunity ( id , properties ) ;
}
2022-08-19 15:21:40 +02:00
@RequestMapping ( value = " /community/{id}/projects " , produces = {
" application/json "
} , method = RequestMethod . GET )
@Operation ( summary = " get community projects " , description = " get community projects " , tags = {
C_PJ , R
} )
2022-02-04 10:12:15 +01:00
@ApiResponses ( value = {
2022-08-19 15:21:40 +02:00
@ApiResponse ( responseCode = " 200 " , description = " OK " ) ,
@ApiResponse ( responseCode = " 404 " , description = " not found " ) ,
@ApiResponse ( responseCode = " 500 " , description = " unexpected error " )
} )
2022-02-04 10:12:15 +01:00
public List < CommunityProject > getCommunityProjects ( @PathVariable final String id ) throws CommunityException , CommunityNotFoundException {
return communityApiCore . getCommunityProjects ( id ) ;
}
2022-08-19 15:21:40 +02:00
@RequestMapping ( value = " /community/{id}/projects " , produces = {
" application/json "
} , method = RequestMethod . POST )
@Operation ( summary = " associate a project to the community " , description = " associate a project to the community " , tags = {
C_PJ , W
} )
2022-02-04 10:12:15 +01:00
@ApiResponses ( value = {
2022-08-19 15:21:40 +02:00
@ApiResponse ( responseCode = " 200 " , description = " OK " ) ,
@ApiResponse ( responseCode = " 404 " , description = " not found " ) ,
@ApiResponse ( responseCode = " 500 " , description = " unexpected error " )
} )
2022-02-04 10:12:15 +01:00
public CommunityProject addCommunityProject (
2022-08-19 15:21:40 +02:00
@PathVariable final String id ,
@RequestBody final CommunityProject project ) throws CommunityException , CommunityNotFoundException {
2022-02-04 10:12:15 +01:00
return communityApiCore . addCommunityProject ( id , project ) ;
}
2022-08-19 15:21:40 +02:00
@RequestMapping ( value = " /community/{id}/projects " , produces = {
" application/json "
} , method = RequestMethod . DELETE )
@Operation ( summary = " remove a project from the community " , description = " remove a project from the community " , tags = {
C_PJ , W
} )
2022-02-04 10:12:15 +01:00
@ApiResponses ( value = {
2022-08-19 15:21:40 +02:00
@ApiResponse ( responseCode = " 200 " , description = " OK " ) ,
@ApiResponse ( responseCode = " 404 " , description = " not found " ) ,
@ApiResponse ( responseCode = " 500 " , description = " unexpected error " )
} )
2022-02-04 10:12:15 +01:00
public void deleteCommunityProject (
2022-08-19 15:21:40 +02:00
@PathVariable final String id ,
@RequestBody final Integer projectId ) throws CommunityException , CommunityNotFoundException {
2022-02-04 10:12:15 +01:00
communityApiCore . removeCommunityProject ( id , projectId ) ;
}
2022-09-26 12:15:39 +02:00
@RequestMapping ( value = " /community/{id}/projectList " , produces = {
" application/json "
} , method = RequestMethod . POST )
@Operation ( summary = " associate a list of project to the community " ,
description = " associate a list of project to the community " , tags = {
C_PJ , W
} )
@ApiResponses ( value = {
@ApiResponse ( responseCode = " 200 " , description = " OK " ) ,
@ApiResponse ( responseCode = " 404 " , description = " not found " ) ,
@ApiResponse ( responseCode = " 500 " , description = " unexpected error " )
} )
public List < CommunityProject > addCommunityProjectList (
@PathVariable final String id ,
@RequestBody final List < CommunityProject > projectList ) throws CommunityException , CommunityNotFoundException {
return communityApiCore . addCommunityProjectList ( id , projectList ) ;
}
@RequestMapping ( value = " /community/{id}/projectList " , produces = {
" application/json "
} , method = RequestMethod . DELETE )
@Operation ( summary = " remove a list of projects from the community " ,
description = " remove a list of projects from the community " , tags = {
C_PJ , W
} )
@ApiResponses ( value = {
@ApiResponse ( responseCode = " 200 " , description = " OK " ) ,
@ApiResponse ( responseCode = " 404 " , description = " not found " ) ,
@ApiResponse ( responseCode = " 500 " , description = " unexpected error " )
} )
public void deleteCommunityProjectList (
@PathVariable final String id ,
@RequestBody final List < Integer > projectIdList ) throws CommunityException , CommunityNotFoundException {
communityApiCore . removeCommunityProjectList ( id , projectIdList ) ;
}
2022-08-19 15:21:40 +02:00
@RequestMapping ( value = " /community/{id}/contentproviders " , produces = {
" application/json "
} , method = RequestMethod . GET )
@Operation ( summary = " get the list of content providers associated to a given community " , description = " get the list of content providers associated to a given community " , tags = {
C_CP , R
} )
2022-02-04 10:12:15 +01:00
@ApiResponses ( value = {
2022-08-19 15:21:40 +02:00
@ApiResponse ( responseCode = " 200 " , description = " OK " ) ,
@ApiResponse ( responseCode = " 404 " , description = " not found " ) ,
@ApiResponse ( responseCode = " 500 " , description = " unexpected error " )
} )
2022-02-04 10:12:15 +01:00
public List < CommunityContentprovider > getCommunityContentproviders ( @PathVariable final String id ) throws CommunityException , CommunityNotFoundException {
return communityApiCore . getCommunityContentproviders ( id ) ;
}
2022-08-19 15:21:40 +02:00
@RequestMapping ( value = " /community/{id}/contentproviders " , produces = {
" application/json "
} , method = RequestMethod . POST )
@Operation ( summary = " associate a content provider to the community " , description = " associate a content provider to the community " , tags = {
C_CP , W
} )
2022-02-04 10:12:15 +01:00
@ApiResponses ( value = {
2022-08-19 15:21:40 +02:00
@ApiResponse ( responseCode = " 200 " , description = " OK " ) ,
@ApiResponse ( responseCode = " 404 " , description = " not found " ) ,
@ApiResponse ( responseCode = " 500 " , description = " unexpected error " )
} )
2022-02-04 10:12:15 +01:00
public CommunityContentprovider addCommunityContentprovider (
2022-08-19 15:21:40 +02:00
@PathVariable final String id ,
@RequestBody final CommunityContentprovider contentprovider ) throws CommunityException , CommunityNotFoundException {
2022-02-04 10:12:15 +01:00
return communityApiCore . addCommunityContentprovider ( id , contentprovider ) ;
}
2022-08-19 15:21:40 +02:00
@RequestMapping ( value = " /community/{id}/contentproviders " , produces = {
" application/json "
} , method = RequestMethod . DELETE )
@Operation ( summary = " remove the association between a content provider and the community " , description = " remove the association between a content provider and the community " , tags = {
C_CP , W
} )
2022-02-04 10:12:15 +01:00
@ApiResponses ( value = {
2022-08-19 15:21:40 +02:00
@ApiResponse ( responseCode = " 200 " , description = " OK " ) ,
@ApiResponse ( responseCode = " 404 " , description = " not found " ) ,
@ApiResponse ( responseCode = " 500 " , description = " unexpected error " )
} )
2022-02-04 10:12:15 +01:00
public void removeCommunityContentprovider (
2022-08-19 15:21:40 +02:00
@PathVariable final String id ,
@RequestBody final Integer contentproviderId ) throws CommunityException , CommunityNotFoundException {
2022-02-04 10:12:15 +01:00
communityApiCore . removeCommunityContentProvider ( id , contentproviderId ) ;
}
2022-09-27 16:06:31 +02:00
@RequestMapping ( value = " /community/{id}/contentprovidersList " , produces = {
" application/json "
} , method = RequestMethod . POST )
@Operation ( summary = " associate a list of content providers to the community " ,
description = " associate a list of content providers to the community " , tags = {
C_PJ , W
} )
@ApiResponses ( value = {
@ApiResponse ( responseCode = " 200 " , description = " OK " ) ,
@ApiResponse ( responseCode = " 404 " , description = " not found " ) ,
@ApiResponse ( responseCode = " 500 " , description = " unexpected error " )
} )
public List < CommunityContentprovider > addCommunityContentProvidersList (
@PathVariable final String id ,
@RequestBody final List < CommunityContentprovider > contentprovidersList ) throws CommunityException , CommunityNotFoundException {
return communityApiCore . addCommunityContentProvidersList ( id , contentprovidersList ) ;
}
2022-12-19 12:45:13 +01:00
@RequestMapping ( value = " /community/{id}/contentprovidersList " , produces = {
2022-09-27 16:06:31 +02:00
" application/json "
} , method = RequestMethod . DELETE )
@Operation ( summary = " remove a list of content providers from the community " ,
description = " remove a list of content providers from the community " , tags = {
C_PJ , W
} )
@ApiResponses ( value = {
@ApiResponse ( responseCode = " 200 " , description = " OK " ) ,
@ApiResponse ( responseCode = " 404 " , description = " not found " ) ,
@ApiResponse ( responseCode = " 500 " , description = " unexpected error " )
} )
public void deleteCommunityContentProvidersList (
@PathVariable final String id ,
@RequestBody final List < Integer > contentProviderIdList ) throws CommunityException , CommunityNotFoundException {
communityApiCore . removeCommunityContentProviderList ( id , contentProviderIdList ) ;
}
2022-08-19 15:21:40 +02:00
// ADDING CODE FOR COMMUNITY ORGANIZATIONS
2022-02-04 10:12:15 +01:00
2022-08-19 15:21:40 +02:00
@RequestMapping ( value = " /community/{id}/organizations " , produces = {
" application/json "
} , method = RequestMethod . GET )
@Operation ( summary = " get the list of organizations for a given community " , description = " get the list of organizations for a given community " , tags = {
C_O , R
} )
2022-02-04 10:12:15 +01:00
@ApiResponses ( value = {
2022-08-19 15:21:40 +02:00
@ApiResponse ( responseCode = " 200 " , description = " OK " ) ,
@ApiResponse ( responseCode = " 404 " , description = " not found " ) ,
@ApiResponse ( responseCode = " 500 " , description = " unexpected error " )
} )
2022-02-04 10:12:15 +01:00
public List < CommunityOrganization > getCommunityOrganizations ( @PathVariable final String id ) throws CommunityException , CommunityNotFoundException {
return communityApiCore . getCommunityOrganizations ( id ) ;
}
2022-08-19 15:21:40 +02:00
@RequestMapping ( value = " /community/{id}/organizations " , produces = {
" application/json "
} , method = RequestMethod . POST )
@Operation ( summary = " associate an organization to the community " , description = " associate an organization to the community " , tags = {
C_O , W
} )
2022-02-04 10:12:15 +01:00
@ApiResponses ( value = {
2022-08-19 15:21:40 +02:00
@ApiResponse ( responseCode = " 200 " , description = " OK " ) ,
@ApiResponse ( responseCode = " 404 " , description = " not found " ) ,
@ApiResponse ( responseCode = " 500 " , description = " unexpected error " )
} )
2022-02-04 10:12:15 +01:00
public CommunityOrganization addCommunityOrganization (
2022-08-19 15:21:40 +02:00
@PathVariable final String id ,
@RequestBody final CommunityOrganization organization ) throws CommunityException , CommunityNotFoundException {
2022-02-04 10:12:15 +01:00
return communityApiCore . addCommunityOrganization ( id , organization ) ;
}
2022-08-19 15:21:40 +02:00
@RequestMapping ( value = " /community/{id}/organizations " , produces = {
" application/json "
} , method = RequestMethod . DELETE )
@Operation ( summary = " remove the association between an organization and the community " , description = " remove the association between an organization and the community " , tags = {
C_O , W
} )
2022-02-04 10:12:15 +01:00
@ApiResponses ( value = {
2022-08-19 15:21:40 +02:00
@ApiResponse ( responseCode = " 200 " , description = " OK " ) ,
@ApiResponse ( responseCode = " 404 " , description = " not found " ) ,
@ApiResponse ( responseCode = " 500 " , description = " unexpected error " )
} )
2022-02-04 10:12:15 +01:00
public void removeCommunityOrganization (
2022-08-19 15:21:40 +02:00
@PathVariable final String id ,
@RequestBody final Integer organizationId ) throws CommunityException , CommunityNotFoundException {
2022-02-04 10:12:15 +01:00
communityApiCore . removeCommunityOrganization ( id , organizationId ) ;
}
2022-08-19 15:21:40 +02:00
// **********************
@RequestMapping ( value = " /community/{id}/subjects " , produces = {
" application/json "
} , method = RequestMethod . POST )
@Operation ( summary = " associate a subject to the community " , description = " associate a subject to the community " , tags = {
C , W
} )
2022-02-04 10:12:15 +01:00
@ApiResponses ( value = {
2022-08-19 15:21:40 +02:00
@ApiResponse ( responseCode = " 200 " , description = " OK " ) ,
@ApiResponse ( responseCode = " 404 " , description = " not found " ) ,
@ApiResponse ( responseCode = " 500 " , description = " unexpected error " )
} )
2022-02-04 10:12:15 +01:00
public CommunityDetails addCommunitySubjects (
2022-08-19 15:21:40 +02:00
@PathVariable final String id ,
@RequestBody final List < String > subjects ) throws CommunityException , CommunityNotFoundException {
2022-02-04 10:12:15 +01:00
return communityApiCore . addCommunitySubjects ( id , subjects ) ;
}
2022-08-19 15:21:40 +02:00
@RequestMapping ( value = " /community/{id}/subjects " , produces = {
" application/json "
} , method = RequestMethod . DELETE )
@Operation ( summary = " remove subjects from a community " , description = " remove subjects from a community " , tags = {
C , W
} )
2022-02-04 10:12:15 +01:00
@ApiResponses ( value = {
2022-08-19 15:21:40 +02:00
@ApiResponse ( responseCode = " 200 " , description = " OK " ) ,
@ApiResponse ( responseCode = " 404 " , description = " not found " ) ,
@ApiResponse ( responseCode = " 500 " , description = " unexpected error " )
} )
2022-02-04 10:12:15 +01:00
public CommunityDetails removeCommunitySubjects (
2022-08-19 15:21:40 +02:00
@PathVariable final String id ,
@RequestBody final List < String > subjects ) throws CommunityException , CommunityNotFoundException {
2022-02-04 10:12:15 +01:00
return communityApiCore . removeCommunitySubjects ( id , subjects ) ;
}
2022-09-26 12:15:39 +02:00
@RequestMapping ( value = " /community/{id}/fos " , produces = { " application/json " } , method = RequestMethod . POST )
@Operation (
summary = " associate a fos to the community " ,
description = " associate a fos to the community " ,
tags = { C , W } )
@ApiResponses ( value = {
@ApiResponse ( responseCode = " 200 " , description = " OK " ) ,
@ApiResponse ( responseCode = " 404 " , description = " not found " ) ,
@ApiResponse ( responseCode = " 500 " , description = " unexpected error " ) } )
public CommunityDetails addCommunityFOS (
@PathVariable final String id ,
@RequestBody final List < String > subjects ) throws CommunityException , CommunityNotFoundException {
return communityApiCore . addCommunityFOS ( id , subjects ) ;
}
@RequestMapping ( value = " /community/{id}/fos " , produces = { " application/json " } , method = RequestMethod . DELETE )
@Operation (
summary = " remove fos from a community " ,
description = " remove fos from a community " ,
tags = { C , W } )
@ApiResponses ( value = {
@ApiResponse ( responseCode = " 200 " , description = " OK " ) ,
@ApiResponse ( responseCode = " 404 " , description = " not found " ) ,
@ApiResponse ( responseCode = " 500 " , description = " unexpected error " ) } )
public CommunityDetails removeCommunityFOS (
@PathVariable final String id ,
@RequestBody final List < String > subjects ) throws CommunityException , CommunityNotFoundException {
return communityApiCore . removeCommunityFOS ( id , subjects ) ;
}
@RequestMapping ( value = " /community/{id}/sdg " , produces = { " application/json " } , method = RequestMethod . POST )
@Operation (
summary = " associate a sdg to the community " ,
description = " associate a sdg to the community " ,
tags = { C , W } )
@ApiResponses ( value = {
@ApiResponse ( responseCode = " 200 " , description = " OK " ) ,
@ApiResponse ( responseCode = " 404 " , description = " not found " ) ,
@ApiResponse ( responseCode = " 500 " , description = " unexpected error " ) } )
public CommunityDetails addCommunitySDG (
@PathVariable final String id ,
@RequestBody final List < String > subjects ) throws CommunityException , CommunityNotFoundException {
return communityApiCore . addCommunitySDG ( id , subjects ) ;
}
@RequestMapping ( value = " /community/{id}/sdg " , produces = { " application/json " } , method = RequestMethod . DELETE )
@Operation (
summary = " remove sdg from a community " ,
description = " remove sdg from a community " ,
tags = { C , W } )
@ApiResponses ( value = {
@ApiResponse ( responseCode = " 200 " , description = " OK " ) ,
@ApiResponse ( responseCode = " 404 " , description = " not found " ) ,
@ApiResponse ( responseCode = " 500 " , description = " unexpected error " ) } )
public CommunityDetails removeCommunitySDG (
@PathVariable final String id ,
@RequestBody final List < String > subjects ) throws CommunityException , CommunityNotFoundException {
return communityApiCore . removeCommunitySDG ( id , subjects ) ;
}
@RequestMapping ( value = " /community/{id}/advancedConstraint " , produces = { " application/json " } , method = RequestMethod . POST )
@Operation (
summary = " the set of constraints to be used to extend the association between result and community " ,
description = " the set of constraints to be used to extend the association between result and community " ,
tags = { C , W } )
@ApiResponses ( value = {
@ApiResponse ( responseCode = " 200 " , description = " OK " ) ,
@ApiResponse ( responseCode = " 404 " , description = " not found " ) ,
@ApiResponse ( responseCode = " 500 " , description = " unexpected error " ) } )
public CommunityDetails addAdvancedConstraint (
@PathVariable final String id ,
2022-09-26 19:06:51 +02:00
@RequestBody final SelectionCriteria advancedConstraint ) throws CommunityException , CommunityNotFoundException {
2022-09-26 12:15:39 +02:00
return communityApiCore . addCommunityAdvancedConstraint ( id , advancedConstraint ) ;
}
@RequestMapping ( value = " /community/{id}/advancedConstraint " , produces = { " application/json " } , method = RequestMethod . DELETE )
@Operation (
summary = " remove the constraints to extend the association result community from a community " ,
description = " remove the constraints to extend the association result community from a community " ,
tags = { C , W } )
@ApiResponses ( value = {
@ApiResponse ( responseCode = " 200 " , description = " OK " ) ,
@ApiResponse ( responseCode = " 404 " , description = " not found " ) ,
@ApiResponse ( responseCode = " 500 " , description = " unexpected error " ) } )
public CommunityDetails removeAdvancedConstraint (
@PathVariable final String id ) throws CommunityException , CommunityNotFoundException {
return communityApiCore . removeCommunityAdvancedConstraint ( id ) ;
}
2022-02-04 10:12:15 +01:00
2022-08-19 15:21:40 +02:00
@RequestMapping ( value = " /community/{id}/zenodocommunities " , produces = {
" application/json "
} , method = RequestMethod . GET )
@Operation ( summary = " get the list of Zenodo communities associated to a given community " , description = " get the list of Zenodo communities associated to a given community " , tags = {
C_ZC , R
} )
2022-02-04 10:12:15 +01:00
@ApiResponses ( value = {
2022-08-19 15:21:40 +02:00
@ApiResponse ( responseCode = " 200 " , description = " OK " ) ,
@ApiResponse ( responseCode = " 404 " , description = " not found " ) ,
@ApiResponse ( responseCode = " 500 " , description = " unexpected error " )
} )
2022-02-04 10:12:15 +01:00
public List < CommunityZenodoCommunity > getCommunityZenodoCommunities ( @PathVariable final String id ) throws CommunityException , CommunityNotFoundException {
return communityApiCore . getCommunityZenodoCommunities ( id ) ;
}
2022-08-19 15:21:40 +02:00
@RequestMapping ( value = " /community/{id}/zenodocommunities " , produces = {
" application/json "
} , method = RequestMethod . POST )
@Operation ( summary = " associate a Zenodo community to the community " , description = " associate a Zenodo community to the community " , tags = {
C_ZC , W
} )
2022-02-04 10:12:15 +01:00
@ApiResponses ( value = {
2022-08-19 15:21:40 +02:00
@ApiResponse ( responseCode = " 200 " , description = " OK " ) ,
@ApiResponse ( responseCode = " 404 " , description = " not found " ) ,
@ApiResponse ( responseCode = " 500 " , description = " unexpected error " )
} )
2022-02-04 10:12:15 +01:00
public CommunityZenodoCommunity addCommunityZenodoCommunity (
2022-08-19 15:21:40 +02:00
@PathVariable final String id ,
@RequestBody final CommunityZenodoCommunity zenodocommunity ) throws CommunityException , CommunityNotFoundException {
2022-02-04 10:12:15 +01:00
return communityApiCore . addCommunityZenodoCommunity ( id , zenodocommunity ) ;
}
2022-08-19 15:21:40 +02:00
@RequestMapping ( value = " /community/{id}/zenodocommunities " , produces = {
" application/json "
} , method = RequestMethod . DELETE )
@Operation ( summary = " remove a Zenodo community from a community " , description = " remove a Zenodo community from a community " , tags = {
C_ZC , W
} )
2022-02-04 10:12:15 +01:00
@ApiResponses ( value = {
2022-08-19 15:21:40 +02:00
@ApiResponse ( responseCode = " 200 " , description = " OK " ) ,
@ApiResponse ( responseCode = " 404 " , description = " not found " ) ,
@ApiResponse ( responseCode = " 500 " , description = " unexpected error " )
} )
2022-02-04 10:12:15 +01:00
public void removeCommunityZenodoCommunity (
2022-08-19 15:21:40 +02:00
@PathVariable final String id ,
@RequestBody final Integer zenodoCommId ) throws CommunityException , CommunityNotFoundException {
2022-02-04 10:12:15 +01:00
communityApiCore . removeCommunityZenodoCommunity ( id , zenodoCommId ) ;
}
2022-08-19 15:21:40 +02:00
@RequestMapping ( value = " /community/{zenodoId}/openairecommunities " , produces = {
" application/json "
} , method = RequestMethod . GET )
@Operation ( summary = " get the list of OpenAIRE communities associated to a given Zenodo community " , description = " get the list of OpenAIRE communities associated to a given Zenodo community " , tags = {
C_ZC , R
} )
2022-02-04 10:12:15 +01:00
@ApiResponses ( value = {
2022-08-19 15:21:40 +02:00
@ApiResponse ( responseCode = " 200 " , description = " OK " ) ,
@ApiResponse ( responseCode = " 404 " , description = " not found " ) ,
@ApiResponse ( responseCode = " 500 " , description = " unexpected error " )
} )
2022-02-04 10:12:15 +01:00
public CommunityOpenAIRECommunities getOpenAireCommunities (
2022-08-19 15:21:40 +02:00
@PathVariable final String zenodoId ) throws CommunityException , CommunityNotFoundException {
2022-02-04 10:12:15 +01:00
return communityApiCore . getOpenAIRECommunities ( zenodoId ) ;
}
}