/** * Add new collaborators, or update the permission levels of existing collaborators. If the indicated patient record * doesn't exist, or if the user sending the request doesn't have the right to manage the target patient record, no * change is performed and an error is returned. * * @param collaborators a list of collaborators to modify, each of which must have {@code id} and {@code level} * properties * @param patientId internal identifier of a patient record * @return a status message */ @PATCH @RequiredAccess("manage") @Consumes(MediaType.APPLICATION_JSON) Response addCollaborators(CollaboratorsRepresentation collaborators, @PathParam("patient-id") String patientId);
/** * Add new collaborators, or update the permission levels of existing collaborators. If the indicated entity record * doesn't exist, or if the user sending the request doesn't have the right to manage the target entity record, no * change is performed and an error is returned. * * @param collaborators a list of collaborators to modify, each of which must have {@code id} and {@code level} * properties * @param entityId internal identifier of an entity record * @param entityType the type of entity (either "patients" or "families") * @return a status message */ @PATCH @RequiredAccess("manage") @Consumes(MediaType.APPLICATION_JSON) Response addCollaborators(CollaboratorsRepresentation collaborators, @PathParam("entity-id") String entityId, @PathParam("entity-type") String entityType);
/** * Update a patient record, identified by its internal PhenoTips identifier, from its JSON representation. Existing * patient data is merged with the provided JSON representation, if possible. If the indicated patient record * doesn't exist, or if the user sending the request doesn't have the right to edit the target patient record, no * change is performed and an error is returned. If a field is set in the patient record, but missing in the JSON, * then that field is not changed. * * @param json the JSON representation of the new patient * @param id the patient's internal identifier, see {@link org.phenotips.data.Patient#getId()} * @return a status message */ @PATCH @Consumes(MediaType.APPLICATION_JSON) @RequiredAccess("edit") Response patchPatient(String json, @PathParam("entity-id") String id);
/** * Add new collaborators, or update the permission levels of existing collaborators. If the indicated patient record * doesn't exist, or if the user sending the request doesn't have the right to manage the target patient record, no * change is performed and an error is returned. The request data must contain properties "collaborator" and * "level". Multiple values are accepted, if an equal number of values is received for both properties, and they are * paired in the order that they appear in the request. Data can be sent both in the request body and in the query * string, with the latter taking precedence over the former. If an unequal number of parameter values is received, * then no change is performed and an error is returned. * * @param patientId internal identifier of a patient record * @return a status message */ @PATCH @RequiredAccess("manage") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) Response addCollaborators(@PathParam("patient-id") String patientId);
/** * Update a patient record, identified by its given "external" identifier, from its JSON representation. Existing * patient data is merged with the provided JSON representation, if possible. If the user sending the request * doesn't have the right to edit the target patient record, no change is performed and an error is returned. If the * indicated patient record doesn't exist, and a valid JSON is provided, a new patient record is created with the * provided data. If multiple records exist with the same given identifier, no change is performed, and a list of * links to each such record is returned. If a field is set in the patient record, but missing in the JSON, then * that field is not changed. * * @param json the JSON representation of the new patient to add * @param eid the patient's given "external" identifier, see {@link org.phenotips.data.Patient#getExternalId()} * @return a status message */ @PATCH @Consumes(MediaType.APPLICATION_JSON) @RequiredAccess("edit") Response patchPatient(String json, @PathParam("eid") String eid);
/** * Add new collaborators, or update the permission levels of existing collaborators. If the indicated entity record * doesn't exist, or if the user sending the request doesn't have the right to manage the target entity record, no * change is performed and an error is returned. The request data must contain properties "collaborator" and * "level". Multiple values are accepted, if an equal number of values is received for both properties, and they are * paired in the order that they appear in the request. Data can be sent both in the request body and in the query * string, with the latter taking precedence over the former. If an unequal number of parameter values is received, * then no change is performed and an error is returned. * * @param entityId internal identifier of an entity record * @param entityType the type of entity (either "patients" or "families") * @return a status message */ @PATCH @RequiredAccess("manage") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) Response addCollaborators(@PathParam("entity-id") String entityId, @PathParam("entity-type") String entityType);
/** * Update permissions: owner, collaborators, visibility. Not all elements must be present in the input JSON, the * missing pieces will be left as-is. The submitted owner and visibility will be updated, but the submitted * collaborators will be added to the existing list of collaborators. To remove an individual collaborator, send a * {@code DELETE} request to the targeted {@link CollaboratorResource}, or {@code PUT} the full permissions without * the collaborators to be removed. If the indicated patient record doesn't exist, or if the user sending the * request doesn't have the right to edit the target patient record, no change is performed and an error is * returned. * * @param permissions may contain owner and visibility representations, and a list of collaborator representations * @param patientId identifier of the patient whose permissions should be changed * @return a status message */ @PATCH @RequiredAccess("manage") @Consumes(MediaType.APPLICATION_JSON) Response updatePermissions(PermissionsRepresentation permissions, @PathParam("patient-id") String patientId); }
/** * Update permissions: owner, collaborators, visibility. Not all elements must be present in the input JSON, the * missing pieces will be left as-is. The submitted owner and visibility will be updated, but the submitted * collaborators will be added to the existing list of collaborators. To remove an individual collaborator, send a * {@code DELETE} request to the targeted {@link CollaboratorResource}, or {@code PUT} the full permissions without * the collaborators to be removed. If the indicated entity record doesn't exist, or if the user sending the * request doesn't have the right to edit the target entity record, no change is performed and an error is * returned. * * @param permissions may contain owner and visibility representations, and a list of collaborator representations * @param entityId identifier of the entity whose permissions should be changed * @param entityType the type of entity (either "patients" or "families") * @return a status message */ @PATCH @RequiredAccess("manage") @Consumes(MediaType.APPLICATION_JSON) Response updatePermissions(PermissionsRepresentation permissions, @PathParam("entity-id") String entityId, @PathParam("entity-type") String entityType); }
/** * Update a patient record, identified by an arbitrary label and its corresponding identifier value, from its JSON * representation. Existing patient data is merged with the provided JSON representation, if possible. If the user * sending the request doesn't have the right to edit the target patient record, no change is performed and an * error is returned. If the indicated patient record doesn't exist, however a valid JSON is provided with the * query parameter "create" set to true, then a new patient record is created with the provided data; otherwise no * change is performed and an error is returned. If multiple records exist with the same given identifier for the * given label, no change is performed, and a list of links to each such record is returned. If a field is set in * the patient record, but missing in the JSON, then that field is not changed. * * @param json the JSON representation of the new patient to add * @param label an arbitrary label, either exists in all patients, or exists in at least one patient * @param id the patient's given external identifier for the given label * @param create whether a patient record should be created given none exist for the label and id provided * @return a status message */ @PATCH @Consumes(MediaType.APPLICATION_JSON) @RequiredAccess("edit") Response patchPatient(String json, @PathParam("label") String label, @PathParam("id") String id, @QueryParam("create") @DefaultValue("false") boolean create);