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:
  • profile (Profile) – The profile to use to perform the action

  • dossier (Dossier) – The dossier to upload file to

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:
  • profile (Profile) – The profile to use to perform the action

  • dossier (Dossier) – The dossier to send message to

  • instructeur_id (str, optional) – The instructeur id to use to perform the action, if not provided, the profile instructeur id will be used

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:
  • profile (Profile) – The profile to use to perform the action

  • dossier (Dossier) – The dossier to change state

  • instructeur_id (str, optional) – The instructeur id to use to perform the action, if not provided, the profile instructeur id will be used

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