demarches_simpy.actions moduleο
- class AnnotationModifier(profile, dossier, instructeur_id=None, **kwargs)[source]ο
Class to modify anotation of a dossier
- Parameters:
profile (Profile) β The profile to use to perform the action
dossier (Dossier) β The dossier to modify
instructeur_id (str, optional) β The instructeur id to use to perform the action, if not provided, the profile instructeur id will be used
profile β The profile to use to perform the action
dossier β The dossier to modify
instructeur_id β The instructeur id to use to perform the action, if not provided, the profile instructeur id will be used
- perform(anotation, value=None)[source]ο
Set annotation to the dossier
- Parameters:
anotation (dict[str, str]) β
The anotation to set, must be a valid anotation structure:
{ "id" : "anotation_id", "stringValue" : "anotation_value" }
If the anotation is not valid, the method will return False
value (str) β The value to set to the anotation, if not provided, the anotation will be set to its default value
- Return type:
int- Returns:
True β if anotation was set
False β otherwise
- class FileUploader(profile, dossier, **kwargs)[source]ο
Class to upload file to a dossier
- Parameters:
Internal function to create an action interface
- Parameters:
**kwargs (dict, optional) β
verbose parameter enable verbose query_path : str, optional
The path to the request graphql file (default : ./query/actions.graphql)
- instructeur_idstr, optional
The instructeur id to use to perform the action, if not provided, the profile instructeur id will be used
- no_instructeur_idbool, optional
If set to True, the action will not be performed if no instructeur id is provided to the profile or to the action
- request_builderRequestBuilder, optional
The request builder to use to perform the action, if not provided, a new one will be created using the query_path
- get_files_uploaded()[source]ο
Get the list of files uploaded
- Returns:
The list of files uploaded, each file is a dict with a specific structure, see
FileUploader.get_last_file_uploaded()for more details- Return type:
list
- get_last_file_uploaded()[source]ο
Get the last file uploaded
- Returns:
The last file uploaded, the file is a dict with the following structure:
{ "fileName" : "file_name", "contentType" : "file_content_type", "signedBlobId" : "file_signed_blob_id" }
If no file was uploaded, the method will return None
- Return type:
dict
- perform(file_path, file_name, file_type='application/pdf')[source]ο
Upload a file to the dossier
- Parameters:
file_path (str) β The path to the file to upload
file_name (str) β The name of the file to upload
file_type (str, optional) β The type of the file to upload, if not provided, the file will be set to its default value : βapplication/pdfβ
- Return type:
int- Returns:
SUCCESS β if file was uploaded
ERROR β otherwise
- class MessageSender(profile, dossier, instructeur_id=None, **kwargs)[source]ο
Class to send message to a dossier
- Parameters:
- perform(mess, file_uploaded=None)[source]ο
Send a message to the dossier
- Parameters:
mess (str) β The message to send
file_uploaded (dict, optional) β
The file to send with the message, if not provided, no file will be sent
The file must be a valid file structure:
{ "signedBlobId" : "file_id", "filename" : "file_name", "contentType" : "file_content_type" }
- Return type:
bool- Returns:
SUCCESS β if message was sent
ERROR β otherwise
- class StateModifier(profile, dossier, instructeur_id=None, **kwargs)[source]ο
Class to change state of a dossier
- Parameters:
- perform(state, msg='')[source]ο
Change the state of the dossier
- Parameters:
state (DossierState) β The state to set to the dossier
msg (str, optional) β The message to set to the dossier, if not provided, the message will be set to its default value : ββ
- Return type:
int