/** * Resource for working with patient independent features of {@link org.phenotips.data.permissions.Visibility}. * * @version $Id: 8ad903420649e549629b012eccb942add63a0eaf $ * @since 1.3M2 */ @Path("/permissions/visibility") @Relation("https://phenotips.org/rel/visibilityOptions") @ParentResource(RootResource.class) public interface VisibilityOptionsResource { /** * The system has several predefined options of visibility levels. * * @return all the enabled visibility levels present in the system */ @GET @Produces(MediaType.APPLICATION_JSON) VisibilityOptionsRepresentation getVisibilityOptions(); }
/** * Get the relation type specified in the {@code @Relation} annotation on the target class or one of its implemented * interfaces. * * @param resource the class of a REST resource, which must have a {@code @Relation} annotation * @return the specified relation type, usually in the form of an URL, or {@code null} if not set */ private String getRel(Class<?> resource) { String relation = null; Relation relationAnnotation = resource.getAnnotation(Relation.class); if (relationAnnotation != null) { relation = relationAnnotation.value(); } return relation; } }
/** * Resource for working with patient independent features of {@link org.phenotips.data.permissions.Visibility}. * * @version $Id: 8ad903420649e549629b012eccb942add63a0eaf $ * @since 1.3M2 */ @Path("/permissions/visibility") @Relation("https://phenotips.org/rel/visibilityOptions") @ParentResource(RootResource.class) public interface VisibilityOptionsResource { /** * The system has several predefined options of visibility levels. * * @return all the enabled visibility levels present in the system */ @GET @Produces(MediaType.APPLICATION_JSON) VisibilityOptionsRepresentation getVisibilityOptions(); }
/** * Get the relation type specified in the {@code @Relation} annotation on the target class or one of its implemented * interfaces. * * @param resource the class of a REST resource, which must have a {@code @Relation} annotation * @return the specified relation type, usually in the form of an URL, or {@code null} if not set */ private String getRel(Class<?> resource) { String relation = null; Relation relationAnnotation = resource.getAnnotation(Relation.class); if (relationAnnotation != null) { relation = relationAnnotation.value(); } return relation; } }
/** * Resource for working with multiple patient records, identified by their given "external" or "internal" identifiers. * * @version $Id: ccdab503b8f003c5ee0d6bf4cb203c207947e204 $ * @since 1.3M5 */ @Path("/patients/fetch") @Relation("https://phenotips.org/rel/patientRecords") @ParentResource(PatientsResource.class) public interface PatientsFetchResource { /** * Retrieve multiple patient records, identified by their given "external" or "internal" identifiers, in their JSON * representation. If any of the indicated patient records don't exist, or if the user sending the request doesn't * have the right to view any of the target patient records, they are excluded from the search results. * * @return JSON representations of the requested patients, or a status message in case of error */ @GET @Produces(MediaType.APPLICATION_JSON) Response fetchPatients(); }
/** * Resource for resolving multiple vocabulary terms from any valid vocabulary, given a list of their identifiers. Each * identifier must have a valid vocabulary prefix of format {@code <vocabulary prefix>:<term id>} (e.g. HP:0000526). * * @version $Id: add3f33cdcd5490f33a74ea94dc1a57cd452ee0f $ * @since 1.4 */ @Path("/vocabularies/terms/fetch") @Relation("https://phenotips.org/rel/vocabularyTerm") @ParentResource(VocabulariesResource.class) public interface VocabularyTermsResolveResource { /** * Retrieves a JSON representation of the {@link org.phenotips.vocabulary.VocabularyTerm} objects by resolving the * term identifiers using their prefix. The terms that cannot be resolved are ignored. The following request * parameters are used: * * <dl> * <dt>term-id</dt> * <dd>a list of term IDs that should be resolved</dd> * </dl> * * @return the requested terms that were resolved successfully */ @GET @Produces(MediaType.APPLICATION_JSON) Response resolveTerms(); }
/** * Resource for searching in a category for terms matching an input (vocabulary suggest). * * @version $Id: 4fb33572a148793ec311d9ad0385ee423e34ed23 $ * @since 1.4 */ @Path("/vocabularies/categories/{category}/suggest") @ParentResource(CategoryResource.class) @Relation("https://phenotips.org/rel/categoryTermSuggest") public interface CategoryTermSuggestionsResource { /** * Provides term suggestions for the specified vocabulary category as a {@link Response}. Request can optionally * specify the maximum number of results to return. If no suggestions are found, {@link Response} will not contain * any terms. * * @param category The name of the vocabulary category to be used for suggestions. If no matching category is found, * an error is returned to the user * @param input The string which will be used to generate suggestions * @param maxResults The maximum number of results to be returned; default is 10 * @return A {@link Response} object representing a list of {@link VocabularyTerm term} suggestions. */ @GET @Produces(MediaType.APPLICATION_JSON) Response suggest( @PathParam("category") String category, @QueryParam("input") String input, @QueryParam("maxResults") @DefaultValue("10") int maxResults); }
@Relation("https://phenotips.org/rel/suggest") public interface VocabularyTermSuggestionsResource
@Relation("https://phenotips.org/rel/suggest") public interface VocabularyTermSuggestionsResource
@Relation("https://phenotips.org/rel/patientRecordsRepository") @ParentResource(RootResource.class) public interface PatientsResource
@Relation("https://phenotips.org/rel/suggest") public interface FamiliesSuggestionsResource
/** * Root resource for working with vocabularies, listing all the available vocabularies. * * @version $Id: 2b17918bfdefb172e1434c11c9fdaaf2f9a52ff0 $ * @since 1.3M1 */ @Unstable("New API introduced in 1.3") @Path("/vocabularies") @ParentResource(RootResource.class) @Relation("https://phenotips.org/rel/vocabularies") public interface VocabulariesResource { /** * Entry resource for the Vocabularies RESTful API, provides a list of available vocabulary resources. * * @return a {@link Vocabularies} resource representing all the vocabularies that are currently available */ @GET @Produces(MediaType.APPLICATION_JSON) Vocabularies getAllVocabularies(); }
@Relation("https://phenotips.org/rel/suggest") public interface PatientsSuggestionsResource
@Relation("https://phenotips.org/rel/permissions") @ParentResource(PatientResource.class) public interface PermissionsResource
/** * Root resource for working with vocabularies, listing all the available vocabularies. * * @version $Id: 2b17918bfdefb172e1434c11c9fdaaf2f9a52ff0 $ * @since 1.3M1 */ @Unstable("New API introduced in 1.3") @Path("/vocabularies") @ParentResource(RootResource.class) @Relation("https://phenotips.org/rel/vocabularies") public interface VocabulariesResource { /** * Entry resource for the Vocabularies RESTful API, provides a list of available vocabulary resources. * * @return a {@link Vocabularies} resource representing all the vocabularies that are currently available */ @GET @Produces(MediaType.APPLICATION_JSON) Vocabularies getAllVocabularies(); }
/** * Resource for working with vocabulary categories, listing all the available categories. * * @version $Id: d1b1dcf54d44457aac1d18774f48880f4c691dca $ * @since 1.4 */ @Unstable("New API introduced in 1.4") @Path("/vocabularies/categories") @ParentResource(VocabulariesResource.class) @Relation("https://phenotips.org/rel/categories") public interface CategoriesResource { /** * Provides a list of all available vocabulary categories. * * @return a {@link Categories} resource representing all the vocabulary categories that are currently available */ @GET @Produces(MediaType.APPLICATION_JSON) Categories getAllCategories(); }
/** * Root resource for working with users and groups of users. * * @version $Id: 5dc8764417fab526415213a72c123a5c3d0acfc4 $ * @since 1.4 */ @Unstable("New API introduced in 1.4") @Path("/principals") @ParentResource(RootResource.class) @Relation("https://phenotips.org/rel/principals") public interface PrincipalsResource { /** * Entry resource for the principals RESTful API, provides a list of available principals (users or groups) as JSON. * If no suggestions are found, an empty list is returned. * * @return a JSON object containing all results found */ @GET @Produces(MediaType.APPLICATION_JSON) Response getAllUsersAndGroups(); }
/** * A resource for working with an individual category that contains one or more * {@link org.phenotips.vocabulary.Vocabulary} objects. * * @version $Id: e8a66e8396071aa9d09445c1320eefabc75dd5d5 $ * @since 1.4 */ @Unstable("New API introduced in 1.4") @Path("/vocabularies/categories/{category}") @ParentResource(CategoriesResource.class) @Relation("https://phenotips.org/rel/category") public interface CategoryResource { /** * Retrieves the resource used for working with the specified category. * * @param categoryName the vocabulary category name, for example {@code phenotype} * @return a {@link Category} representation */ @GET @Produces(MediaType.APPLICATION_JSON) Category getCategory(@PathParam("category") String categoryName); }
@Relation("https://phenotips.org/rel/permissions") @ParentResource(PatientResource.class) public interface PermissionsResource
/** * Resource for working with individual {@link org.phenotips.vocabulary.VocabularyTerm} when the containing vocabulary * is not known. * * @version $Id: 9e20e412397f820d66b0cad76eee6cb182565732 $ * @since 1.3M2 */ @Unstable("New API introduced in 1.3") @Path("/vocabularies/terms/{term-id}") @ParentResource(VocabularyResource.class) @Relation("https://phenotips.org/rel/vocabularyTerm") public interface VocabularyTermResolveResource { /** * Retrieves a JSON representation of the {@link org.phenotips.vocabulary.VocabularyTerm} by resolving the term * using its prefix. * * @param termId the term identifier, in the format {@code <vocabulary prefix>:<term id>}, for example * {@code HP:0002066} * @return the requested term, or an error if the term could not be resolved */ @GET @Produces(MediaType.APPLICATION_JSON) Response resolveTerm(@PathParam("term-id") String termId); }